diff options
Diffstat (limited to 'Master/texmf-dist/tex/latex/sourcecodepro/sourcecodepro.sty')
-rw-r--r-- | Master/texmf-dist/tex/latex/sourcecodepro/sourcecodepro.sty | 206 |
1 files changed, 189 insertions, 17 deletions
diff --git a/Master/texmf-dist/tex/latex/sourcecodepro/sourcecodepro.sty b/Master/texmf-dist/tex/latex/sourcecodepro/sourcecodepro.sty index 1e06940f2ef..69e28811aa9 100644 --- a/Master/texmf-dist/tex/latex/sourcecodepro/sourcecodepro.sty +++ b/Master/texmf-dist/tex/latex/sourcecodepro/sourcecodepro.sty @@ -1,29 +1,201 @@ -% Source Code Pro for LaTeX -% +% 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{sourcecodepro}[2012/11/04 v1.02 Adobe's Source Code Pro typeface] -% -\RequirePackage{ifxetex,ifluatex} +\ProvidesPackage{sourcecodepro}[2012/12/24 v2.0 Adobe's Source Code Pro typeface] + +\RequirePackage{ifxetex,ifluatex,xkeyval,textcomp} + +% Switches +\newif\ifsourcecodepro@otf +\newif\ifsourcecodepro@default +\newif\ifsourcecodepro@oldstyle +\newif\ifsourcecodepro@black +\newif\ifsourcecodepro@semibold +\newif\ifsourcecodepro@light +\newif\ifsourcecodepro@extralight + +% Scaling command +\newcommand*{\sourcecodepro@scale}{1} + +% Use OpenType fonts for XeTeX and LuaTeX. \ifxetex - \edef\sourcecodepro@pack{otf} + \sourcecodepro@otftrue \else \ifluatex - \edef\sourcecodepro@pack{otf} + \sourcecodepro@otftrue + \fi +\fi + +\DeclareOptionX{lining} {\sourcecodepro@oldstylefalse} +\DeclareOptionX{nf} {\sourcecodepro@oldstylefalse} +\DeclareOptionX{lf} {\sourcecodepro@oldstylefalse} +\DeclareOptionX{oldstyle} {\sourcecodepro@oldstyletrue} +\DeclareOptionX{osf} {\sourcecodepro@oldstyletrue} +\DeclareOptionX{black} {\sourcecodepro@blacktrue \sourcecodepro@semiboldfalse} +\DeclareOptionX{semibold} {\sourcecodepro@blackfalse\sourcecodepro@semiboldtrue} +\DeclareOptionX{bold} {\sourcecodepro@blackfalse\sourcecodepro@semiboldfalse} +\DeclareOptionX{light} {\sourcecodepro@lighttrue \sourcecodepro@extralightfalse} +\DeclareOptionX{extralight} {\sourcecodepro@lightfalse\sourcecodepro@extralighttrue} +\DeclareOptionX{regular} {\sourcecodepro@lightfalse\sourcecodepro@extralightfalse} +\DeclareOptionX{scale} {\renewcommand*{\sourcecodepro@scale}{#1}} +\DeclareOptionX{scaled} {\renewcommand*{\sourcecodepro@scale}{#1}} +\DeclareOptionX{default} {\sourcecodepro@defaulttrue} +\DeclareOptionX{type1} {\sourcecodepro@otffalse} +\DeclareOptionX{t1} {\sourcecodepro@otffalse} +\DeclareOptionX{opentype} {\sourcecodepro@otftrue} +\DeclareOptionX{otf} {\sourcecodepro@otftrue} + +% Default options +\ExecuteOptionsX{lining,bold,regular} +\ProcessOptionsX\relax + +% Load OpenType files +\ifsourcecodepro@otf + \RequirePackage{fontspec} + + % Oldstyle/Lining + \ifsourcecodepro@oldstyle + \edef\sourcecodepro@figurestyle{OldStyle} + \else + \edef\sourcecodepro@figurestyle{} + \fi + + % Black/Semibold/Bold + \ifsourcecodepro@black + \edef\sourcecodepro@boldstyle{Black} + \else + \ifsourcecodepro@semibold + \edef\sourcecodepro@boldstyle{Semibold} + \else + \edef\sourcecodepro@boldstyle{Bold} + \fi + \fi + + % Light/ExtraLight/Regular + \ifsourcecodepro@light + \edef\sourcecodepro@regstyle{Light} \else - \edef\sourcecodepro@pack{type1} + \ifsourcecodepro@extralight + \edef\sourcecodepro@regstyle{ExtraLight} + \else + \edef\sourcecodepro@regstyle{Regular} + \fi + \fi + + % Shared features + \defaultfontfeatures{ + Ligatures = TeX , + Numbers = \sourcecodepro@figurestyle , + Scale = \sourcecodepro@scale , + Extension = .otf } + + % Sans serif font + \setmonofont + [ UprightFont = *-\sourcecodepro@regstyle , + ItalicFont = *-\sourcecodepro@regstyle , + BoldFont = *-\sourcecodepro@boldstyle , + BoldItalicFont = *-\sourcecodepro@boldstyle ] + {SourceCodePro} + + % Font families + % Regular/Bold + \newfontfamily\sourcecodepro + [ UprightFont = *-Regular , + ItalicFont = *-Regular , + BoldFont = *-Bold , + BoldItalicFont = *-Bold ] + {SourceCodePro} + + % Light/Semibold + \newfontfamily\sourcecodeprolight + [ UprightFont = *-Light , + ItalicFont = *-Light , + BoldFont = *-Semibold , + BoldItalicFont = *-Semibold ] + {SourceCodePro} + + % ExtraLight/Black + \newfontfamily\sourcecodeproextreme + [ UprightFont = *-ExtraLight , + ItalicFont = *-ExtraLight , + BoldFont = *-Black , + BoldItalicFont = *-Black ] + {SourceCodePro} + + % Lining figures + \newfontfamily\sourcecodeprolf + [ Numbers = , + UprightFont = *-\sourcecodepro@regstyle , + ItalicFont = *-\sourcecodepro@regstyle , + BoldFont = *-\sourcecodepro@boldstyle , + BoldItalicFont = *-\sourcecodepro@boldstyle ] + {SourceCodePro} + + % Dont keep all default font features + \defaultfontfeatures{} + +% Load type1 font. +\else + \RequirePackage[OT1,LY1,T1]{fontenc} + + % Oldstyle/Lining + \ifsourcecodepro@oldstyle + \edef\sourcecodepro@figurestyle{OsF} + \else + \edef\sourcecodepro@figurestyle{LF} + \fi + + % Black/Semibold/Bold + \ifsourcecodepro@black + \renewcommand*{\bfdefault}{k} + \else + \ifsourcecodepro@semibold + \renewcommand*{\bfdefault}{sb} + \else + \renewcommand*{\bfdefault}{b} + \fi + \fi + + % Light/ExtraLight/Regular + \ifsourcecodepro@light + \renewcommand*{\mddefault}{l} + \else + \ifsourcecodepro@extralight + \renewcommand*{\mddefault}{el} + \else + \renewcommand*{\mddefault}{m} + \fi + \fi + + % Sans serif font + \renewcommand* + {\sfdefault} + {SourceCodePro-T\sourcecodepro@figurestyle} + + % If source sans pro is the default font \oldstylenums needs a new definition. + \ifsourcecodepro@default + \renewcommand*\oldstylenums[1]{% + \begingroup + \ifmmode + \mathgroup\symletters #1% + \else + \fontfamily{SourceCodePro-TOsF}\selectfont #1% + \fi + \endgroup + } \fi \fi -% -\DeclareOption*{ - \PassOptionsToPackage{\CurrentOption}{sourcecodepro-\sourcecodepro@pack}% -} -\ProcessOptions\relax -% -\RequirePackage{sourcecodepro-\sourcecodepro@pack} + +% Set default font family +\ifsourcecodepro@default + \let\familydefault\sfdefault +\fi + \endinput
\ No newline at end of file |