Font model in ConTeXt – quick view from a starter

There are three basic fonts in Chinese, Song, Hei and Fangsong, corresponding to Serif, Sans and Monospace in Latin characters. Another category is numbers, it is recognized as a separate category by ConTeXt.
Using Adobe’s three fonts as a example, we can define type-myfonts.tex, a typescript file:

\starttypescript [sans][zhfont]
\starttypescript [mono][zhfont]

Explanation by line:
“\starttypescript[serif][zhfont]” means starting a typescript profile, named “serif” and classify it in “zhfont”;
“\definefontsynonym[Serif][name:adobesongstd]” means start a font synonym definition, and assign “Serif” to “adobesongstd”;
“\stoptypescript” means finishing a profile.
We need to pay some attention at the last profile, that is to say “\definetypeface[myfonts][rm][serif][zhfont]”, we define the typeface series “myfonts” in this profile, and this line represent the “rm”, roman, face is assigned to serif, which we have defined in previous profiles, and “ss” fo “sans”, “tt” for “teletype” or rather “monospace” as we know.
Then write another file, save as test.tex:

\ss 所有动物都生而平等,但有些动物比其他动物更平等
\tt 所有动物都生而平等,但有些动物比其他动物更平等

For explanation, “\usetypescriptfile[type-myfonts]” tell the TeX engine to find a typescript file named type-myfonts.tex in the same directory as current file, and include the contents here; \usetypescript[myfonts]” tell it we are using “myfonts” typescript set as defined in type-myfonts.tex; “\setupbodyfont[myfonts,rm,12pt]” is telling that set the body font to myfonts’s rm style, with 12pt as the size.
Between “\starttext”…”\stoptext” is the text, first line using default font, \rm, and second line change to \ss finaly \tt.
Here is a list to tell font model:
Font model from ConTeXt wiki
Next we need to make ConTeXt know how to wrap lines for Chinese, that is, to break a long sentence into lines in a page. What we need to do is add “\setscript[hanzi]” to the header. Another example of test.tex:



Leave a Reply

Your email address will not be published. Required fields are marked *

This work by Aron Xu is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported.