Changes

Jump to navigation Jump to search
added a more sophisticated version of the same typescript
</texcode>
==The next step: making it more generic==
 
If you'd like to write a typescript that handles many more encodings, somewhat more generically, here is one model to build upon:
<texcode>
% type-sil-gentium.tex
% Typescript for serif family SIL Gentium
 
% This is the first change we need to make: we list all the encodings it can match,
% and then use that data within the typescript:
\starttypescript [map] [ec,texnansi,8r,t5,t2a,t2b,qx]
\loadmapfile [\typescripttwo-sil-gentium.map]
\stoptypescript
 
% We use the same technique. As the encoding variable shows up in the third
% argument, we use \typescriptthree.
% The second argument means that these names are loaded with either the 'gentium'
% or 'gentium-alt' names.
\starttypescript [serif] [gentium,gentium-alt] [ec,texnansi,8r,t5,t2a,t2b,qx]
\definefontsynonym [GentiumAlt-Italic] [\typescriptthree-genai101][encoding=\typescriptthree]
\definefontsynonym [GentiumAlt] [\typescriptthree-genar101][encoding=\typescriptthree]
\definefontsynonym [Gentium-Italic] [\typescriptthree-geni101] [encoding=\typescriptthree]
\definefontsynonym [Gentium] [\typescriptthree-genr101] [encoding=\typescriptthree]
\stoptypescript
 
% We use the new (and fast loading) font fallbacks to cover bold markup.
\starttypescript [serif] [gentium] [name]
\setups [font:fallback:serif]
\definefontsynonym [Serif] [Gentium]
\definefontsynonym [SerifItalic] [Gentium-Italic]
\stoptypescript
 
% The 'gentium-alt' script differs from its brother above in the fonts it points to.
\starttypescript [serif] [gentium-alt] [name]
\setups [font:fallback:serif]
\definefontsynonym [Serif] [GentiumAlt]
\definefontsynonym [SerifItalic] [GentiumAlt-Italic]
\stoptypescript
 
% sample family definition
% here we define only the serif (rm) version.
\starttypescript [sil-gentium] [ec,texnansi,8r,t5,t2a,t2b,qx]
\definetypeface [sil-gentium] [rm] [serif] [gentium] [default] [encoding=\typescripttwo]
% \definetypeface [sil-gentium] [ss] [sans] [default] [default] [encoding=\typescripttwo]
% \definetypeface [sil-gentium] [tt] [mono] [default] [default] [encoding=\typescripttwo]
% \definetypeface [sil-gentium] [mm] [math] [default] [default] [encoding=\typescripttwo]
\stoptypescript
 
% Getting fancy: occasionally you want to access alternates from the main font:
\starttypescript [serif] [gentium] [name]
% unfortunately you need to define eight synonyms to handle the fallback cases:
\definefontsynonym [SerifRegular] [Serif]
\definefontsynonym [SerifRegularAlt] [GentiumAlt]
\definefontsynonym [SerifBoldAlt] [GentiumAlt]
\definefontsynonym [SerifCapsAlt] [GentiumAlt]
\definefontsynonym [SerifItalicAlt] [GentiumAlt-Italic]
\definefontsynonym [SerifSlantedAlt] [GentiumAlt-Italic]
\definefontsynonym [SerifBoldItalicAlt] [GentiumAlt-Italic]
\definefontsynonym [SerifBoldSlantedAlt] [GentiumAlt-Italic]
 
% markup of \Var[alt] results in a (subtle) font switch:
\definefontvariant [Serif] [alt] [Alt]
\stoptypescript
 
</texcode>
==Links==

Navigation menu