diff options
author | Karl Berry <karl@freefriends.org> | 2016-02-12 00:19:25 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2016-02-12 00:19:25 +0000 |
commit | 16f02bbc1863609a1fa114bc9272d6a2a6f2e047 (patch) | |
tree | f03209d8a26c52d3a65fd9840d0d021b7c6a6b9a /Master/texmf-dist/tex/xetex | |
parent | d8d0b5b21e8eb9b4970633451dc1e57192d5ab71 (diff) |
zhspacing (11feb16)
git-svn-id: svn://tug.org/texlive/trunk@39670 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/xetex')
-rw-r--r-- | Master/texmf-dist/tex/xetex/zhspacing/context/t-zhspacing.tex | 117 | ||||
-rw-r--r-- | Master/texmf-dist/tex/xetex/zhspacing/zhfont.sty (renamed from Master/texmf-dist/tex/xetex/zhspacing/latex/zhfont.sty) | 0 | ||||
-rw-r--r-- | Master/texmf-dist/tex/xetex/zhspacing/zhmath.sty (renamed from Master/texmf-dist/tex/xetex/zhspacing/generic/zhmath.sty) | 35 | ||||
-rw-r--r-- | Master/texmf-dist/tex/xetex/zhspacing/zhsmyclass.sty (renamed from Master/texmf-dist/tex/xetex/zhspacing/generic/zhsmyclass.sty) | 11 | ||||
-rw-r--r-- | Master/texmf-dist/tex/xetex/zhspacing/zhspacing.sty (renamed from Master/texmf-dist/tex/xetex/zhspacing/generic/zhspacing.sty) | 100 | ||||
-rw-r--r-- | Master/texmf-dist/tex/xetex/zhspacing/zhsusefulmacros.sty (renamed from Master/texmf-dist/tex/xetex/zhspacing/generic/zhsusefulmacros.sty) | 1 | ||||
-rw-r--r-- | Master/texmf-dist/tex/xetex/zhspacing/zhulem.sty (renamed from Master/texmf-dist/tex/xetex/zhspacing/latex/zhulem.sty) | 0 |
7 files changed, 96 insertions, 168 deletions
diff --git a/Master/texmf-dist/tex/xetex/zhspacing/context/t-zhspacing.tex b/Master/texmf-dist/tex/xetex/zhspacing/context/t-zhspacing.tex deleted file mode 100644 index ce91f7ab9af..00000000000 --- a/Master/texmf-dist/tex/xetex/zhspacing/context/t-zhspacing.tex +++ /dev/null @@ -1,117 +0,0 @@ -%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
\ No newline at end of file diff --git a/Master/texmf-dist/tex/xetex/zhspacing/latex/zhfont.sty b/Master/texmf-dist/tex/xetex/zhspacing/zhfont.sty index cc3f98d382b..cc3f98d382b 100644 --- a/Master/texmf-dist/tex/xetex/zhspacing/latex/zhfont.sty +++ b/Master/texmf-dist/tex/xetex/zhspacing/zhfont.sty diff --git a/Master/texmf-dist/tex/xetex/zhspacing/generic/zhmath.sty b/Master/texmf-dist/tex/xetex/zhspacing/zhmath.sty index 88e69f60d7f..80a090dd84e 100644 --- a/Master/texmf-dist/tex/xetex/zhspacing/generic/zhmath.sty +++ b/Master/texmf-dist/tex/xetex/zhspacing/zhmath.sty @@ -11,11 +11,12 @@ % Changed \hbox to \mbox. Changed default option to % noactive. % 071215 Removed \XeTeXinterchartokenstate=0, as the XeTeX bug -% is fixed by JK. Changed \mathcjksizec/d to fit the +% is fixed by JK. Changed \mathcjksizec/d to fit the % main text size. -% 071229 Added \XeTeXinterchartokenstate=0 again, because not +% 071229 Added \XeTeXinterchartokenstate=0 again, because not % everyone has the latest version of XeTeX. Added custom % and nocustom options. +% 2016/02/10 Improved \@setzhmathfonts. \catcode`\@=11 \ifx\zhmath@defined\@undefined \def\zhmath@defined{\relax} @@ -74,7 +75,7 @@ \def\zhmath@zhfont@text#1{{\mbox{\XeTeXinterchartokenstate=0\zhmathfont\mathcjksizeb\char#1\relax}}} \def\zhmath@zhfont@scrp#1{{\mbox{\XeTeXinterchartokenstate=0\zhmathfont\mathcjksizec\char#1\relax}}} \def\zhmath@zhfont@subs#1{{\mbox{\XeTeXinterchartokenstate=0\zhmathfont\mathcjksized\char#1\relax}}} - + \zhmath@setactivemathchar{"2E80}{"9FFF}{\zhmath@zhfont@disp}% {\zhmath@zhfont@text}{\zhmath@zhfont@scrp}{\zhmath@zhfont@subs} @@ -124,15 +125,27 @@ \newfam\zhmath@letterfam \newfam\zhmath@numberfam -\def\@setzhmathfonts#1#2{% - \edef\zhmath@font{\fontname#1 }% - \font\zhmath@tenfont=\zhmath@font at 10pt - \font\zhmath@sevenfont=\zhmath@font at 7pt - \font\zhmath@fivefont=\zhmath@font at 5pt\relax - \textfont#2=\zhmath@tenfont - \scriptfont#2=\zhmath@sevenfont - \scriptscriptfont#2=\zhmath@fivefont +\begingroup + \catcode`\A=12 % + \catcode`\P=12 % + \catcode`\T=12 % +\lowercase{\endgroup + \def\@setzhmathfonts#1#2{% + \expandafter\@setzhmathfonts@auxi\fontname#1 AT PT\relax#2} + \def\@setzhmathfonts@auxi #1 AT #2PT#3\relax#4{% + \ifx\relax#2\relax + \@setzhmathfonts@auxii#4{#1}{10pt}% + \else + \@setzhmathfonts@auxii#4{#1}{#2pt}% + \fi}% } +\def\@setzhmathfonts@auxii#1#2#3{% + \font\zhmath@textfont=#2 at #3 \relax + \font\zhmath@scriptfont=#2 at .7\dimexpr#3\relax\relax + \font\zhmath@scriptscriptfont=#2 at .5\dimexpr#3\relax\relax + \textfont#1=\zhmath@textfont + \scriptfont#1=\zhmath@scriptfont + \scriptscriptfont#1=\zhmath@scriptscriptfont} \def\setzhmathfont#1{\@setzhmathfonts{#1}\zhmath@fam} \setzhmathfont\zhmathfont diff --git a/Master/texmf-dist/tex/xetex/zhspacing/generic/zhsmyclass.sty b/Master/texmf-dist/tex/xetex/zhspacing/zhsmyclass.sty index 3f336c54e42..4633ee10596 100644 --- a/Master/texmf-dist/tex/xetex/zhspacing/generic/zhsmyclass.sty +++ b/Master/texmf-dist/tex/xetex/zhspacing/zhsmyclass.sty @@ -34,10 +34,10 @@ \else \@newinterclasstoks{#2}{\@@class}% \@newinterclasstoks{\@@class}{#2}% - %\setinterclasstoks{#2}{\@@class}{\getinterclasstoks{#1}{\@@class}}% - %\setinterclasstoks{\@@class}{#2}{\getinterclasstoks{\@@class}{#1}}% - \copyinterclasstoks{#2}{\@@class}{#1}{\@@class}% - \copyinterclasstoks{\@@class}{#2}{\@@class}{#1}% + %\setinterclasstoks{#2}{\@@class}{\getinterclasstoks{#1}{\@@class}}% + %\setinterclasstoks{\@@class}{#2}{\getinterclasstoks{\@@class}{#1}}% + \copyinterclasstoks{#2}{\@@class}{#1}{\@@class}% + \copyinterclasstoks{\@@class}{#2}{\@@class}{#1}% \fi }% end for \@newinterclasstoks{#2}{#2}% @@ -69,7 +69,7 @@ \@ifundefined{@@baseclass@#1}{\def#2{}}{\edef#2{\csname @@baseclass@#1\endcsname}}% } \def\@newinterclasstoks#1#2{% - \expandafter\newtoks\csname @@interclasstoks@#1@#2\endcsname + \csname newtoks\expandafter\endcsname\csname @@interclasstoks@#1@#2\endcsname \csname @@interclasstoks@#1@#2\endcsname={}%\meaning #1, \meaning #2}% %%\expandafter\gdef\csname @@interclasstoks@#1@#2\endcsname{}% } @@ -149,4 +149,3 @@ }% }% } - diff --git a/Master/texmf-dist/tex/xetex/zhspacing/generic/zhspacing.sty b/Master/texmf-dist/tex/xetex/zhspacing/zhspacing.sty index 7202dbcf494..71eb6aac262 100644 --- a/Master/texmf-dist/tex/xetex/zhspacing/generic/zhspacing.sty +++ b/Master/texmf-dist/tex/xetex/zhspacing/zhspacing.sty @@ -18,14 +18,14 @@ % Obsoleted the use of \enfont. % 070822 Fixed bug of unbalanced group when using ulem? Cleared % XeTeX's pre-defined inter-char tokens. Use seperate -% font for punctuations. -% Deprecated the use of begin/end-groups in LaTeX, in +% font for punctuations. +% Deprecated the use of begin/end-groups in LaTeX, in % order to work properly with ulem. Coded zhulem.sty. % 070823 Use more flexible way to save font. Changed space % ignoring mechanism after hanzi to allow \skipenzh added % between hanzi and boundary if the next non-space token % is a char and is not fullwidth nor in PUA. -% 070824 Enabled automatic skip between math formulas and CJK +% 070824 Enabled automatic skip between math formulas and CJK % chars. Changed skip schemes. Added \zhspacingrevision. % 071008 Fixed bug of missing \skipzh when hanzi next to space. % Found bug of \zhs@skipspaces --- \iffalse error. @@ -35,8 +35,8 @@ % 071014 Found bug introduced by the last bug fix, which breaks % the punctuation prohibitions. (Fixed on 071020) % 071015 Fixed bug of not changing punctuation font after space. -% 071019 Fixed the \iffalse bug. Use \the\XeTeXcharclass -% instead of ifcjkchar. +% 071019 Fixed the \iffalse bug. Use \the\XeTeXcharclass +% instead of ifcjkchar. % Defined token patterns to simplify settings, haha. % 071020 Added ability to deal with space seperated characters. % Added XeTeX existence test. More intelligent parindent @@ -60,7 +60,7 @@ % 071229 Added a few punctuation classification settings. % Refined code. Added active hanzi hook. Removed some % debug code for compiling speed. Not thoroughly tested. -% 071231 Use \zhs@@a to reduce memory usage. Removed +% 071231 Use \zhs@@a to reduce memory usage. Removed % \zhs@active@alphabound because it's not effective. % Use \lastnodetype and \spacefactor to determine whether % or not to insert \skipenzh. Added a few punctuation @@ -69,10 +69,13 @@ % Use hex number to represent hanzi. Added \zhs@font. % Added ambiwide and ambinarrow options. Made active % hanzi protected. -% 090720 Rename usefulmacros.sty and myclass.sty to -% zhsusefulmacros.sty and zhsmyclass.sty. -% 2012/03/14 Fix bug for Plain format. -% Note: 1. Catcode test requires letter 'a' to be in category 11, and '!' +% 090720 Rename usefulmacros.sty and myclass.sty to +% zhsusefulmacros.sty and zhsmyclass.sty. +% 2012/03/14 Fix bug for Plain format. +% 2016/02/20 Compatible with LaTeX2e 2016/02/01. +% 2016/02/10 The boundary class is changed from 255 to 4095 +% since XeTeX 0.99994. +% Note: 1. Catcode test requires letter 'a' to be in category 11, and '!' % to be in category 12. So don't change the default catcodes. % 2. To speed up processing long Chinese documents, set \skipzh to % empty and \XeTeXinterchartoks 1 1={}. This can save 1/4 time. @@ -86,7 +89,7 @@ \errmessage{XeTeX 0.997 or above required to use zhspacing}% \fi \ifx\zhspacingrevision\@undefined -\def\zhspacingrevision{2012/03/14} +\def\zhspacingrevision{2016/02/10} \input zhsusefulmacros.sty \newif\ifzhs@ambiwide \zhs@ambiwidetrue @@ -321,7 +324,13 @@ \input zhsmyclass.sty % three base classes: boundary, halfwidth and fullwidth \newclass{boundary} -\setclassnum{boundary}{255} + +\ifnum\strcmp{\number\XeTeXversion\XeTeXrevision}{0.99993} > 0 % + \chardef\zhs@boundaryclassnum = 4095 % +\else + \chardef\zhs@boundaryclassnum = 255 % +\fi +\setclassnum{boundary}{\zhs@boundaryclassnum} \newclass{halfwidth} \newclass{fullwidth} \setinterclasstoks{boundary}{fullwidth}{\mydbgmessage{^^JZ}\zhs@savefont\zhfont} @@ -552,11 +561,7 @@ \setinterclasstoks{cjkexta}{cjkextb}{\zhcjkextbfont\skipzh\relax} \setinterclasstoks{cjkextb}{cjkexta}{\zhcjkextafont\skipzh\relax} \setinterclasstoks{cjkextb}{cjkextb}{\skipzh\relax} -{ -\newcount\n -\n="3400 \loop \ifnum\n<"4E00 \global\XeTeXcharclass\n=8 \advance\n by 1\repeat -\n="20000\loop \ifnum\n<"30000 \global\XeTeXcharclass\n=9 \advance\n by 1\repeat -} + % long fullwidth punctuations \newclass[fwpunct]{longpunct} % … etc \setclassnum{longpunct}{5} @@ -777,7 +782,52 @@ \fi } +\def\zhs@loadxetexclasses{% + \chardef\XeTeXcharclassID = 1 % + \chardef\XeTeXcharclassOP = 2 % + \chardef\XeTeXcharclassCL = 3 % + \chardef\XeTeXcharclassEX = 3 % + \chardef\XeTeXcharclassIS = 3 % + \chardef\XeTeXcharclassNS = 3 % + \chardef\XeTeXcharclassCM = \numexpr \zhs@boundaryclassnum + 1 \relax + \input load-unicode-xetex-classes % +} + \def\zhspacing{% + \ifnum\XeTeXcharclass"4E00 = 1 % + % clear XeTeX pre-defined toks + \XeTeXinterchartoks 0 1 = {} + \XeTeXinterchartoks 0 2 = {} + \XeTeXinterchartoks 0 3 = {} + \XeTeXinterchartoks 1 0 = {} + \XeTeXinterchartoks 2 0 = {} + \XeTeXinterchartoks 3 0 = {} + \XeTeXinterchartoks 1 1 = {} + \XeTeXinterchartoks 1 2 = {} + \XeTeXinterchartoks 1 3 = {} + \XeTeXinterchartoks 2 1 = {} + \XeTeXinterchartoks 2 2 = {} + \XeTeXinterchartoks 2 3 = {} + \XeTeXinterchartoks 3 1 = {} + \XeTeXinterchartoks 3 2 = {} + \XeTeXinterchartoks 3 3 = {} + \else + \expandafter\zhs@loadxetexclasses % + \fi + \zhs@tmpcnt "3400 % + \chardef\zhs@tmpnum = \getclassnum{cjkexta}% + \loop + \ifnum\zhs@tmpcnt < "4E00 % + \XeTeXcharclass\zhs@tmpcnt = \zhs@tmpnum + \advance\zhs@tmpcnt by 1 % + \repeat + \zhs@tmpcnt "20000 % + \chardef\zhs@tmpnum = \getclassnum{cjkextb}% + \loop + \ifnum\zhs@tmpcnt < "30000 % + \XeTeXcharclass\zhs@tmpcnt = \zhs@tmpnum + \advance\zhs@tmpcnt by 1 % + \repeat \@for\zhs@char:={`:,`,,`、}\do{\XeTeXcharclass\zhs@char=4} \@for\zhs@char:={`。,`.,`;}\do{\XeTeXcharclass\zhs@char=10} \ifzhs@ambiwide @@ -789,22 +839,6 @@ \fi \@for\zhs@char:={`\!,`\",`\',`\(,`\),`\,,`\-,`\.,`\:,`\;,`\<,`\>,`\?,`\[,`\],`\`,`\{,`\},`\\,`\/}\do{\XeTeXcharclass\zhs@char=6} \@for\zhs@char:={`℃,`·,`$,`%}\do{\XeTeXcharclass\zhs@char=7} - % clear XeTeX pre-defined toks - \XeTeXinterchartoks 0 1 = {} - \XeTeXinterchartoks 0 2 = {} - \XeTeXinterchartoks 0 3 = {} - \XeTeXinterchartoks 1 0 = {} - \XeTeXinterchartoks 2 0 = {} - \XeTeXinterchartoks 3 0 = {} - \XeTeXinterchartoks 1 1 = {} - \XeTeXinterchartoks 1 2 = {} - \XeTeXinterchartoks 1 3 = {} - \XeTeXinterchartoks 2 1 = {} - \XeTeXinterchartoks 2 2 = {} - \XeTeXinterchartoks 2 3 = {} - \XeTeXinterchartoks 3 1 = {} - \XeTeXinterchartoks 3 2 = {} - \XeTeXinterchartoks 3 3 = {} \registerXeTeXclasstoks \XeTeXinterchartokenstate=1\relax \ifLaTeX@e diff --git a/Master/texmf-dist/tex/xetex/zhspacing/generic/zhsusefulmacros.sty b/Master/texmf-dist/tex/xetex/zhspacing/zhsusefulmacros.sty index d42a3efcf6f..d6c5fec5b8a 100644 --- a/Master/texmf-dist/tex/xetex/zhspacing/generic/zhsusefulmacros.sty +++ b/Master/texmf-dist/tex/xetex/zhspacing/zhsusefulmacros.sty @@ -10,7 +10,6 @@ \def\@usefulmacros@LaTeX@e{LaTeX2e} \def\ifLaTeX@e{\ifx\fmtname\@usefulmacros@LaTeX@e} \ifLaTeX@e\else -\def\newtoks{\alloc@5\toks\toksdef\@cclvi} \def\@nnil{\@nil}% \def\@empty{}% \def\@fornoop#1\@@#2#3{}% diff --git a/Master/texmf-dist/tex/xetex/zhspacing/latex/zhulem.sty b/Master/texmf-dist/tex/xetex/zhspacing/zhulem.sty index 86365e380ab..86365e380ab 100644 --- a/Master/texmf-dist/tex/xetex/zhspacing/latex/zhulem.sty +++ b/Master/texmf-dist/tex/xetex/zhspacing/zhulem.sty |