[NTG-context] ``fallback" in Typescript

Tim Li timli2013 at outlook.com
Tue Apr 23 11:06:58 CEST 2013


Wolfgang, many thanks to you, for your comprehensive explaination. After reading your mail, as a ConTeXt user, I think I can apply the `fallback' to my typescript definition well. Tim
 From: schuster.wolfgang at gmail.com
Date: Tue, 23 Apr 2013 09:28:15 +0200
To: ntg-context at ntg.nl
Subject: Re: [NTG-context] ``fallback" in Typescript


Am 23.04.2013 um 04:05 schrieb Tim Li <timli2013 at outlook.com>:Thanks.  I am reading these codes.

That won’t help to understand what’s the meaning of these lines.
To demonstrate what these lines are for a wrote a small example.
\starttypescript[serif][palatino-clone]  \definefontsynonym [Serif]       [file:texgyrepagellaregular] [features=default]  \definefontsynonym [SerifItalic] [file:texgyrepagellaitalic]  [features=default]\stoptypescript
\starttypescript[sans][helvetica-clone]  \definefontsynonym [Sans]       [file:texgyreherosregular] [features=default]  \definefontsynonym [SansItalic] [file:texgyreherositalic]  [features=default]\stoptypescript
\definetypeface[mainface][rm][serif][palatino-clone] [default]\definetypeface[mainface][ss][sans] [helvetica-clone][default]
%\setupbodyfont[modern]\setupbodyfont[mainface]
\starttext
\rm\tf Regular \it Italic \sl Slanted
\ss\tf Regular \it Italic \sl Slanted
\stoptext
When you put the code in a file and process you will notice that “\sl Slanted” always usesthe upright Pagella font, this happens because no font was set for this style in the typescriptsand a default font is used.
You prevent this unwanted result by adding additional \definefontsynonym lines to thetypescript where you say context to use the italic font for the slanted style.
\starttypescript[serif][palatino-clone]  \definefontsynonym [Serif]        [file:texgyrepagellaregular] [features=default]  \definefontsynonym [SerifItalic]  [file:texgyrepagellaitalic]  [features=default]  \definefontsynonym [SerifSlanted] [SerifItalic]\stoptypescript
\starttypescript[sans][helvetica-clone]  \definefontsynonym [Sans]        [file:texgyreherosregular] [features=default]  \definefontsynonym [SansItalic]  [file:texgyreherositalic]  [features=default]  \definefontsynonym [SansSlanted] [SansItalic]\stoptypescript
Still this wouldn’t be enough when you want to use also the bold and bolditalicstyles for your font even more fallback definitions are needed. The completetypescript for the serif font has to look now like this.
\starttypescript[serif][palatino-clone]  \definefontsynonym [Serif]            [file:texgyrepagellaregular] [features=default]  \definefontsynonym [SerifItalic]      [file:texgyrepagellaitalic]  [features=default]  \definefontsynonym [SerifSlanted]     [SerifItalic]  \definefontsynonym [SerifBold]        [Serif]  \definefontsynonym [SerifBoldItalic]  [SerifBold]  \definefontsynonym [SerifBoldSlanted] [SerifBoldItalic]  \definefontsynonym [SerifCaps]        [Serif]\stoptypescript
Because such fallback definitions are needed for many font (especially the slantedto italic mappings) you can predefined lists in type-fbk.mkiv which you can loadat the begin at your typescript to save a few lines and we can abbreviate the abovetypescript in this form.
\starttypescript[serif][palatino-clone]  \setups[font:fallback:serif]  \definefontsynonym [Serif]            [file:texgyrepagellaregular] [features=default]  \definefontsynonym [SerifItalic]      [file:texgyrepagellaitalic]  [features=default]\stoptypescript
Wolfgang
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context at ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________ 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.ntg.nl/pipermail/ntg-context/attachments/20130423/86ff18c6/attachment-0001.html>


More information about the ntg-context mailing list