diff options
author | Karl Berry <karl@freefriends.org> | 2013-01-02 22:55:28 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2013-01-02 22:55:28 +0000 |
commit | cf728e5f5be451f9219e15a4acc2337d9ebc65f3 (patch) | |
tree | ef4e9a2c2d655fd9e384eace0ac87c3557b8bc10 /Master/texmf-dist/tex/latex/sourcesanspro/sourcesanspro.sty | |
parent | 120aa6671f32d669b6b002d2a1537b9bbe2356fb (diff) |
sourcesanspro (2jan13)
git-svn-id: svn://tug.org/texlive/trunk@28694 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/sourcesanspro/sourcesanspro.sty')
-rw-r--r-- | Master/texmf-dist/tex/latex/sourcesanspro/sourcesanspro.sty | 221 |
1 files changed, 205 insertions, 16 deletions
diff --git a/Master/texmf-dist/tex/latex/sourcesanspro/sourcesanspro.sty b/Master/texmf-dist/tex/latex/sourcesanspro/sourcesanspro.sty index 8616ff55521..8e6acbbf28e 100644 --- a/Master/texmf-dist/tex/latex/sourcesanspro/sourcesanspro.sty +++ b/Master/texmf-dist/tex/latex/sourcesanspro/sourcesanspro.sty @@ -1,29 +1,218 @@ % Source Sans Pro for LaTeX -% +% % Silke Hofstra, silke@slxh.nl % -% This file selects either the OTF or the TYPE1 package based on your engine. +% This file selects either the OTF or the TYPE1 fonts based on +% the LaTeX engine used. % -% Licenced under the LPPL +% Licenced under the LPPL v1.3 or higher. % \NeedsTeXFormat{LaTeX2e}[1994/12/01] -\ProvidesPackage{sourcesanspro}[2012/11/04 v1.02 Adobe's Source Sans Pro typeface] -% -\RequirePackage{ifxetex,ifluatex} +\ProvidesPackage{sourcesanspro}[2012/12/24 v2.0 Adobe's Source Sans Pro typeface] + +\RequirePackage{ifxetex,ifluatex,xkeyval,textcomp} + +% Switches +\newif\ifsourcesanspro@otf +\newif\ifsourcesanspro@default +\newif\ifsourcesanspro@oldstyle +\newif\ifsourcesanspro@tabular +\newif\ifsourcesanspro@black +\newif\ifsourcesanspro@semibold +\newif\ifsourcesanspro@light +\newif\ifsourcesanspro@extralight + +% Scaling command +\newcommand*{\SourceSansPro@scale}{1} + +% Use OpenType fonts for XeTeX and LuaTeX. \ifxetex - \edef\sourcesanspro@pack{otf} + \sourcesanspro@otftrue \else \ifluatex - \edef\sourcesanspro@pack{otf} + \sourcesanspro@otftrue + \fi +\fi + +\DeclareOptionX{lining} {\sourcesanspro@oldstylefalse} +\DeclareOptionX{nf} {\sourcesanspro@oldstylefalse} +\DeclareOptionX{lf} {\sourcesanspro@oldstylefalse} +\DeclareOptionX{oldstyle} {\sourcesanspro@oldstyletrue} +\DeclareOptionX{osf} {\sourcesanspro@oldstyletrue} +\DeclareOptionX{tabular} {\sourcesanspro@tabulartrue} +\DeclareOptionX{proportional}{\sourcesanspro@tabularfalse} +\DeclareOptionX{black} {\sourcesanspro@blacktrue \sourcesanspro@semiboldfalse} +\DeclareOptionX{semibold} {\sourcesanspro@blackfalse\sourcesanspro@semiboldtrue} +\DeclareOptionX{bold} {\sourcesanspro@blackfalse\sourcesanspro@semiboldfalse} +\DeclareOptionX{light} {\sourcesanspro@lighttrue \sourcesanspro@extralightfalse} +\DeclareOptionX{extralight} {\sourcesanspro@lightfalse\sourcesanspro@extralighttrue} +\DeclareOptionX{regular} {\sourcesanspro@lightfalse\sourcesanspro@extralightfalse} +\DeclareOptionX{scale} {\renewcommand*{\SourceSansPro@scale}{#1}} +\DeclareOptionX{scaled} {\renewcommand*{\SourceSansPro@scale}{#1}} +\DeclareOptionX{default} {\sourcesanspro@defaulttrue} +\DeclareOptionX{type1} {\sourcesanspro@otffalse} +\DeclareOptionX{t1} {\sourcesanspro@otffalse} +\DeclareOptionX{opentype} {\sourcesanspro@otftrue} +\DeclareOptionX{otf} {\sourcesanspro@otftrue} + +% Default options +\ExecuteOptionsX{lining,proportional,bold,regular} +\ProcessOptionsX\relax + +% Load OpenType files +\ifsourcesanspro@otf + \RequirePackage{fontspec} + + % Oldstyle/Lining + \ifsourcesanspro@oldstyle + \edef\sourcesanspro@figurestyle{OldStyle} + \else + \edef\sourcesanspro@figurestyle{} + \fi + + % Tabular/Proportional + \ifsourcesanspro@tabular + \edef\sourcesanspro@figurealign{Monospaced} \else - \edef\sourcesanspro@pack{type1} + \edef\sourcesanspro@figurealign{Proportional} + \fi + + % Black/Semibold/Bold + \ifsourcesanspro@black + \edef\sourcesanspro@boldstyle{Black} + \else + \ifsourcesanspro@semibold + \edef\sourcesanspro@boldstyle{Semibold} + \else + \edef\sourcesanspro@boldstyle{Bold} + \fi + \fi + + % Light/ExtraLight/Regular + \ifsourcesanspro@light + \edef\sourcesanspro@regstyle{Light} + \else + \ifsourcesanspro@extralight + \edef\sourcesanspro@regstyle{ExtraLight} + \else + \edef\sourcesanspro@regstyle{Regular} + \fi + \fi + + % Shared features + \defaultfontfeatures{ + Ligatures = TeX , + Numbers = {\sourcesanspro@figurealign , \sourcesanspro@figurestyle } , + Scale = \SourceSansPro@scale , + Extension = .otf } + + % Sans serif font + \setsansfont + [ UprightFont = *-\sourcesanspro@regstyle , + ItalicFont = *-\sourcesanspro@regstyle It , + BoldFont = *-\sourcesanspro@boldstyle , + BoldItalicFont = *-\sourcesanspro@boldstyle It] + {SourceSansPro} + + % Font families + % Regular/Bold + \newfontfamily\sourcesanspro + [ UprightFont = *-Regular , + ItalicFont = *-RegularIt , + BoldFont = *-Bold , + BoldItalicFont = *-BoldIt ] + {SourceSansPro} + + % Light/Semibold + \newfontfamily\sourcesansprolight + [ UprightFont = *-Light , + ItalicFont = *-LightIt , + BoldFont = *-Semibold , + BoldItalicFont = *-SemiboldIt ] + {SourceSansPro} + + % ExtraLight/Black + \newfontfamily\sourcesansproextreme + [ UprightFont = *-ExtraLight , + ItalicFont = *-ExtraLightIt , + BoldFont = *-Black , + BoldItalicFont = *-BlackIt ] + {SourceSansPro} + + % Lining figures + \newfontfamily\sourcesansprolf + [ Numbers = \sourcesanspro@figurealign , + UprightFont = *-\sourcesanspro@regstyle , + ItalicFont = *-\sourcesanspro@regstyle It , + BoldFont = *-\sourcesanspro@boldstyle , + BoldItalicFont = *-\sourcesanspro@boldstyle It] + {SourceSansPro} + + % Dont keep all default font features + \defaultfontfeatures{} + +% Load type1 font. +\else + \RequirePackage[OT1,LY1,T1]{fontenc} + + % Oldstyle/Lining + \ifsourcesanspro@oldstyle + \edef\sourcesanspro@figurestyle{OsF} + \else + \edef\sourcesanspro@figurestyle{LF} + \fi + + % Tabular/Proportional + \ifsourcesanspro@tabular + \edef\sourcesanspro@figurealign{T} + \else + \edef\sourcesanspro@figurealign{} + \fi + + % Black/Semibold/Bold + \ifsourcesanspro@black + \renewcommand*{\bfdefault}{k} + \else + \ifsourcesanspro@semibold + \renewcommand*{\bfdefault}{sb} + \else + \renewcommand*{\bfdefault}{b} + \fi + \fi + + % Light/ExtraLight/Regular + \ifsourcesanspro@light + \renewcommand*{\mddefault}{l} + \else + \ifsourcesanspro@extralight + \renewcommand*{\mddefault}{el} + \else + \renewcommand*{\mddefault}{m} + \fi + \fi + + % Sans serif font + \renewcommand* + {\sfdefault} + {SourceSansPro-\sourcesanspro@figurealign\sourcesanspro@figurestyle} + + % If source sans pro is the default font \oldstylenums needs a new definition. + \ifsourcesanspro@default + \renewcommand*\oldstylenums[1]{% + \begingroup + \ifmmode + \mathgroup\symletters #1% + \else + \fontfamily{SourceSansPro-\sourcesanspro@figurealign OsF}\selectfont #1% + \fi + \endgroup + } \fi \fi -% -\DeclareOption*{ - \PassOptionsToPackage{\CurrentOption}{sourcesanspro-\sourcesanspro@pack}% -} -\ProcessOptions\relax -% -\RequirePackage{sourcesanspro-\sourcesanspro@pack} + +% Set default font family +\ifsourcesanspro@default + \let\familydefault\sfdefault +\fi + \endinput
\ No newline at end of file |