summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/context/base/font-chi.tex
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/context/base/font-chi.tex')
-rw-r--r--Master/texmf-dist/tex/context/base/font-chi.tex231
1 files changed, 114 insertions, 117 deletions
diff --git a/Master/texmf-dist/tex/context/base/font-chi.tex b/Master/texmf-dist/tex/context/base/font-chi.tex
index 7a602d4ab83..cf30470d7e5 100644
--- a/Master/texmf-dist/tex/context/base/font-chi.tex
+++ b/Master/texmf-dist/tex/context/base/font-chi.tex
@@ -12,8 +12,16 @@
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.
+\ifx\handlechineseunicodeglyph\undefined \else \endinput \fi
+
% NOT YET ADAPTED TO THE NEW FONT MACROS
+%D The first implementation (most of which is here) is based on
+%D the specific font layout. This is because not all glyphs are
+%D available in uniciode, which means that we cannot use
+%D unicode codepoints (yet); if it were possible we could use
+%D just one table per input encoding.
+
\writestatus{loading}{Context Font Macros / Chinese}
% much will to typo-chi.tex
@@ -36,7 +44,6 @@
%M \def\WangLei{\purechinese{\uchar{205}{245}\uchar{192}{218}}}
\useencoding[chi]
-\loadmapfile[gbk]
%D When \WangLei\ sent me a mail asking if \CONTEXT\ was able
%D to support Chinese, I wasn't sure if the answer could be
@@ -106,11 +113,13 @@
%D There are a few variables, that can be (re|)|set
%D depending on the current font. They default to:
+% hm, why don't we use the normal unicodestrut mechanism?
+
\def\chineseunicodescale {1.00} % not smaller than .85
\def\chineseunicodeheight {1.00}
\def\chineseunicodedepth {1.00}
-\def\chineseinterglyphskip{0pt plus .05em minus .01em}
-\def\chinesesurroundskip {.25em plus .15em minus .05em}
+\def\chineseinterglyphskip{0pt \!!plus .05em \!!minus .01em}
+\def\chinesesurroundskip {.25em \!!plus .15em \!!minus .05em}
%D We define a few signals. As said, another example of
%D using signals can be found in the module \type {m-units}.
@@ -154,90 +163,30 @@
\horizontalchineseunicodeglyph
\fi\fi}
-% This is a previous, very encoding specific, attempt. The
-% current implementation is more versatile.
-%
-% \starttypen
-% \def\chineseleftglyph {\chardef\chineseSstatus=1 }
-% \def\chineserightglyph {\chardef\chineseSstatus=2 }
-% \def\chinesecenterglyph {\chardef\chineseSstatus=3 }
-%
-% \def\analyzechineseunicodeglyph%
-% {% left
-% \ifnum\unicodeposition=161174 \chineseleftglyph \else
-% \ifnum\unicodeposition=161176 \chineseleftglyph \else
-% \ifnum\unicodeposition=161178 \chineseleftglyph \else
-% \ifnum\unicodeposition=161180 \chineseleftglyph \else
-% \ifnum\unicodeposition=161182 \chineseleftglyph \else
-% \ifnum\unicodeposition=161184 \chineseleftglyph \else
-% \ifnum\unicodeposition=161186 \chineseleftglyph \else
-% \ifnum\unicodeposition=161188 \chineseleftglyph \else
-% \ifnum\unicodeposition=161190 \chineseleftglyph \else
-% \ifnum\unicodeposition=163168 \chineseleftglyph \else
-% \ifnum\unicodeposition=163219 \chineseleftglyph \else
-% \ifnum\unicodeposition=163224 \chineseleftglyph \else
-% \ifnum\unicodeposition=163251 \chineseleftglyph \else
-% % right
-% \ifnum\unicodeposition=161162 \chineserightglyph \else
-% \ifnum\unicodeposition=161163 \chineserightglyph \else
-% \ifnum\unicodeposition=161175 \chineserightglyph \else
-% \ifnum\unicodeposition=161177 \chineserightglyph \else
-% \ifnum\unicodeposition=161179 \chineserightglyph \else
-% \ifnum\unicodeposition=161181 \chineserightglyph \else
-% \ifnum\unicodeposition=161183 \chineserightglyph \else
-% \ifnum\unicodeposition=161185 \chineserightglyph \else
-% \ifnum\unicodeposition=161187 \chineserightglyph \else
-% \ifnum\unicodeposition=161189 \chineserightglyph \else
-% \ifnum\unicodeposition=161191 \chineserightglyph \else
-% \ifnum\unicodeposition=161227 \chineserightglyph \else
-% \ifnum\unicodeposition=161228 \chineserightglyph \else
-% \ifnum\unicodeposition=161229 \chineserightglyph \else
-% \ifnum\unicodeposition=163161 \chineserightglyph \else
-% \ifnum\unicodeposition=163162 \chineserightglyph \else
-% \ifnum\unicodeposition=163167 \chineserightglyph \else
-% \ifnum\unicodeposition=163169 \chineserightglyph \else
-% \ifnum\unicodeposition=163172 \chineserightglyph \else
-% \ifnum\unicodeposition=163174 \chineserightglyph \else
-% \ifnum\unicodeposition=163186 \chineserightglyph \else
-% \ifnum\unicodeposition=163187 \chineserightglyph \else
-% \ifnum\unicodeposition=163191 \chineserightglyph \else
-% \ifnum\unicodeposition=163221 \chineserightglyph \else
-% \ifnum\unicodeposition=163253 \chineserightglyph \else
-% % center
-% \ifnum\unicodeposition=161164 \chinesecenterglyph \else
-% \ifnum\unicodeposition=161167 \chinesecenterglyph \else
-% \ifnum\unicodeposition=161173 \chinesecenterglyph \else
-% \ifnum\unicodeposition=163190 \chinesecenterglyph \else
-% % unknown
-% \chardef\chineseSstatus=0
-% \fi\fi\fi\fi\fi \fi\fi\fi\fi\fi \fi\fi\fi\fi\fi \fi\fi\fi\fi\fi \fi
-% \fi\fi\fi\fi\fi \fi\fi\fi\fi\fi \fi\fi\fi\fi\fi \fi\fi\fi\fi\fi \fi}
-% \stoptypen
-%
% chinese classes: left=1|right=2|center=3
\chardef\plusfour=4
\def\analyzechineseunicodeglyph % beware, no zerocount !
- {\chardef\chineseSstatus0\getvalue{uc\the\unicodeposition}\relax}
+ {\chardef\chineseSstatus0\getvalue{uc\number\unicodeposition}\relax}
\def\analyzechineseunicodeenviroment
{% left
- \ifx (\nextglyph \chardef\chineseAstatus\plusone \else
- \ifx [\nextglyph \chardef\chineseAstatus\plusone \else
+ \ifx (\nextutoken \chardef\chineseAstatus\plusone \else
+ \ifx [\nextutoken \chardef\chineseAstatus\plusone \else
% right
- \ifx ,\nextglyph \chardef\chineseAstatus\plustwo \else
- \ifx .\nextglyph \chardef\chineseAstatus\plustwo \else
- \ifx ?\nextglyph \chardef\chineseAstatus\plustwo \else
- \ifx ;\nextglyph \chardef\chineseAstatus\plustwo \else
- \ifx :\nextglyph \chardef\chineseAstatus\plustwo \else
- \ifx !\nextglyph \chardef\chineseAstatus\plustwo \else
- \ifx )\nextglyph \chardef\chineseAstatus\plustwo \else
- \ifx ]\nextglyph \chardef\chineseAstatus\plustwo \else
+ \ifx ,\nextutoken \chardef\chineseAstatus\plustwo \else
+ \ifx .\nextutoken \chardef\chineseAstatus\plustwo \else
+ \ifx ?\nextutoken \chardef\chineseAstatus\plustwo \else
+ \ifx ;\nextutoken \chardef\chineseAstatus\plustwo \else
+ \ifx :\nextutoken \chardef\chineseAstatus\plustwo \else
+ \ifx !\nextutoken \chardef\chineseAstatus\plustwo \else
+ \ifx )\nextutoken \chardef\chineseAstatus\plustwo \else
+ \ifx ]\nextutoken \chardef\chineseAstatus\plustwo \else
% space
- \ifx\nextglyph\blankspace \chardef\chineseAstatus\plusthree \else
- \ifx\nextglyph\space \chardef\chineseAstatus\plusthree \else
- \chardef\chineseAstatus\zerocount
+ \ifx\nextutoken\blankspace \chardef\chineseAstatus\plusthree \else
+ \ifx\nextutoken\space \chardef\chineseAstatus\plusthree \else
+ \chardef\chineseAstatus\zerocount
% unknown
\fi\fi\fi\fi\fi \fi\fi\fi\fi\fi \fi\fi
% maybe save the last skip?
@@ -264,14 +213,16 @@
\def\horizontalchineseunicodeglyph
{\relax
\ifhmode\else\dontleavehmode\fi % added
- \setunicodescale\chineseunicodescale
- \setunicodestrut\chineseunicodeheight\chineseunicodedepth
+ \setunicodescale\chineseunicodescale % redundant
+ \setunicodestrut\chineseunicodeheight\chineseunicodedepth % redundant
\ifprocessingverbatim
\iftracechinese
\ruledhbox{\insertunicodeglyph}%
\else
\insertunicodeglyph
\fi
+ \else\ifx\nextutoken\relax
+ \insertunicodeglyph
\else
\analyzechineseunicodeglyph
\analyzechineseunicodeenviroment
@@ -338,7 +289,7 @@
\insertchineseglyph
\hskip\chineseinterglyphskip
\hskip\chineseRsignal
- \fi
+ \fi\fi
\aftergroup\ignorespaces % watch this
\fi}
@@ -347,32 +298,40 @@
\ifprocessingverbatim % to do
\horizontalchineseunicodeglyph
\else
- \setunicodescale\chineseunicodescale
- \setunicodestrut\chineseunicodeheight\chineseunicodedepth
- \analyzechineseunicodeglyph
- \setbox\scratchbox\hbox to \hsize
- {\hss
- \ifcase\chineseSstatus\relax
- \insertchineseglyph
- \else % left / right
- \setbox\scratchbox\hbox{\insertchineseglyph}%
- \rotate[\c!rotation=270]{\box\scratchbox}%
- \fi
- \hss}%
- \ht\scratchbox\unicodeheight\strutht
- \dp\scratchbox\unicodedepth \strutdp
- \ifvmode % catches \hbox{...}, actually \hbox should be \vbox -)
- \nointerlineskip
- \fi
- \ifcase\prevchineseSstatus\relax
- \ifnum\chineseSstatus=\plustwo \par\nobreak\else\allowbreak\fi
- \or % left
- \par\nobreak
- \or % right
- \ifnum\chineseSstatus=\plustwo \par\nobreak\else\allowbreak\fi
+ \setunicodescale\chineseunicodescale % redundant
+ \setunicodestrut\chineseunicodeheight\chineseunicodedepth % redundant
+ \ifx\nextutoken\relax
+ \insertchineseglyph
+ \ifvmode % catches \hbox{...}, actually \hbox should be \vbox -)
+ \nointerlineskip
+ \fi
+ \allowbreak
+ \else
+ \analyzechineseunicodeglyph
+ \setbox\scratchbox\hbox to \hsize
+ {\hss
+ \ifcase\chineseSstatus\relax
+ \insertchineseglyph
+ \else % left / right
+ \setbox\scratchbox\hbox{\insertchineseglyph}%
+ \rotate[\c!rotation=270]{\box\scratchbox}%
+ \fi
+ \hss}%
+ \ht\scratchbox\unicodeheight\strutht
+ \dp\scratchbox\unicodedepth \strutdp
+ \ifvmode % catches \hbox{...}, actually \hbox should be \vbox -)
+ \nointerlineskip
+ \fi
+ \ifcase\prevchineseSstatus\relax
+ \ifnum\chineseSstatus=\plustwo \par\nobreak\else\allowbreak\fi
+ \or % left
+ \par\nobreak
+ \or % right
+ \ifnum\chineseSstatus=\plustwo \par\nobreak\else\allowbreak\fi
+ \fi
+ \global\chardef\prevchineseSstatus\chineseSstatus % pagebody ...
+ \box\scratchbox\par
\fi
- \global\chardef\prevchineseSstatus\chineseSstatus % pagebody ...
- \box\scratchbox\par
\aftergroup\ignorespaces % watch this
\fi}
@@ -536,7 +495,7 @@
\stopdummy}
\def\tracedchineseglyph
- {\leavevmode
+ {\dontleavehmode
\ruledhbox
{\setbox\scratchbox\hbox{\insertunicodeglyph}%
\hbox to \wd\scratchbox
@@ -893,12 +852,14 @@
\setupunicodefont
[chinese]
- [ \c!scale=\chineseunicodescale,
- \c!height=\chineseunicodeheight,
- \c!depth=\chineseunicodedepth,
- \c!conversion=\chinesenumber,
- \c!commands=\setchineseencoding, % needed for digits
- \c!command=\handlechineseunicodeglyph]
+ [ \c!scale=\chineseunicodescale,
+ \c!height=\chineseunicodeheight,
+ \c!depth=\chineseunicodedepth,
+ \c!strut=\v!yes,
+ \c!interlinespace=\v!yes,
+ \c!conversion=\chinesenumber,
+ \c!commands=\setchineseencoding, % needed for digits
+ \c!command=\handlechineseunicodeglyph]
%D For the moment, this encoding is implemented rather ugly. The
%D trick is to move the encoding value from the current font
@@ -918,12 +879,12 @@
%D \defineunicodefont
%D [SimChi]
%D [SimplifiedChinese]
-%D [ \c!scale=\chineseunicodescale,
-%D \c!height=\chineseunicodeheight,
-%D \c!depth=\chineseunicodedepth,
+%D [\c!scale=\chineseunicodescale,
+%D \c!height=\chineseunicodeheight,
+%D \c!depth=\chineseunicodedepth,
%D \c!conversion=\chinesenumber,
%D \c!commands=\setchineseencoding, % needed for digits
-%D \c!command=\handlechineseunicodeglyph]
+%D \c!command=\handlechineseunicodeglyph]
%D \stoptyping
%D
%D However, the former definitions is more general. Next we
@@ -943,6 +904,42 @@
\definefontsynonym [TraditionalChineseBoldSlanted] [b5heisl] [encoding=big5]
\definefontsynonym [TraditionalChineseBoldItalic] [b5heisl] [encoding=big5]
+% we need to move this to typescripts
+
+\doifelse \currentregime {utf} {
+
+ \definefontsynonym [SimplifiedChineseRegular] [ChineseRegular]
+ \definefontsynonym [SimplifiedChineseSlanted] [ChineseSlanted]
+ \definefontsynonym [SimplifiedChineseItalic] [ChineseItalic]
+ \definefontsynonym [SimplifiedChineseBold] [ChineseBold]
+ \definefontsynonym [SimplifiedChineseBoldSlanted] [ChineseBoldSlanted]
+ \definefontsynonym [SimplifiedChineseBoldItalic] [ChineseBoldItalic]
+
+ \definefontsynonym [TraditionalChineseRegular] [ChineseRegular]
+ \definefontsynonym [TraditionalChineseSlanted] [ChineseSlanted]
+ \definefontsynonym [TraditionalChineseItalic] [ChineseItalic]
+ \definefontsynonym [TraditionalChineseBold] [ChineseBold]
+ \definefontsynonym [TraditionalChineseBoldSlanted][ChineseBoldSlanted]
+ \definefontsynonym [TraditionalChineseBoldItalic] [ChineseBoldItalic]
+
+ \definefontsynonym [ChineseRegular] [uni-htsong-][encoding=cjk-uni]
+ \definefontsynonym [ChineseSlanted] [uni-htsong-][encoding=cjk-uni]
+ \definefontsynonym [ChineseItalic] [uni-htsong-][encoding=cjk-uni]
+ \definefontsynonym [ChineseBold] [uni-hthei-] [encoding=cjk-uni]
+ \definefontsynonym [ChineseBoldSlanted][uni-hthei-] [encoding=cjk-uni]
+ \definefontsynonym [ChineseBoldItalic] [uni-hthei-] [encoding=cjk-uni]
+
+ \loadmapfile[uni-htsong.map]
+ \loadmapfile[uni-htfs.map]
+ \loadmapfile[uni-hthei.map]
+ \loadmapfile[uni-htkai.map]
+
+} {
+
+ \loadmapfile[gbk]
+
+}
+
\defineunicodefont [SimChi] [SimplifiedChinese] [chinese]
\defineunicodefont [TraChi] [TraditionalChinese] [chinese]
@@ -1143,7 +1140,7 @@
%D \stopnarrower
%D This package is written in the city of Hasselt, a pretty
-%D small town in the |<|compare to China real small|>|
+%D small town in the |<|compared to China real small|>|
%D Netherlands. Like most dutch cities, even this small one
%D has a chinese restaurant, run by chinese, speaking chinese,
%D and |<|indeed|>| writing chinese. Eating there will never