Am 23.04.2013 um 04:05 schrieb Tim Li <timli2...@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 uses
the upright Pagella font, this happens because no font was set for this style 
in the typescripts
and a default font is used.

You prevent this unwanted result by adding additional \definefontsynonym lines 
to the
typescript 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 bolditalic
styles for your font even more fallback definitions are needed. The complete
typescript 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 
slanted
to italic mappings) you can predefined lists in type-fbk.mkiv which you can load
at the begin at your typescript to save a few lines and we can abbreviate the 
above
typescript 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@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
___________________________________________________________________________________

Reply via email to