The following example implements a package arevtext2
, which is similar to the existing package arevtext
, but adds option scaled
.
Also the font family names are suffixed with 2
: fav2
instead of fav
to avoid name clashes with the existing arev
files.
%%% arevtext2.sty %%%
\NeedsTeXFormat{LaTeX2e}%
\ProvidesPackage{arevtext2}%
[2015/06/09 v0.1 Arev Sans Text package with options]%
\RequirePackage{kvoptions}
\SetupKeyvalOptions{
prefix=arevtext@,
}
\DeclareStringOption[1]{scaled}
% Optionally to accept option "scaled" only as local package option
% and to ignore it as global option.
% \DeclareLocalOptions{scaled}
\ProcessKeyvalOptions*
\RequirePackage[T1]{fontenc}
% Package "arevtext" loads package "textcomp", but
% real support for TS1 encoding is not present (missing ".TFM" files)
\RequirePackage{textcomp} % takes text symbols such as \S, \P, \textdagger
% from the text font
\renewcommand{\rmdefault}{fav2}
\renewcommand{\sfdefault}{fav2}
\renewcommand{\ttdefault}{fvm2}
\endinput
Then, as example, t1fav2.fd
is implemented, fvm2.fd
is left as exercise for the reader.
%%% fvm2.fd %%%
\ProvidesFile{t1fav.fd}
[2015/06/09 Font definitions for T1/fav.]
\begingroup\expandafter\expandafter\expandafter\endgroup
\expandafter\ifx\csname arevtext@scaled\endcsname\relax
\let\arevtext@@scaled\@empty
\else
\edef\arevtext@@scaled{s*[\arevtext@scaled]}%
\fi
\DeclareFontFamily{T1}{fav2}{}
\DeclareFontShape{T1}{fav2}{m}{n}{
<-> \arevtext@@scaled favr8t
}{}
\DeclareFontShape{T1}{fav2}{m}{it}{
<-> \arevtext@@scaled favri8t
}{}
\DeclareFontShape{T1}{fav2}{b}{n}{
<-> \arevtext@@scaled favb8t
}{}
\DeclareFontShape{T1}{fav2}{b}{it}{
<-> \arevtext@@scaled favbi8t
}{}
\DeclareFontShape{T1}{fav2}{m}{sl}{<->ssub * fav/m/it}{}
\DeclareFontShape{T1}{fav2}{bx}{n}{<->ssub * fav/b/n}{}
\DeclareFontShape{T1}{fav2}{bx}{it}{<->ssub * fav/b/it}{}
\DeclareFontShape{T1}{fav2}{b}{sl}{<->ssub * fav/b/it}{}
\DeclareFontShape{T1}{fav2}{bx}{sl}{<->ssub * fav/b/sl}{}
\endinput
Test file:
%%% test.tex %%%
\documentclass{article}
\usepackage[scaled=1.5]{arevtext2}
\begin{document}
\noindent
Hello World! (scaled)\\
{\fontfamily{fav}\selectfont Hello World! (unscaled)}
\end{document}