blob: ce91f7ab9af94f2c960f32843d90b086e98a04e3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
|
%D \module
%D [ file=t-zhspacing,
%D version=2009.05.11,
%D title=\CONTEXT\ User Module,
%D subtitle=Zh-Spacing,
%D author=Yue Wang,
%D date=\currentdate,
%D copyright=Yue Wang
%D email=yuleopen@gmail.com,
%D license=BSD]
\writestatus{loading}{Context User Module / Zh-Spacing}
\unprotect
%D Macro package \type{zhspacing} was written by Yin Dian in order to
%D typeset Simplified Chinese in \XeTeX. The macro package uses \XeTeX's
%D inter-char token mechanism in order to support the basic Chinese
%D typesetting rules. This macro aims to port \type{zhspacing} to Hans
%D Hagen's \ConTeXt\ format.
%D \ConTeXt\ MKII does not load unicode-letters.tex automatically
%D when the format is dumped. What's worse, standard \ConTeXt\
%D distribution does not have unicode-letters.tex included.
%D So in order to define all the default \XeTeX\ character classes
%D as in plain \TeX\ and \LaTeX, we striped the related macros
%D from unicode-letters.tex to \type{zhspacing-unicode}.
\def\ID #1 #2 {\set{#1}{#2}{\global\XeTeXcharclass\n=1 \global\catcode\n=11 }}
\countdef\n=255
\def\set#1#2#3{\n="#1 \loop #3 \ifnum\n<"#2 \advance\n by 1 \repeat}
\def\loop#1\repeat{\def\body{#1}\iterate}
\def\iterate{\body \let\next\iterate \else\let\next\relax\fi \next}
\let\repeat=\fi \ID 3400 4DB5 \ID 4E00 9FC3 \ID 20000 2A6D6
%D \ConTeXt\ does not have the right catcode for zhspacing.sty defined.
%D So we should define the catcode correctly in order to load it.
\catcode`\!=12
\catcode`\@=11
\catcode`\?=12
%D zhspacing uses \TeX\ commands \type{\lq} and \type{\rq} in plain TeX.
%D However, these are not defined in \ConTeXt. So we define the two macros.
\def\lq{`} \def\rq{'}
%D And now we can load \type{zhspacing.sty} safely.
\input zhspacing.sty
%D Last thing: we define the typescript for Adobe Chinese fonts.
\starttypescript [serif] [myzhfont]
\definefontsynonym [Serif] [ZhSerif]
\definefontsynonym [SerifBold] [ZhSerifBold]
\definefontsynonym [SerifItalic] [ZhSerifItalic]
\definefontsynonym [SerifBoldItalic] [ZhSerifBoldItalic]
\stoptypescript
\starttypescript [serif] [myzhfont]
\definefontsynonym [ZhSerif] [name:AdobeSongStd-Light]
\definefontsynonym [ZhSerifBold] [name:AdobeHeitiStd-Regular]
\definefontsynonym [ZhSerifItalic] [name:AdobeKaitiStd-Regular]
\definefontsynonym [ZhSerifBoldItalic] [name:AdobeHeitiStd-Regular]
\stoptypescript
\starttypescript [sans] [myzhfont]
\definefontsynonym [Sans] [ZhSans]
\definefontsynonym [SansBold] [ZhSansBold]
\definefontsynonym [SansItalic] [ZhSansItalic]
\definefontsynonym [SansBoldItalic] [ZhSansBoldItalic]
\stoptypescript
\starttypescript [sans] [myzhfont]
\definefontsynonym [ZhSans] [name:AdobeKaitiStd-Regular]
\definefontsynonym [ZhSansBold] [name:AdobeHeitiStd-Regular]
\definefontsynonym [ZhSansItalic] [name:AdobeKaitiStd-Regular]
\definefontsynonym [ZhSansBoldItalic] [name:AdobeHeitiStd-Regular]
\stoptypescript
\starttypescript [mono] [myzhfont]
\definefontsynonym [Mono] [ZhMono]
\definefontsynonym [MonoBold] [ZhMonoBold]
\definefontsynonym [MonoItalic] [ZhMonoItalic]
\definefontsynonym [MonoBoldItalic] [ZhMonoBoldItalic]
\stoptypescript
\starttypescript [mono] [myzhfont]
\definefontsynonym [ZhMono] [name:AdobeFangsongStd-Regular]
\definefontsynonym [ZhMonoBold] [name:AdobeHeitiStd-Regular]
\definefontsynonym [ZhMonoItalic] [name:AdobeFangsongStd-Regular]
\definefontsynonym [ZhMonoBoldItalic] [name:AdobeHeitiStd-Regular]
\stoptypescript
\starttypescript[myzhfont]
\definetypeface [myzhfont] [rm] [serif] [myzhfont] [default]
\definetypeface [myzhfont] [ss] [sans] [myzhfont] [default]
\definetypeface [myzhfont] [tt] [mono] [myzhfont] [default]
\stoptypescript
\usetypescript[myzhfont]
%D We set all the \type{zhxxxfont} used in \type{zhspacing.sty}.
\zhspacing
\def\zhongwen{\pushcurrentfont\myzhfont\popcurrentfont}
\def\zhfont{\zhongwen}
\def\zhpunctfont{\zhongwen}
\def\zhcjkextafont{\zhongwen}
\def\zhcjkextbfont{\zhongwen}
\protect
|