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[serif][zhfont] \definefontsynonym[Serif][name:adobesongstd] \definefontsynonym[SerifBold][name:adobesongstd] \definefontsynonym[SerifItalic][name:adobesongstd] \definefontsynonym[SerifBoldItalic][name:adobesongstd] \stoptypescript \starttypescript [sans][zhfont] \definefontsynonym[Sans][name:adobeheitistd] \definefontsynonym[SansBold][name:adobeheitistd] \definefontsynonym[SansItalic][name:adobeheitistd] \definefontsynonym[SansBoldItalic][name:adobeheitistd] \stoptypescript \starttypescript [mono][zhfont] \definefontsynonym[Mono][name:adobefangsongstd] \definefontsynonym[MonoBold][name:adobefangsongstd] \definefontsynonym[MonoItalic][name:adobefangsongstd] \definefontsynonym[MonoBoldItalic][name:adobefangsongstd] \stoptypescript \starttypescript[myfonts] \definetypeface[myfonts][rm][serif][zhfont] \definetypeface[myfonts][ss][sans][zhfont] \definetypeface[myfonts][tt][mono][zhfont] \stoptypescript |
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:
\usetypescriptfile[type-myfonts] \usetypescript[myfonts] \setupbodyfont[myfonts,rm,12pt] \starttext 所有动物都生而平等,但有些动物比其他动物更平等 \ss 所有动物都生而平等,但有些动物比其他动物更平等 \tt 所有动物都生而平等,但有些动物比其他动物更平等 \stoptext |
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:
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:
\usetypescriptfile[type-myfonts] \usetypescript[myfonts] \setupbodyfont[myfonts,rm,12pt] \setscript[hanzi] \starttext 明亡后,朝鲜和日本认为中国已亡,日本从此蔑称中国为“支那”。明治维新后,自认为华夏正统的日本曾打着“攘夷主义”的旗号发动甲午战争等对清战争。 \stoptext |