Define a new \XXseries macro for light fonts

There is no official interface. You can do it this way (this is lualatex-syntax, for the xelatex syntax check e.g. eu1lmr.fd). You should be aware that it will not work together with local font changes through \addfontfeatures or a local \fontspec as this often create a new family.

\documentclass{article}

\usepackage{fontspec}
\setmainfont{Source Sans Pro}

\normalfont
\makeatletter
\DeclareFontShape{\f@encoding}{\f@family}{l}{n}%
     {<->    name:sourcesanspro-light:script=latn;+trep;+tlig;
      }{}

\DeclareFontShape{\f@encoding}{\f@family}{l}{it}%
     {<->    name:sourcesanspro-lightit:script=latn;+trep;+tlig;
      }{}
\makeatother

\DeclareRobustCommand{\ltseries}{%
\fontseries{l}\selectfont}

\begin{document}
\ltseries
Light

\mdseries
Regular

\bfseries
Bold

 \normalfont
 {\addfontfeatures{Ligatures=NoCommon} abc \ltseries abc}

\end{document}

Ulrikes’s answer works fine after changing \DeclareFontShape in the XeTeX-way, this is how it looks like:

\documentclass{article}

\usepackage{fontspec}
\setsansfont{Source Sans Pro}
   % http://www.google.com/fonts/specimen/Source+Sans+Pro

\begingroup % \DeclareFontShape acts globally
\makeatletter
\sffamily

\DeclareFontShape{\f@encoding}{\f@family}{l}{n}%
     {<->    "[SourceSansPro-Light]:mapping=tex-text"
      }{}
\DeclareFontShape{\f@encoding}{\f@family}{l}{it}%
     {<->    "[SourceSansPro-LightIt]:mapping=tex-text"
      }{}
\endgroup % removes the effects of \sffamily and \makeatletter

\DeclareRobustCommand{\ltseries}{%
  \fontseries{l}\selectfont}

\makeatother

\begin{document}
\ltseries
Light (not available)

\mdseries
Regular

\bfseries
Bold

\sffamily
\ltseries
Light

\mdseries
Regular

\bfseries
Bold
\end{document}

The \sffamily before \DeclareFontShape is necessary to let \f@family have the right family name. At the document begin there’s a \normalfont so \sffamily doesn’t change the font for the document here …


With a recent version of fontspec (v2.5a at time of writing) there is an official interface to declare new font shapes: One can use the FontFace option to define a new NFSS font face:

\documentclass{article}

\usepackage{fontspec}
\setsansfont[
   FontFace = {lt}{n}{SourceSansPro-Light},
   FontFace = {lt}{it}{SourceSansPro-LightIt},
]{Source Sans Pro}

\DeclareRobustCommand{\ltseries}{\fontseries{lt}\selectfont}
\DeclareTextFontCommand{\textsi}{\sishape}

\begin{document}
\ltseries
Light \textit{Italic} (not available) 

\mdseries
Regular \textit{Italic}

\bfseries
Bold \textit{Italic}

\sffamily
\ltseries
Light \textit{Italic}

\mdseries
Regular \textit{Italic}

\bfseries
Bold \textit{Italic}
\end{document}

This is much more comfortable than using \DeclareFontShape. In the example I also added the definition of \textlt which was missing in the other answers.

Tags:

Fonts

Fontspec