该arev
软件包提供了 BitStream Vera Sans 字体的扩展版本,但没有scaled
选项。
该bera
包使用beraserif
,berasans
并beramono
带有scaled
选项(通过t1fve.fd
,t1fvm.fd
和t1fvs.fd
)。
如何向arev
套餐中添加缩放选项?
或者如何创建一个arev
具有缩放选项的新虚拟字体(源自包)?
答案1
以下示例实现了一个包arevtext2
,它与现有的包类似arevtext
,但添加了选项scaled
。此外,字体系列名称以2
:fav2
而不是为后缀fav
,以避免与现有arev
文件发生名称冲突。
%%% 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
然后,作为示例t1fav2.fd
实现,fvm2.fd
留给读者作为练习。
%%% 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.tex %%%
\documentclass{article}
\usepackage[scaled=1.5]{arevtext2}
\begin{document}
\noindent
Hello World! (scaled)\\
{\fontfamily{fav}\selectfont Hello World! (unscaled)}
\end{document}