summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/xelatex
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2016-05-15 15:30:11 +0000
committerKarl Berry <karl@freefriends.org>2016-05-15 15:30:11 +0000
commit4ea9595c9cb9aab0a87e4fec643b0268c77bdd09 (patch)
tree2218c5dbd2c930b1a5c8178836e85449c894ca0c /Master/texmf-dist/tex/xelatex
parent71b584cd9c5233528247cb6f0bc261c086609372 (diff)
zhspacing from.tds.zip
git-svn-id: svn://tug.org/texlive/trunk@41145 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/xelatex')
-rw-r--r--Master/texmf-dist/tex/xelatex/zhspacing/zhfont.sty140
-rw-r--r--Master/texmf-dist/tex/xelatex/zhspacing/zhulem.sty18
2 files changed, 158 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/xelatex/zhspacing/zhfont.sty b/Master/texmf-dist/tex/xelatex/zhspacing/zhfont.sty
new file mode 100644
index 00000000000..cc3f98d382b
--- /dev/null
+++ b/Master/texmf-dist/tex/xelatex/zhspacing/zhfont.sty
@@ -0,0 +1,140 @@
+% zhfont.sty coded by YIN Dian
+% Simplify setting various font effects
+% Hist: 071204 First coded.
+% 071210 Improved. Added \newfontfamilywithslant and
+% \newfontfamilywithslantandbold to simplify setting.
+% 071211 Added fake bold support.
+% 071231 Added underdot support.
+% 080102 Minor changes on underdot. Don's use \scantokens.
+% Fixed bug of \zhfont in ulem. Added font family
+% selection and fake bold support in active hanzi.
+\NeedsTeXFormat{LaTeX2e}[1996/12/01]
+\def\filedate{2008/01/02}
+\ProvidesPackage{zhfont}[\filedate]
+\RequirePackage{zhspacing}
+\RequirePackage{zhulem}
+\newif\ifzhfont@fakebold
+\zhfont@fakeboldfalse
+\DeclareOption{fakebold}{\zhfont@fakeboldtrue}
+\ProcessOptions\relax
+
+\def\zhs@tmpmacro{}
+\def\zhs@curr@fam{-1}
+
+\zhnfsssavefont
+\g@addto@macro\zhs@savefont{%
+ \long\edef\zhs@tmpmacro{\f@family}%
+ \def\zhs@curr@fam{0}%
+ \ifx\zhs@tmpmacro\sfdefault
+ \def\zhs@curr@fam{1}%
+ \else\ifx\zhs@tmpmacro\ttdefault
+ \def\zhs@curr@fam{2}%
+ \fi\fi
+ \edef\zhs@tmpmacro{\f@family}%
+ \ifx\zhs@tmpmacro\sfdefault
+ \def\zhs@curr@fam{1}%
+ \else\ifx\zhs@tmpmacro\ttdefault
+ \def\zhs@curr@fam{2}%
+ \fi\fi
+}
+\ifzhfont@fakebold
+\def\zhfont@bx{bx}
+\g@addto@macro\zhs@savefont{%
+ \ifx\f@series\zhfont@bx
+ \special{pdf: literal direct q 0.3 w 2 Tr}%
+ \fi
+}
+\g@addto@macro\zhs@restorefont{%
+ \ifx\f@series\zhfont@bx
+ \special{pdf: literal direct 0 Tr}%
+ \fi
+}
+\fi
+
+\def\newfontfamilywithslant#1#2{%
+ \newfontfamily#1[ItalicFont=#2,ItalicFeatures={RawFeature={slant=0.17}},BoldItalicFont=#2,BoldItalicFeatures={RawFeature={slant=0.17}}]{#2}%
+}
+\def\newfontfamilywithslantandbold#1#2#3{%
+ \newfontfamily#1[BoldFont=#3,ItalicFont=#2,ItalicFeatures={RawFeature={slant=0.17}},BoldItalicFont=#3,BoldItalicFeatures={RawFeature={slant=0.17}}]{#2}%
+}
+
+\ifzhfont@fakebold
+ \newfontfamilywithslant\zhrmfont{SimSun}
+ \newfontfamilywithslant\zhsffont{SimHei}
+ \newfontfamilywithslant\zhttfont{[simfang.ttf]}
+\else
+ \newfontfamilywithslantandbold\zhrmfont{SimSun}{SimHei}
+ \newfontfamilywithslant\zhsffont{SimHei}
+ \newfontfamilywithslantandbold\zhttfont{[simfang.ttf]}{[simkai.ttf]}
+\fi
+\def\zhfont{\ifcase\zhs@curr@fam\zhrmfont\or\zhsffont\or\zhttfont\else\zhrmfont\fi}
+
+\def\setzhmainfont{\newfontfamily\zhrmfont}
+\def\setzhsansfont{\newfontfamily\zhsffont}
+\def\setzhmonofont{\newfontfamily\zhttfont}
+
+\enableactivehanzi
+\def\zhhanzihook#1{%
+ % select family
+ \long\edef\zhs@tmpmacro{\f@family}%
+ \def\zhs@curr@fam{0}%
+ \ifx\zhs@tmpmacro\sfdefault
+ \def\zhs@curr@fam{1}%
+ \else\ifx\zhs@tmpmacro\ttdefault
+ \def\zhs@curr@fam{2}%
+ \fi\fi
+ \edef\zhs@tmpmacro{\f@family}%
+ \ifx\zhs@tmpmacro\sfdefault
+ \def\zhs@curr@fam{1}%
+ \else\ifx\zhs@tmpmacro\ttdefault
+ \def\zhs@curr@fam{2}%
+ \fi\fi
+ \ifzhfont@fakebold\ifx\f@series\zhfont@bx
+ \special{pdf: literal direct q 0.3 w 2 Tr}%
+ \fi\fi
+ {\XeTeXinterchartokenstate=0\zhs@font #1}%
+ \ifzhfont@fakebold\ifx\f@series\zhfont@bx
+ \special{pdf: literal direct 0 Tr}%
+ \fi\fi
+}
+
+\def\underdot@dot{\XeTeXinterchartokenstate=0\zhpunctfont \vbox to 0.5em{\vss\hbox{ยท}\vss}}
+%\def\underdot@dot{\vbox to 0.5em{\vss\hbox{\bf .}\vss}}
+\newskip\underdot@skip
+\underdot@skip=2.5pt
+\def\underdot{%
+ \begingroup
+ \makehanziglobalactive
+ \def\zhhanzihook##1{%
+ \setbox0=\hbox{\underdot@dot}%
+ \leavevmode\vtop{\baselineskip=\underdot@skip\lineskiplimit=-\maxdimen
+ \advance\baselineskip\ht0
+ % select family
+ \long\edef\zhs@tmpmacro{\f@family}%
+ \def\zhs@curr@fam{0}%
+ \ifx\zhs@tmpmacro\sfdefault
+ \def\zhs@curr@fam{1}%
+ \else\ifx\zhs@tmpmacro\ttdefault
+ \def\zhs@curr@fam{2}%
+ \fi\fi
+ \edef\zhs@tmpmacro{\f@family}%
+ \ifx\zhs@tmpmacro\sfdefault
+ \def\zhs@curr@fam{1}%
+ \else\ifx\zhs@tmpmacro\ttdefault
+ \def\zhs@curr@fam{2}%
+ \fi\fi
+ \ialign{####\cr\XeTeXinterchartokenstate=0\zhs@font
+ \ifzhfont@fakebold\ifx\f@series\zhfont@bx
+ \special{pdf: literal direct q 0.3 w 2 Tr}##1%
+ \special{pdf: literal direct 0 Tr}\else ##1\fi\else ##1\fi
+ \cr\hidewidth\box0\hidewidth\cr}}%
+ }%
+ \underd@t
+}
+\def\underd@t#1{%
+ #1%
+ \makehanzigloballetter
+ \endgroup
+}
+
+\endinput
diff --git a/Master/texmf-dist/tex/xelatex/zhspacing/zhulem.sty b/Master/texmf-dist/tex/xelatex/zhspacing/zhulem.sty
new file mode 100644
index 00000000000..86365e380ab
--- /dev/null
+++ b/Master/texmf-dist/tex/xelatex/zhspacing/zhulem.sty
@@ -0,0 +1,18 @@
+% zhulem.sty coded by YIN Dian
+% Fix compatibility problem with ulem
+% Hist: 070822 Changed \UL@reskip and \UL@@penalty, able to work.
+\NeedsTeXFormat{LaTeX2e}[1996/12/01]
+\def\fileversion{0.4}
+\def\filedate{2007/08/22}
+\ProvidesPackage{zhulem}[\filedate\space\fileversion]
+\RequirePackage{ulem}[2000/05/26]
+%\let\zhulem@printfont\zhs@printf@nt
+\def\zhulem@printfont#1{}
+\def\UL@reskip{\zhs@savef@nt{tmp}\UL@stop \zhulem@printfont{tmp}\UL@leaders
+ \UL@start\zhs@restoref@nt{tmp}}
+\def\UL@@penalty{\LA@penalty \ifnum\count@=\z@
+ \@ne \else \count@ \fi % zero penalty => no penalty, so use 1 instead.
+ \zhs@savef@nt{tmp}\UL@stop \zhulem@printfont{tmp}\UL@start
+ \zhs@restoref@nt{tmp}}
+
+\endinput