Sky Watch

Typescripts Rearranged

今天好好看了一下 ConTeXt 的新文档 co-fonts,然后把平时常用的字体都写成 typescript 放到 texmf-local 里。这样以后写作业就不会出现字体定义比文档内容还长的情况了-_-...

首先定义几个 feature sets

:::TeX
\definefontfeature[latin-smallcaps][smallcaps][script=latn]
\definefontfeature
  [fancy]
  [language=dflt, script=latn, method=node, pnum=yes, onum=no,
    kern=yes, liga=yes, dlig=no, zero=no, tlig=yes, trep=yes,
    protrusion=quality, expansion=quality, mapping=tex-text]

然后定义单个字体的 typescript

:::TeX
\starttypescript[myCaslon]
  \definefontsynonym[proserif][name:ACaslonPro-Regular]
  \definefontsynonym[proserifit][name:ACaslonPro-Italic]
  \definefontsynonym[proserifbf][name:ACaslonPro-Bold]
  \definefontsynonym[proserifbi][name:ACaslonPro-BoldItalic]
  \definefontsynonym[Serif][proserif][features=fancy]
  \definefontsynonym[SerifItalic][proserifit][features=fancy]
  \definefontsynonym[SerifBold][proserifbf][features=fancy]
  \definefontsynonym[SerifBoldItalic][proserifbi][features=fancy]
  \definefontsynonym[SerifCaps][Serif][features=latin-smallcaps]
\stoptypescript

\starttypescript[myPalatino]
  \definefontsynonym[palarm][name:PalatinoLTStd-Roman]
  \definefontsynonym[palait][name:PalatinoLTStd-Italic]
  \definefontsynonym[palabf][name:PalatinoLTStd-Bold]
  \definefontsynonym[palabi][name:PalatinoLTStd-BoldItalic]
  \definefontsynonym[Serif][palarm][features=fancy]
  \definefontsynonym[SerifItalic][palait][features=fancy]
  \definefontsynonym[SerifBold][palabf][features=fancy]
  \definefontsynonym[SerifBoldItalic][palabi][features=fancy]
  \definefontsynonym[SerifCaps][Serif][features=latin-smallcaps]
\stoptypescript

\starttypescript[myOptima]
  \definefontsynonym[prosans][name:OptimaLTStd]
  \definefontsynonym[prosansit][name:OptimaLTStd-Italic]
  \definefontsynonym[prosansbf][name:OptimaLTStd-Bold]
  \definefontsynonym[prosansbi][name:OptimaLTStd-BoldItalic]
  \definefontsynonym[Sans][prosans][features=fancy]
  \definefontsynonym[SansItalic][prosansit][features=fancy]
  \definefontsynonym[SansBold][prosansbf][features=fancy]
  \definefontsynonym[SansBoldItalic][prosansbi][features=fancy]
  \definefontsynonym[SansCaps][Sans][features=latin-smallcaps]
\stoptypescript

\starttypescript[myFutura]
  \definefontsynonym[prosans][name:FuturaStd-Medium]
  \definefontsynonym[prosansit][name:FuturaStd-MediumOblique]
  \definefontsynonym[prosansbf][name:FuturaStd-Bold]
  \definefontsynonym[prosansbi][name:FuturaStd-BoldOblique]
  \definefontsynonym[Sans][prosans][features=fancy]
  \definefontsynonym[SansItalic][prosansit][features=fancy]
  \definefontsynonym[SansBold][prosansbf][features=fancy]
  \definefontsynonym[SansBoldItalic][prosansbi][features=fancy]
  \definefontsynonym[SansCaps][Sans][features=latin-smallcaps]
\stoptypescript

\starttypescript[myMyriad]
  \definefontsynonym[prosans][name:MyriadPro-Regular]
  \definefontsynonym[prosansit][name:MyriadPro-It]
  \definefontsynonym[prosansbf][name:MyriadPro-Bold]
  \definefontsynonym[prosansbi][name:MyriadPro-BoldIt]
  \definefontsynonym[Sans][prosans][features=fancy]
  \definefontsynonym[SansItalic][prosansit][features=fancy]
  \definefontsynonym[SansBold][prosansbf][features=fancy]
  \definefontsynonym[SansBoldItalic][prosansbi][features=fancy]
  % No smallcaps
%  \definefontsynonym[SansCaps][Sans][features=latin-smallcaps]
\stoptypescript

\starttypescript[myMonaco]
  \definefontsynonym[promono][name:Monaco_Linux]
  \definefontsynonym[Mono][promono][features=default]
\stoptypescript

ConTeXt Minimals 自带的 px-math 也定义一个

:::TeX
% The internal px-math
\starttypescript[myPxMath]
  \loadfontgoodies[px-math]
  \definefontsynonym[MathRoman][pxmath@px-math]
\stoptypescript

最后写几个常用组合

:::TeX
\starttypescript[PalatinoOptima]
  \usetypescript[myPalatino]
  \usetypescript[myOptima]
  \usetypescript[myMonaco]
  \usetypescript[myPxMath]
  \definetypeface[PalatinoOptima][rm][serif][myPalatino][default]
  \definetypeface[PalatinoOptima][ss][sans][myOptima][default]
  \definetypeface[PalatinoOptima][tt][mono][myMonaco][default][rscale=0.8]
  \definetypeface[PalatinoOptima][mm][math][myPxMath][default]
\stoptypescript

\starttypescript[PalatinoMyriad]
  \usetypescript[myPalatino]
  \usetypescript[myMyriad]
  \usetypescript[myMonaco]
  \usetypescript[myPxMath]
  \definetypeface[PalatinoMyriad][rm][serif][myPalatino][default]
  \definetypeface[PalatinoMyriad][ss][sans][myMyriad][default]
  \definetypeface[PalatinoMyriad][tt][mono][myMonaco][default][rscale=0.8]
  \definetypeface[PalatinoMyriad][mm][math][myPxMath][default]
\stoptypescript

\starttypescript[CaslonMyriad]
  \usetypescript[myCaslon]
  \usetypescript[myMyriad]
  \usetypescript[myMonaco]
  \usetypescript[myPxMath]
  \definetypeface[CaslonMyriad][rm][serif][myCaslon][default]
  \definetypeface[CaslonMyriad][ss][sans][myMyriad][default]
  \definetypeface[CaslonMyriad][tt][mono][myMonaco][default][rscale=0.8]
\stoptypescript

把这些写成一个文件扔到 textmf-local/tex/context/base 里,然后 luatools --generate; context --make。测试:

:::TeX
\input type-mine
\usetypescript[PalatinoOptima]
\setupbodyfont[PalatinoOptima, roman, 12pt]

\setuppapersize[B5][B5]
\setupinterlinespace[line=1.4em]

\starttext
Serif test 1234567890.  {\ss Sans test}.  {\tt Typewriter test.}

{\it Serif test 1234567890.  {\ss Sans test}.}

{\bf Serif test 1234567890.  {\ss Sans test}.}

$M_{ath} \times t^{est} = 1234567890.$ \placeformula
\startformula
  \widetilde{G}(\vec k, \omega) = \int_{-\infty}^{+\infty} e^{i(\vec
    k\cdot \vec x - \omega t)} G(\vec x, t)\, {\rm d}^3 \vec x\, {\rm d}t
\stopformula
\stoptext

效果如图

Palatino + Optima Caslon + Myriad
PalatinoCaslon