Skip to content

Commit

Permalink
Can choose font by passing option to package, can even toggle inside
Browse files Browse the repository at this point in the history
  • Loading branch information
tzwenn committed May 16, 2011
1 parent eda0052 commit 3d3c38f
Showing 1 changed file with 47 additions and 2 deletions.
49 changes: 47 additions & 2 deletions ubuntu.sty
@@ -1,10 +1,55 @@
\ProvidesPackage{ubuntu}
\RequirePackage{ifpdf}
\RequirePackage{ifthen}

% For PDF map the TrueType fonts
\ifpdf
\pdfmapfile{+ubuntu.map}
\fi

\renewcommand{\encodingdefault}{T1}
\renewcommand{\rmdefault}{ubuntu}
% Options represented by boolean - not nice
% TODO: case by value

\newboolean{ubuntuRegular}
\setboolean{ubuntuRegular}{true}

\newboolean{ubuntuNone}
\setboolean{ubuntuNone}{false}

% Parse options

\DeclareOption*{%
\PackageWarning{ubuntu}{Unknown option ‘\CurrentOption’}%
}

\DeclareOption{none}{%
\setboolean{ubuntuRegular}{false}
\setboolean{ubuntuNone}{true}
}

\DeclareOption{regular}{%
\setboolean{ubuntuRegular}{true}
\setboolean{ubuntuNone}{false}
}
\ProcessOptions\relax

% Commands

\newcommand{\Ubuntu}{%
\renewcommand{\encodingdefault}{T1}%
\renewcommand{\rmdefault}{ubuntu}%
}

\newcommand{\fontubuntu}{%
\usefont{T1}{ubuntu}{m}{n}
}

% Initial font

\ifthenelse{\boolean{ubuntuRegular}}{%
\Ubuntu{} %
}{\ifthenelse{\boolean{ubuntuNone}}{%
}{%
}}

\endinput

0 comments on commit 3d3c38f

Please sign in to comment.