From 53c4b8c53ed95a842aac0efbedd7dc0a55ffa511 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Sat, 15 Dec 2012 23:30:50 +0000 Subject: new zxjatype (15dec12) git-svn-id: svn://tug.org/texlive/trunk@28541 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/doc/latex/zxjatype/LICENSE | 24 + Master/texmf-dist/doc/latex/zxjatype/README | 84 ++ .../doc/latex/zxjatype/example/example.pdf | Bin 0 -> 143039 bytes .../doc/latex/zxjatype/example/example.tex | 96 ++ .../doc/latex/zxjatype/example/xetexsamp01.pdf | Bin 0 -> 32759 bytes Master/texmf-dist/tex/latex/zxjatype/zxjatype.sty | 1036 ++++++++++++++++++++ Master/tlpkg/bin/tlpkg-ctan-check | 2 +- Master/tlpkg/tlpsrc/collection-langcjk.tlpsrc | 1 + Master/tlpkg/tlpsrc/zxjatype.tlpsrc | 0 9 files changed, 1242 insertions(+), 1 deletion(-) create mode 100644 Master/texmf-dist/doc/latex/zxjatype/LICENSE create mode 100644 Master/texmf-dist/doc/latex/zxjatype/README create mode 100644 Master/texmf-dist/doc/latex/zxjatype/example/example.pdf create mode 100644 Master/texmf-dist/doc/latex/zxjatype/example/example.tex create mode 100644 Master/texmf-dist/doc/latex/zxjatype/example/xetexsamp01.pdf create mode 100644 Master/texmf-dist/tex/latex/zxjatype/zxjatype.sty create mode 100644 Master/tlpkg/tlpsrc/zxjatype.tlpsrc (limited to 'Master') diff --git a/Master/texmf-dist/doc/latex/zxjatype/LICENSE b/Master/texmf-dist/doc/latex/zxjatype/LICENSE new file mode 100644 index 00000000000..5388dbb2a03 --- /dev/null +++ b/Master/texmf-dist/doc/latex/zxjatype/LICENSE @@ -0,0 +1,24 @@ +$BK\%=%U%H%&%'%"$O(B MIT $B%i%$%;%s%9$N2<$GG[I[$5$l$^$9!#Cx:n8"$O:nZ$G$9!#(B + +The MIT License + +Copyright (c) 2009, 2010 ZR + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/Master/texmf-dist/doc/latex/zxjatype/README b/Master/texmf-dist/doc/latex/zxjatype/README new file mode 100644 index 00000000000..75ba3652597 --- /dev/null +++ b/Master/texmf-dist/doc/latex/zxjatype/README @@ -0,0 +1,84 @@ +================================================== +== ZXjatype バンドル v0.6 <2012/09/09> == +== by「ZR」(八登 崇之/Takayuki YATO)== +== == +================================================== +(This file is encoded in UTF-8,) + +■ 対応環境 + + ・XeLaTeX2e(0.9995 版以降) + ・前提パッケージ: + - etoolbox + - xeCJK(CTAN 掲載の版) + ※ zxjatype 0.6 版について、動作が確認されているのは + 2.4.4/2.4.5/3.0.8 版。 + ※ xeCJK 2.x 版と併用した場合、zxjatype 0.5 版と同じ + 動作を行う。 + +■ 本ソフトウェアの作者のサイト + + En toi Pythmeni tes TeXnopoleos ~電脳世界の奥底にて~ + http://zrbabbler.sp.land.to/ + +■ インストール + + TDS 1.1 に従ったシステムでは、各ファイルを次の場所に移動する。 + ・*.sty → $TEXMF/tex/xelatex/zxjatype/ + + W32TeX を C:\usr\local にインストールした場合の例。 + ・*.sty → C:\usr\local\share\texmf-local\tex\xelatex\zxjatype + +-------------------------------------- + zxjatype パッケージ (v0.6) -- 本体 +-------------------------------------- + + まだ解説が書けておりません…。基本的な機能の説明については以下の Web + ページで行っていますのでそちらを参照してください。 + + ZXjatype パッケージ + http://zrbabbler.sp.land.to/zxjatype.html + +---------------------------------------- + +■ 更新履歴 + +Version 0.6 <2012/09/09> + - xeCJK 3.x 版に対応させる。xeCJK 3.x 版用に新たに実装されたコードは + 2.x 版と併用できないので、zxjatype 0.5 版のコードをそのまま残して + xeCJK が 2.x 版の場合はそちらを有効にする。 + - 実装上の制限により、日本語用に特別に調整した句読点スタイル quasijis + の実装を止めた。日本語には、xeCJK で用意された句読点すたいるの + fullwidth を使用する。 + - \setCJK...font 命令でも \setjafontscale の設定が効くようにする、 + すなわち \setja...font 命令の動作と同じにする。 + - \setjafontscale{} (空引数)で和文スケール設定を付加しない設定に切り + 替えられるようにした。 + - \[no]usejafamilyinverbatim 命令を廃止した。 + +Version 0.5 <2012/05/01> + - 「行頭禁則の仮名」+「開き括弧」の間の空きが入らない現象を修正。 + - xeCJK の「大きな」内部マクロに対してパッチを当てる処理を etoolbox + の \patchcmd で行うように変更。 + +Version 0.4 <2010/08/15> + - xeCJK 2.3.10 版/2.3.15 版での動作を確認。 + - 一部の命令の名前を変更。基本的にこのパッケージで提供される命令の名前は + \CJK.. や \xeCJK.. で始まらないようにした。(ただしその結果として、命令 + の出自によって「接頭辞」がまちまちになってしまっている。) + +Version 0.3a <2009/11/18> + +Version 0.3 <2009/11/16> + - \[no]jafamilyinverbatim 追加。 + - \textrawja/\textrawen 追加。 + - rawjatext/rawentext 追加。 + - bxbase の \Ux/\UI のドライバを追加。 + +Version 0.2a <2009/11/01> + - リリース作業のミスで生じたバグを修正。 + +Version 0.2 <2009/10/25> + - 最初の公開版。 + +W# EOF diff --git a/Master/texmf-dist/doc/latex/zxjatype/example/example.pdf b/Master/texmf-dist/doc/latex/zxjatype/example/example.pdf new file mode 100644 index 00000000000..b7db2c22409 Binary files /dev/null and b/Master/texmf-dist/doc/latex/zxjatype/example/example.pdf differ diff --git a/Master/texmf-dist/doc/latex/zxjatype/example/example.tex b/Master/texmf-dist/doc/latex/zxjatype/example/example.tex new file mode 100644 index 00000000000..3101ad53a5e --- /dev/null +++ b/Master/texmf-dist/doc/latex/zxjatype/example/example.tex @@ -0,0 +1,96 @@ +\documentclass[a4paper]{bxjsarticle} +\usepackage[oldxetex]{zxjatype} +\setjamainfont{IPA明朝} +\setjasansfont{IPAゴシック} +\setjamonofont{IPAゴシック} +\usepackage{xltxtra} +% 欧文は既定の LM フォント +\begin{document} +\title{{\XeLaTeX}で日本語する件について} +\author{ZR} +\date{2010年\ 某月\ 某日} +\maketitle + +\section{{\XeTeX}\>の紹介} + +\subsection{{\XeTeX}\>とは} + +{\XeTeX}\>はJonathan Kew氏による\>{\TeX}\>の拡張で符号空間を +Unicode全体(BMP以外も含む)に拡大したものである。 +既存の\>{\TeX}\>のUnicode拡張としてはOmega(Ω) +があるが、{\XeTeX}\>はこれとは別の拡張となっている。% +(なお、Omegaの後継にあたるUnicode拡張\>{\TeX}\>が\>% +{Lua\TeX}\>である。) + +{\XeTeX}\>のもう一つの大きな特徴は、現在の標準的なフォント技術を +内部に取り込んでいることである。 +元々の\>{\TeX}\>が「特定の技術基盤に依存しない」という思想で設計されている +ことはよく知られているが、これはフォント関係の技術についても当てはまり、 +フォントの扱いは\>{\TeX}\>本体(すなわち\>{\TeX}\>ソースをDVI% +ファイルに変換する)ではなくDVIウェア(DVIファイルを扱う +ソフトウェア)が行う。 +このため、{\TeX}\>の機能自体は30年前からほとんど変わっていないにも +関わらず、dvipdfmxと組み合わせてOpenTypeフォントを埋め込んだ% +PDF文書を作成するということが可能になっている。 +しかしその代償として、例えば新しいフォントを使えるようにするために一定の作業が +必要になるなどの短所を持ち合わせている。 +{\XeTeX}\>はこの点に関して「非依存性」を捨てて、システムで使用可能な +フォントを直接扱うことで、何も設定しなくても好きなフォントを使うことが可能に +なっている。 +また、従来の\>{\TeX}\>では難しい、フォントのもつ情報を利用した高度なリガチャ・ +アクセント付加・位置異形の処理も自由に使うことが可能になっている。 + +\subsection{{\XeTeX}\>の出力例} + +{\XeTeX}\>のもつ能力の一端を示す例をあげる。 +これは\>{\XeLaTeX}({\XeTeX}\>上で動く\>{\LaTeX})の文書である。 + +\jafamilyinverbatim % verbatim を和文フォントで出力 +\begin{quote}\small\begin{verbatim} +% このファイルの文字コードは UTF-8 +\documentclass[a4paper]{article} +\usepackage{xltxtra} % これは後で解説 +\newfontfamily\fchr{Charis SIL} % \fchr でフォント“Charis SIL”に切替 +\newfontfamily\fipm{IPA明朝} % \fipm でフォント“IPA明朝”に切替 + % \faru でデーヴァナーガリー文字用の設定を施した“Arial Unicode MS”に切替 +\newfontfamily\faru[Script=Devanagari]{Arial Unicode MS} + % \showUC は何の変哲のない LaTeX のマクロ +\newcommand*\showUC[1]{\ \texttt{\footnotesize U+#1}} +\begin{document} +\begin{itemize} +\item {\fipm 土\symbol{"571F}}\showUC{571F} / + {\fipm 圡\symbol{"5721}}\showUC{5721} / + {\fipm 𡈽\symbol{"2123D}}\showUC{2123D} +\item {\fchr j}\showUC{006A} + {\fchr\symbol{"0302}}\showUC{0302} + = {\fchr j\symbol{"0302}} +\item {\fipm か}\showUC{304B} + {\fipm\symbol{"309A}}\showUC{309A} + = {\fipm か\symbol{"309A}} +\item {\faru \symbol{"915}}\showUC{0915} + {\faru\symbol{"93F}}\showUC{093F} + = {\faru \symbol{"915}\symbol{"93F}} +\end{itemize} + +\end{document} +\end{verbatim}\end{quote} + +上の文書をxelatexコマンドで組版すると以下の出力を含む% +PDF文書が得られる。 + +\begin{center} +\frame{\includegraphics{xetexsamp01.pdf}} +\end{center} + +\nojafamilyinverbatim % verbatim を欧文フォントで出力 + +上の文書において、\verb|\symbol{"xx}|\>は符号位置がxx(16進)である +文字を出力する\>{\LaTeX}\>コマンドである。 +{\XeLaTeX}\>ではこれがUnicode符号空間で使えることが出力の +1行目から判る。% +(従来の\>{\LaTeX}\>では8ビットの値のみ。) +勿論、UTF-8で直接書いた文字も出力されている。 +2行目以下ではUnicode結合文字を用いた文字合成の例を示している。% +\verb|j\symbol{"0302}|\>はjの直後にU+0302の文字 +(結合曲アクセント)を書いたのと同じで、これはUnicodeの規則で +「ĵ(曲アクセント付j)」を表す。 +2行目を見ると正しく合成が行われていることが判る。 + +\end{document} diff --git a/Master/texmf-dist/doc/latex/zxjatype/example/xetexsamp01.pdf b/Master/texmf-dist/doc/latex/zxjatype/example/xetexsamp01.pdf new file mode 100644 index 00000000000..27fa004c44e Binary files /dev/null and b/Master/texmf-dist/doc/latex/zxjatype/example/xetexsamp01.pdf differ diff --git a/Master/texmf-dist/tex/latex/zxjatype/zxjatype.sty b/Master/texmf-dist/tex/latex/zxjatype/zxjatype.sty new file mode 100644 index 00000000000..b442aea4d8e --- /dev/null +++ b/Master/texmf-dist/tex/latex/zxjatype/zxjatype.sty @@ -0,0 +1,1036 @@ +% +% zxjatype.sty +% +%% package declaration +\NeedsTeXFormat{LaTeX2e} +\ProvidesPackage{zxjatype}[2012/09/09 v0.6 ZX Japanese typeset] +\RequirePackage{ifxetex}\RequireXeTeX + +%% code guards +\edef\zxjt@restore@codes{% + \catcode34=\the\catcode34% + \catcode39=\the\catcode39% + \catcode43=\the\catcode43% + \catcode45=\the\catcode45% + \catcode46=\the\catcode46% + \catcode47=\the\catcode47% + \catcode58=\the\catcode58% + \catcode60=\the\catcode60% + \catcode62=\the\catcode62% + \catcode63=\the\catcode63% + \catcode94=\the\catcode94% + \catcode96=\the\catcode96% + \endlinechar=\the\endlinechar% +\relax} +\catcode34=12 % <"> +\catcode39=12 % <'> +\catcode43=12 % <+> +\catcode45=12 % <-> +\catcode46=12 % <.> +\catcode47=12 % +\catcode58=12 % <:> +\catcode60=12 % <<> +\catcode62=12 % <>> +\catcode63=12 % +\catcode94=7 % <^> +\catcode96=12 % <`> +\AtEndOfPackage{% + \zxjt@restore@codes + \let\zxjt@restore@codes\@undefined +} +\endlinechar=13 % + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% BOOTSTRAP CODE +% + +%% definitions +\def\zxjt@pkgname{zxjatype} +\newif\ifzxjt@default +\newif\ifzxjt@checksingle +\newif\ifzxjt@adjustcharclass +\providecommand*\bxDebug{\@gobble} + +%% process options +\DeclareOption{default}{\zxjt@defaulttrue} +\DeclareOption{nodefault}{\zxjt@defaultfalse} +\DeclareOption{oldxetex}{% no longer supported + \PackageError\zxjt@pkgname + {'oldxetex' is no longer supported}\@ehc +} +\DeclareOption{CJKchecksingle}{\zxjt@checksingletrue} +\DeclareOption{noCJKchecksingle}{\zxjt@checksinglefalse} +% effective only in 'new-age' code +\DeclareOption{adjustcharclass}{\zxjt@adjustcharclasstrue} +\DeclareOption{noadjustcharclass}{\zxjt@adjustcharclassfalse} +% +\DeclareOption*{\PassOptionsToPackage{\CurrentOption}{xeCJK}} +\ExecuteOptions{default,CJKchecksingle,adjustcharclass} +\ProcessOptions\relax + +%% load xeCJK package +\@ifpackageloaded{xeCJK}{}{% + \RequirePackage{xeCJK}% +} +\@ifpackagelater{xeCJK}{2012/05/01}{% + \bxDebug{xeCJK v3.x found.}% + \let\zxjt@go@to@main\@empty +}{% + \bxDebug{xeCJK v2.x found.}% + \long\def\zxjt@go@to@main#1\zxjt@begin@old@code{}% +} + +%% jump to main code +\zxjt@go@to@main + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% NEW-AGE CODE + +%% load packages +\RequirePackage{xparse} % xeCJK has already done it... +\ExplSyntaxOn + +%%-------------------------------------- transition + +%% \l__zxjt_default_bool +\bool_new:N \l__zxjt_default_bool +\ifzxjt@default + \bool_set_true:N \l__zxjt_default_bool +\fi +%% \l__zxjt_checksingle_bool +\bool_new:N \l__zxjt_checksingle_bool +\ifzxjt@checksingle + \bool_set_true:N \l__zxjt_checksingle_bool +\fi +%% \l__zxjt_adjustcharclass_bool +\bool_new:N \l__zxjt_adjustcharclass_bool +\ifzxjt@adjustcharclass + \bool_set_true:N \l__zxjt_adjustcharclass_bool +\fi + +%%-------------------------------------- error messages + +%% \c__zxjt_pkgname_tl +\tl_const:Nn \c__zxjt_pkgname_tl { zxjatype } +% +\cs_new:Npn \__zxjt_msg_new:nn + { \msg_new:nnn { \c__zxjt_pkgname_tl } } +\cs_new:Npn \__zxjt_error:nx + { \msg_error:nnx { \c__zxjt_pkgname_tl } } +\cs_new:Npn \__zxjt_error:n + { \msg_error:nn { \c__zxjt_pkgname_tl } } +% +\__zxjt_msg_new:nn { xeCJK-incompatible } + { + Some~incompatible~settings~used~inside~xeCJK.\\ + This~command~will~not~work~properly. + } +\__zxjt_msg_new:nn { jafamilyinverbatim-disabled } + { + \token_to_str:N \(no)jafamilyinverbatim \c_space_tl + ~is~disabled~in~this~version. + } +\__zxjt_msg_new:nn { CJKfam-failed } + { + Cannot~switch~to~CJK~family,~since~fetching~the~information~for\\ + the~current~family~has~failed~for~some~reason.\\ + (family=#1) + } + +%%-------------------------------------- helper functions + +%% temporary variables +\tl_new:N \g__zxjt_tmpa_tl +\dim_new:N \l__zxjt_tmpa_dim +\box_new:N \g__zxjt_tmpa_box + +%% \c__zxjt_Default_class_int +%% \c__zxjt_CJK_class_int +%% \c__zxjt_FullLeft_class_int +% The integer constants for char-classes. These classes are predefined in +% XeLaTeX kernel, and not likely to change in near future. +\int_const:Nn \c__zxjt_Default_class_int { 0 } +\int_const:Nn \c__zxjt_CJK_class_int { 1 } +\int_const:Nn \c__zxjt_FullLeft_class_int { 2 } + +%% \__zxjt_boundary: +% Invokes the interchar-tokens for transition to the boundary class (255). +% (A mere \scan_stop: suffices?) +\cs_new:Nn \__zxjt_boundary: + { + \ifhmode + \hbox:n {} + \fi + } + +%% \__zxjt_leavevmode: +% The well-known \leavevmode. +\cs_new:Nn \__zxjt_leavevmode: + { \hbox_unpack:N \c_empty_box } + +%% \__zxjt_swap_doccmd:NN \cmdA \cmdB +% Swaps the meaning of two document commands \cmdA and \cmdB. Although \cmdA +% could call its submacros (\[cmdA code] etc.) produced by xparse mechanism, +% one only has to simply swap the meaning of macros \cmdA and \cmdB. +\cs_new:Nn \__zxjt_swap_doccmd:NN + { + \cs_set_eq:NN \__zxjt_swap_tmp: #1 + \cs_set_eq:NN #1 #2 + \cs_set_eq:NN #2 \__zxjt_swap_tmp: + \cs_undefine:N \__zxjt_swap_tmp: + } + +%%-------------------------------------- font-declaration hooks + +% The \setCJKxxxfont commands of xeCJK are redefined so that a hook +% \__zxjt_after_decl_CJKfam:n {} is invoked on each declration +% of a CJK family, including a generic one (\CJKrmdefault etc.). +% If the declaration is done in the preamble then the execution of hook will +% be delayed until the beginning of the document. + +%% Adds a hook to \setCJKxxxfont commands. +\NewDocumentCommand \__setCJKmainfont { O{} m } + { + \__setCJKmainfont [ \l__zxjt_scale_spec_tl #1 ] { #2 } + \exp_args:Nx \__zxjt_after_decl_CJKfam:n { \CJKrmdefault } + } +\__zxjt_swap_doccmd:NN \__setCJKmainfont \setCJKmainfont +\NewDocumentCommand \__setCJKsansfont { O{} m } + { + \__setCJKsansfont [ \l__zxjt_scale_spec_tl #1 ] { #2 } + \exp_args:Nx \__zxjt_after_decl_CJKfam:n { \CJKsfdefault } + } +\__zxjt_swap_doccmd:NN \__setCJKsansfont \setCJKsansfont +\NewDocumentCommand \__setCJKmonofont { O{} m } + { + \__setCJKmonofont [ \l__zxjt_scale_spec_tl #1 ] { #2 } + \exp_args:Nx \__zxjt_after_decl_CJKfam:n { \CJKttdefault } + } +\__zxjt_swap_doccmd:NN \__setCJKmonofont \setCJKmonofont +\NewDocumentCommand \__setCJKfamilyfont { m O{} m } + { + \__setCJKfamilyfont { #1 } [ \l__zxjt_scale_spec_tl #2 ] { #3 } + \__zxjt_after_decl_CJKfam:n { #1 } + } +\__zxjt_swap_doccmd:NN \__setCJKfamilyfont \setCJKfamilyfont + +%% \g__zxjt_CJKfam_seq +% The record of CJK-family names declared in the preamble. +\seq_new:N \g__zxjt_CJKfam_seq +%% \__zxjt_after_decl_CJKfam:n {} +% The hook. +% (in the preamble) +\cs_new:Nn \__zxjt_after_decl_CJKfam:n + { + \seq_gput_right:Nn \g__zxjt_CJKfam_seq { #1 } + } +% (in the document body) +\cs_new:Nn \__zxjt_after_decl_CJKfam_db:n + { + \__zxjt_inspect_CJKfam_info:n { #1 } + \__zxjt_invoke_ext_hook:n { #1 } + } +%% The begin-document hook. +% Processes the entires in \g__zxjt_CJKfam_seq and alters the definition of +% \__zxjt_after_decl_CJKfam:n. +\AtBeginDocument + { + \cs_set_eq:NN \__zxjt_after_decl_CJKfam:n \__zxjt_after_decl_CJKfam_db:n + \seq_remove_duplicates:N \g__zxjt_CJKfam_seq + \seq_map_function:NN \g__zxjt_CJKfam_seq \__zxjt_after_decl_CJKfam:n + \seq_gclear:N \g__zxjt_CJKfam_seq + } + +%%-------------------------------------- font-selection hooks + +% The \CJKfamily of xeCJK is redefined so that a hook +% \__zxjt_after_decl_CJKfam:n {} is invoked. The CJK-family +% name given is recorded in \l__zxjt_CJKfam_tl. +% NB. \l__zxjt_CJKfam_tl should be same as \xeCJK@family. + +%% Adds a hook to \CJKfamily command. +\NewDocumentCommand \__CJKfamily { m } + { + \__CJKfamily { #1 } + \exp_args:Nx \__zxjt_after_sel_CJKfam:n { #1 } + } +\__zxjt_swap_doccmd:NN \__CJKfamily \CJKfamily + +%% \__zxjt_after_decl_CJKfam:n {} +% The hook. +\cs_new:Nn \__zxjt_after_sel_CJKfam:n + { + \tl_set:Nn \l__zxjt_CJKfam_tl { #1 } + } + +%--------------------------------------- CJK-family inspection + +% \__zxjt_inspect_CJKfam_info:n tries to know the NFSS family correspoding to +% the given CJK-family name (without hacking into xeCJK internal) in the +% following way: +% - A text including a CJK letter is typeset in an hbok with a "fresh" +% CJK-family. +% - This process would trigger the declaration of the fontspec family +% corresponding to the CJk-family in issue. +% - So a hook is attached in advance to \fontspec_set_family:Nnn; the hook +% record the NFSS family into a temporary global variable. + +%% \g__zxjt_CJKfam_prop +% The map from CJK-family names to NFSS family names. +\prop_new:N \g__zxjt_CJKfam_prop +%% \g__zxjt_onefam_info_tl +\tl_new:N \g__zxjt_onefam_info_tl +%% \l__zxjt_onefam_info_tl +\tl_new:N \l__zxjt_onefam_info_tl +%% \__zxjt_inspect_CJKfam_info:n {} +% Tries to fetch the NFSS family name corresponding the given CJK family +% name; if it succeeds, then the obtained name will be recorded in the map +% \g__zxjt_CJKfam_prop. +\cs_new:Nn \__zxjt_inspect_CJKfam_info:n + { + \prop_if_in:NnF \g__zxjt_CJKfam_prop { #1 } + { \__zxjt_inspect_CJKfam_info_aux_i:n { #1 } } + } +\cs_new:Nn \__zxjt_inspect_CJKfam_info_aux_i:n + { + \tl_gclear:N \g__zxjt_onefam_info_tl + \int_compare:nNnT { \XeTeXcharclass "5B57 } = { \c__zxjt_CJK_class_int } + { + \group_begin: + \cs_set_eq:NN \__zxjt_org_set_family:Nnn \fontspec_set_family:Nnn + \cs_set:Nn \fontspec_set_family:Nnn { + \__zxjt_org_set_family:Nnn ##1 { ##2 } { ##3 } + \cs_gset_eq:NN \g__zxjt_onefam_info_tl ##1 + } + \__CJKfamily { #1 } + \hbox_set:Nn \l_tmpa_box { ^^^^5b57 } + \group_end: + } + \bxDebug { family( #1 )~<=~ \g__zxjt_onefam_info_tl } + \tl_if_empty:NF \g__zxjt_onefam_info_tl + { + \prop_put:NnV \g__zxjt_CJKfam_prop { #1 } \g__zxjt_onefam_info_tl + } + } + +%--------------------------------------- external hook + +%%<+> \zxJaFamilyFontHook +% The variable to store the hook code. +\tl_clear_new:N \zxJaFamilyFontHook +%%<+> \zxJaFamilyName +% The variable holds the name of the declared CJK family name when the hook +% is invoked. +\tl_clear_new:N \zxJaFamilyName + +%% \__zxjt_invoke_ext_hook:n {} +% Invokes the external hook code. +\cs_new:Nn \__zxjt_invoke_ext_hook:n + { + \tl_set:Nn \zxJaFamilyName { #1 } + \zxJaFamilyFontHook + } + +%%-------------------------------------- switching to CJK-family + +%% \g__zxjt_encoding_tl +% The encoding used for CJK-families. +\tl_new:N \g__zxjt_encoding_tl +\tl_gset:Nn \g__zxjt_encoding_tl { EU1 } + +%% \__zxjt_use_CJKfam: +% Switches the NFSS family to the family corresponding to the current CJK- +% family (designated by \CJKfamily etc.). +\cs_new:Nn \__zxjt_use_CJKfam: + { + \exp_args:NNx + \prop_get:NnNTF \g__zxjt_CJKfam_prop { \l__zxjt_CJKfam_tl } + \l__zxjt_onefam_info_tl + { + \bxDebug { family(\l__zxjt_CJKfam_tl)~=>~\l__zxjt_onefam_info_tl } + \fontencoding { \g__zxjt_encoding_tl } + \fontfamily { \l__zxjt_onefam_info_tl } + \selectfont + } + { + \__zxjt_error:nx { CJKfam-failed } { \l__zxjt_CJKfam_tl } + } + } + +%%-------------------------------------- inhibitglue + +%%<*> \inhibitglue +% Cancles adjustment glues around this command. +% NB: This is different from suppressing all adjustment; only glues vanish, +% so punctuation characters will have a truncated width. +\bool_if:nT + % if \inhibitglue does not seem to have a valid definition, one is provided + % by this package. + { ( \cs_if_free_p:N \inhibitglue ) + || ( \cs_if_eq:p:NN \inhibitglue \scan_stop: ) + || ( \cs_if_eq:p:NN \inhibitglue \prg_do_nothing: ) } + { + \cs_undefine:N \inhibitglue + \NewDocumentCommand \inhibitglue {} + { + \scan_stop: + \__zxjt_leavevmode: + % cancels left-side glue + \unskip \unskip \unskip + % cancels right-side glue to come, which is tricky... + \__zxjt_cancel_postglue: + } + } + +%% \__zxjt_cancel_postglue: +% Tries to cancel the right-side glue coming from adjustment process done +% by xeCJK. This is implemented as follows: +% - Peek the following token. +% - If the token is a non-letter character and has the FullLeft char-class, +% then proceed; otherwise stop here. +% - Measure the left-side glue of the character. +% - Put the negative of the measured glue. +\cs_new:Nn \__zxjt_cancel_postglue: + { + \peek_after:Nw \__zxjt_cancel_postglue_aux_i: + } +\cs_new:Nn \__zxjt_cancel_postglue_aux_i: + { + \token_if_other:NT \l_peek_token { \__zxjt_cancel_postglue_aux_ii:N } + } +\cs_new:Nn \__zxjt_cancel_postglue_aux_ii:N + { + \bool_if:nT + { ! (\token_if_cs_p:N #1 ) + && ( \int_compare_p:nNn + { \XeTeXcharclass `#1 } = \c__zxjt_FullLeft_class_int ) } + { + \__zxjt_measure_leftglue:N #1 + \skip_horizontal:N \l__zxjt_leftglue_skip + } + #1 + } + +%% \l__zxjt_leftglue_skip +% The left-side cenceling glue resulted from the measurement. +\skip_new:N \l__zxjt_leftglue_skip + +%% \__zxjt_measure_leftglue:N {} +\cs_new:Nn \__zxjt_measure_leftglue:N + { + \group_begin: + \hbox_set:Nn \l_tmpa_box { #1 } + \skip_set:Nn \l__zxjt_tmpa_dim { \box_wd:N \l_tmpa_box } + \vbox_set:Nn \l_tmpa_box + { + \dim_set:Nn \hsize { 2\l__zxjt_tmpa_dim } + \noindent + \hbox:n {} \newline + #1 + } + \vbox_set:Nn \l_tmpb_box + { + \vbox_unpack:N \l_tmpa_box + \box_gset_to_last:N \g__zxjt_tmpa_box + } + \hbox_set:Nn \l_tmpa_box + { + \hbox_unpack:N \g__zxjt_tmpa_box + \unskip \unskip + } + \dim_set:Nn \l__zxjt_tmpa_dim + { \l__zxjt_tmpa_dim - \box_wd:N \l_tmpa_box } + \dim_compare:nNnTF { \l__zxjt_tmpa_dim } > { \c_zero_dim } + { + \skip_set:Nn \l__zxjt_leftglue_skip + { -\l__zxjt_tmpa_dim minus -\l__zxjt_tmpa_dim } + } + { \skip_zero:N \l__zxjt_leftglue_skip } + \tl_gset:Nx \g__zxjt_tmpa_tl + { \skip_use:N \l__zxjt_leftglue_skip } + \group_end: + \skip_set:Nn \l__zxjt_leftglue_skip { \g__zxjt_tmpa_tl } + \bxDebug { postglue(#1)~=~\skip_use:N \l__zxjt_leftglue_skip } + } + +%%-------------------------------------- char-class adjustment + +%% \__zxjt_adjust_charclass: +\cs_new:Nn \__zxjt_adjust_charclass: + { + \xeCJKDeclareCharClass { CJK } + { + % Assigning 'FullRight' to small kana letters enables kinsoku at + % the left side, but sometimes disrupts spacing around them + % (these letters must be behaved same as ordinary kana/kanji letters + % with respect to spacing). Moreover kinsoku before small kana + % is criticized as "too strong" to use as default by some experts. + % So they are treated as normal CJK letters. + "3041, "3043, "3045, "3047, "3049, "3063, "3083, "3085, "3087, "308E, + "309B, "309C, "309D, "309E, "30A1, "30A3, "30A5, "30A7, "30A9, "30C3, + "30E3, "30E5, "30E7, "30EE, "30F5, "30F6, "30FB, "30FC, "30FD, "30FE, + } + \xeCJKDeclareCharClass { FullRight } + { + % U+2015 is treated same as U+2014. + "2015, + } + } + +%% Dispatches adjustment if 'adjustcharclass' option is set. +\bool_if:NT \l__zxjt_adjustcharclass_bool + { + \__zxjt_adjust_charclass: + \xeCJKsetup { LongPunct+ = { ^^^^2015 } } + } + +%%-------------------------------------- public commands + +%%<*> \setjamainfont / \setjasansfont / \setjamonofont +%%<*> \setjafamilyfont / \jafamily +% Now these are synonymous to corresponding \...CJK... commands. +\NewDocumentCommand \setjamainfont {} + { \setCJKmainfont } +\NewDocumentCommand \setjasansfont {} + { \setCJKsansfont } +\NewDocumentCommand \setjamonofont {} + { \setCJKmonofont } +\NewDocumentCommand \setjafamilyfont {} + { \setCJKfamilyfont } +\NewDocumentCommand \jafamily {} + { \CJKfamily } + +%%<*> \zxjapanesestyle +%% Switches to a setting suitable for Japanese typesetting. +\NewDocumentCommand { \zxjapanesestyle } {} + { + \xeCJKsetup + { + AllowBreakBetweenPuncts = true, + PunctStyle = fullwidth, + } + \zxusejapaneseparameters + } + +%%<*> \zxusejapaneseparameters +%% Sets some xeCJK parameters to values suiable for Japanese. +\NewDocumentCommand { \zxusejapaneseparameters } {} + { + \xeCJKsetup + { + CJKglue = + { \hspace { 0pt plus .08\baselineskip minus .008\baselineskip } }, + CJKecglue = + { \hspace { 0.25em plus 0.15em minus 0.05em } }, + } + } +%%<*> \zxuseoriginalparameters +%% Reets some xeCJK parameters to their original values. +\NewDocumentCommand { \zxuseoriginalparameters } {} + { + \xeCJKsetup + { + CJKglue = + { \hspace { 0pt plus .08\baselineskip } }, + CJKecglue = + { \c_space_token }, + } + } + +%% \__zxjt_scale_tl +% The scale value to be applied to CJK fonts. +\tl_new:N \__zxjt_scale_tl +%% \l__zxjt_scale_spec_tl +\tl_new:N \l__zxjt_scale_spec_tl + +%%<*> \setjafontscale{} +%% Sets the value of \__zxjt_scale_tl, which defaults to 1. +\NewDocumentCommand \setjafontscale { m } + { + % NB: the argument is not expanded + \tl_set:Nn \__zxjt_scale_tl { #1 } + \tl_if_blank:VTF \__zxjt_scale_tl + { \tl_clear:N \l__zxjt_scale_spec_tl } + { + \tl_set:Nn \l__zxjt_scale_spec_tl + { Scale = \__zxjt_scale_tl , } + } + } + +%%<*> \[no]jafamilyinverbatim +% NB: THESE COMMADS ARE DISABLED at the current version. +\NewDocumentCommand \jafamilyinverbatim {} + { \__zxjt_error_jafamilyinverbatim: } +\NewDocumentCommand \nojafamilyinverbatim {} + { \__zxjt_error_jafamilyinverbatim: } +\cs_new:Nn \__zxjt_error_jafamilyinverbatim: + { + \__zxjt_error:n { jafamilyinverbatim-disabled } + \cs_set_eq:NN \__zxjt_error_jafamilyinverbatim: \prg_do_nothing: + } + +%% Shorthand commands \< and \> +\AtBeginDocument + { + % \< is equated with \inhibitglue only if it is undefined. + \cs_if_free:NT \< + { \cs_set_eq:NN \< \inhibitglue } + % \> is redefined so it does \CJKecglue in text mode, only if it is + % not changed from the original LaTeX definition. + \tl_set:Nn \l_tmpa_tl { \mskip \medmuskip } + \token_if_eq_meaning:NNT \> \l_tmpa_tl + { + \cs_set:Npn \> + { + \ifmmode + \mskip \medmuskip + \else + \CJKecglue \scan_stop: + \fi + } + } + } + +%%<*> \textrawja {} +% Prints the text in the current CJK font, without xeCJK processing. +\NewDocumentCommand \textrawja {} + { \__zxjt_text_raw:nn { \__zxjt_use_CJKfam: } } +%%<*> \textrawen {} +% Prints the text in the current non-CJK font, without xeCJK processing. +\NewDocumentCommand \textrawen {} + { \__zxjt_text_raw:nn { \prg_do_nothing: } } +\cs_new:Nn \__zxjt_text_raw:nn + { + \__zxjt_leavevmode: + \__zxjt_boundary: + \group_begin: + \xeCJKsetup { xeCJKactive = false } + #1#2 + \group_end: + \__zxjt_boundary: + } + +%%<*> rawjatext/rawentext environments +\NewDocumentEnvironment { rawjatext } {} + { \__zxjt_raw_text:n { \__zxjt_use_CJKfam: } } + { \__zxjt_boundary: } +\NewDocumentEnvironment { rawentext } {} + { \__zxjt_raw_text:n { \prg_do_nothing: } } + { \__zxjt_boundary: } +\cs_new:Nn \__zxjt_raw_text:n + { + \__zxjt_leavevmode: + \__zxjt_boundary: + \xeCJKsetup { xeCJKactive = false } + #1 + } + +%%-------------------------------------- initial settings + +%% cooperation with BXJS classes +\setjafontscale { } +\cs_if_exist:NT \jsDocClass + { + \setjafontscale { \jsScale } + } +\cs_if_exist:NT \Cjascale + { + \setjafontscale { \Cjascale } + } + +%% drivers for \UI & \Ux +\cs_set:Npn \zxjt@Ux + { \char \bxUcv } +\cs_set:Npn \zxjt@Uxh #1 + { \char "#1 \c_space_tl } +\cs_set:Npn \zxjt@UI + { + \group_begin: + \__zxjt_use_CJKfam: + \char \bxUcv + \group_end: + } +\cs_set:Npn \zxjt@UIh #1 + { + \group_begin: + \__zxjt_use_CJKfam: + \char "#1 \c_space_tl + \group_end: + } + +%% when option 'checksingle' is set +\bool_if:NT \l__zxjt_checksingle_bool + { + \xeCJKsetup + { CheckSingle = true } + } + +%% when option 'default' is set +\bool_if:NT \l__zxjt_default_bool + { \zxjapanesestyle } + +%%-------------------------------------- all done +\ExplSyntaxOff +\endinput +%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% NEW-AGE CODE +\zxjt@begin@old@code + +%% load prerequisite packages +\RequirePackage{etoolbox} +\endlinechar=-1 % + +%%%% definitions +%\def\zxjt@pkgname{zxjatype} +\def\zxjt@error{\PackageError\zxjt@pkgname} +\def\zxjt@warn{\PackageWarningNoLine\zxjt@pkgname} +% +\newcount\zxjt@olspc +\newcount\zxjt@orspc +\newcount\zxjt@lspc +\newcount\zxjt@rspc +\newcount\zxjt@lbspc +\newcount\zxjt@raspc +\newcount\zxjt@cnta +\newcount\zxjt@cntb +\newif\ifzxjt@jafamilyinverbatim +\newif\ifzxjt@patch@success + +% make 'checksingle' effective +\ifzxjt@checksingle + \let\xeCJK@i@i\xeCJK@checksingle +\fi + + +%%-------- Patches to xeCJK's internal macros + +\zxjt@patch@successtrue +% \xeCJK@setkern +\@gobble{\if}%if-match +\patchcmd{\xeCJK@setkern} + {\fi\ifnum\xeCJK@cnta<0} + {\else\zxjt@patch@xeCJK@setkern#1#2\fi\ifnum\xeCJK@cnta<0} + {}{\zxjt@patch@successfalse} +\@gobble{\fi}%if-match +% \xeCJK@punctrule +\@gobble{\if\if}%if-match +\patchcmd{\xeCJK@punctrule} + {\fi\xeCJK@cntd=\xeCJK@cntc} + {\else\zxjt@patch@xeCJK@punctrule#1{#2}\fi\xeCJK@cntd=\xeCJK@cntc} + {}{\zxjt@patch@successfalse} +% +\ifzxjt@patch@success + \bxDebug{Patch applied to xeCJK.} +\else + \zxjt@error{Failed in patching to xeCJK} + {Package loading is aborted right now.} + \zxjt@restore@codes +\expandafter\endinput\fi\relax + +%%-------- User interface + +%%<*> \zxjapanesestyle +%% Switches to a setting suitable for Japanese typesetting. +\newcommand*\zxjapanesestyle{ + \punctstyle{quasijis} + \xeCJKallowbreakbetweenpuncts + %\CJKaddspaces + \zxusejapaneseparameters +} + +%%<*> \zxusejapaneseparameters +%% Sets some xeCJK parameters to values suiable for Japanese. +\newcommand*\zxusejapaneseparameters{ +\def\CJKglue{\hskip \z@ \@plus .08\baselineskip \@minus .008\baselineskip} +\CJKsetecglue{\hskip 0.25em\@plus 0.15em\@minus 0.05em} +} + +%%<*> \zxuseoriginalparameters +%% Reets some xeCJK parameters to their original values. +\newcommand*\zxuseoriginalparameters{ +\def\CJKglue{\hskip \z@ \@plus .08\baselineskip} +\CJKsetecglue{ } +} + +%%<*> \setjamainfont[]{} +%%<*> \setjasansfont[]{} +%%<*> \setjamonofont[]{} +%%<*> \setjafamilyfont{}[]{} +%% Same as setCJK...font, except that 'Scale=\zxjt@scale' is specified as a feature. +\def\setjamainfont{\zxjt@newfontfamily{rm}} +\def\setjasansfont{\zxjt@newfontfamily{sf}} +\def\setjamonofont{\zxjt@newfontfamily{tt}} +\def\setjafamilyfont{\zxjt@newfontfamily} +\def\zxjt@newfontfamily#1{ + \@ifnextchar[{\zxjt@newfontfamily@a{#1}} + {\zxjt@newfontfamily@a{#1}[]}} +\def\zxjt@newfontfamily@a#1[#2]{ + \def\zxJaFamilyName{#1}\zxJaFamilyFontHook + \xeCJK@newfontfamily@{#1}[Scale=\zxjt@scale,#2]} + +%%<*> \jafamily{} +\let\jafamily\CJKfamily +\let\zxjafamily\CJKfamily + +%%<+> \zxJaFamilyFontHook +%% Hook set in \setja...font commands. The new family name is +%% stored in \zxJaFamilyName. +\let\zxJaFamilyFontHook\@empty + +%%<*> \setjafontscale{} +%% Sets the value of \zxjt@scale, which defaults to 1. +\def\setjafontscale#1{\def\zxjt@scale{#1}} +\setjafontscale{1} + +%% <*> \> +\def\>{\ifmmode\mskip\medmuskip\else \CJKecglue\relax \fi} + +%%<*> \zxinhibitglue +%% Removes a intercharacter glue inserted for space adjustment. +\protected\def\inhibitglue{ + \relax\leavevmode % build bounadry + \ifdim\lastskip=\zxjt@icgprobe@value\relax + \unskip\unskip\unskip % removes the adjuster skip plus probe skips + \bxDebug{cancel glue right}% + \fi + \kern-\zxjt@icgprobe@value\kern\zxjt@icgprobe@value % probe for forward check +} +\AtBeginDocument{ + \ifx\<\@undefined \let\<\inhibitglue \fi +} + +%%-------- Define a new punctrule 'quasijis' +% The punctrule 'quasijis' is a spacing rule which roughly implements the rule +% descrived in JIS X 4051 on the xeCJK system. + +%% \xeCJK@ps@quasijis +% NB: The package should not depend on its value (10). +\def\xeCJK@ps@quasijis{10} + +%% \zxjt@icgprobe@value +\def\zxjt@icgprobe@value{10sp} + +%% \zxjt@cpar +\def\zxjt@cpar#1#2{% + \ifcsname xeCJK\xeCJK@punctstyle\xeCJK@bboxname @#1@#2\endcsname + \csname xeCJK\xeCJK@punctstyle\xeCJK@bboxname @#1@#2\endcsname + \else 0 + \fi\relax +} + +%% \zxjt@patch@xeCJK@setkern +\def\zxjt@patch@xeCJK@setkern#1#2{ + \ifnum\xeCJK@punctstyle=\xeCJK@ps@quasijis\relax + \zxjt@lbspc=\zxjt@cpar{loglue}{#1} + \zxjt@rspc=\zxjt@cpar{roglue}{#1} + \zxjt@lspc=\zxjt@cpar{loglue}{#2} + \zxjt@raspc=\zxjt@cpar{roglue}{#2} + \ifnum\zxjt@lspc=25 + \xeCJK@cnta=25\relax + \else\ifnum\zxjt@rspc=25 + \xeCJK@cnta=25\relax + \else\ifnum\numexpr\zxjt@lbspc+\zxjt@rspc=0\relax + \xeCJK@cnta=\numexpr\zxjt@rspc+\zxjt@lspc\relax + \else\ifnum\numexpr\zxjt@lspc+\zxjt@raspc=0\relax + \xeCJK@cnta=\numexpr\zxjt@rspc+\zxjt@lspc\relax + \else + \xeCJK@cnta=\numexpr\zxjt@rspc+\zxjt@lspc-50\relax + \ifnum\xeCJK@cnta<0 \xeCJK@cnta=0 \fi + \fi\fi\fi\fi + \bxDebug{<#1>\the\zxjt@rspc+<#2>\the\zxjt@lspc::\the\xeCJK@cnta} + \fi +} + +%% \zxjt@patch@xeCJK@punctrule +\def\zxjt@patch@xeCJK@punctrule#1#2{ + \ifnum\xeCJK@punctstyle=\xeCJK@ps@quasijis\relax + \zxjt@olspc=\csname xeCJK@\xeCJK@bboxname @lspace@#1\endcsname\relax + \zxjt@orspc=\csname xeCJK@\xeCJK@bboxname @rspace@#1\endcsname\relax + % limit sum of both side-bearings to either 0 or 50 + \zxjt@lspc=0 \zxjt@rspc=0\relax + \ifcsname zxjt@jisfullwidth@#1\endcsname + \else\ifnum\zxjt@olspc>40\relax + \zxjt@lspc=50\relax + \else\ifnum\zxjt@orspc>40\relax + \zxjt@rspc=50\relax + \else + \ifnum\zxjt@olspc>15 \ifnum\zxjt@orspc>15\relax + \zxjt@lspc=25 \zxjt@rspc=25\relax + \fi\fi + \fi\fi\fi + \xeCJK@cnta=\csname zxjt@#2spc\endcsname + \xeCJK@cntc=\xeCJK@cnta + \xeCJK@cntd=\xeCJK@cnta + \bxDebug{<#1>:\the\zxjt@lspc/\the\zxjt@rspc} + \fi +} + +%% \zxjt@jis@fullwidth{} +\def\zxjt@jis@fullwidth#1{ + \expandafter\def\csname zxjt@jisfullwidth@#1\endcsname{} +} +\zxjt@jis@fullwidth{^^^^ff01}% FULLWIDTH EXCLAMATION MARK + +%%------ adjustment for Japanese font scaling + +%% \zxjt@lettodimenx{} +\def\zxjt@lettodimenx#1{ + \expandafter\let\expandafter\zxjt@dimenx\csname#1\endcsname +} + +%% \zxjt@outputglue +\def\zxjt@outputglue{ + \ifnum\xeCJK@punctstyle=\xeCJK@ps@quasijis\relax + \ifdim\lastkern=\zxjt@icgprobe@value\relax + \unkern\unkern + \bxDebug{cancel glue left}% + \else + {\xeCJK@setfont % switch to CJK font + \hskip\zxjt@dimenx\space\@minus\zxjt@dimenx + \hskip-\zxjt@icgprobe@value\hskip\zxjt@icgprobe@value} + \fi + \else + \hskip\zxjt@dimenx\space\@plus0.1em \@minus0.1em\relax + \fi +} + +%% REVISE: \xeCJK@i@ii +\def\xeCJK@i@ii#1{ + \xeCJK@punctrule{#1}{l} + \zxjt@lettodimenx{xeCJK\xeCJK@punctstyle\xeCJK@bboxname @lglue@#1} + \zxjt@outputglue + \xeCJK@setprepunct{#1}} + +%% REVISE: \xeCJK@afterpostpunct +\def\xeCJK@afterpostpunct{ + \vrule width \csname xeCJK\xeCJK@punctstyle\xeCJK@bboxname + @rrule@\xeCJK@lastpunct\endcsname depth \z@ height \z@ + \zxjt@lettodimenx{xeCJK\xeCJK@punctstyle\xeCJK@bboxname @rglue@\xeCJK@lastpunct} + \zxjt@outputglue} + +%%------ add hook to \verbatim@font + +%%<*> \[no]jafamilyinverbatim +\let\jafamilyinverbatim\zxjt@jafamilyinverbatimtrue +\let\nojafamilyinverbatim\zxjt@jafamilyinverbatimfalse + +%% \zxjt@verbatim@font +\def\zxjt@verbatim@font{ + \ifnum\XeTeXinterchartokenstate>\z@ + \XeTeXinterchartokenstate\z@ + \ifzxjt@jafamilyinverbatim + \CJKfamily{tt}\xeCJK@setfont + \fi + \fi} +\AtBeginDocument{ + \g@addto@macro\verbatim@font{\zxjt@verbatim@font} +} + +%%------ raw input + +%%<*> \textrawja/\textrawen +\DeclareRobustCommand\textrawja{ + \zxjt@text@raw{\zxjt@setCJKfont}} +\DeclareRobustCommand\textrawen{ + \zxjt@text@raw{\relax}} +\def\zxjt@text@raw#1#2{ + \leavevmode\zxjt@boundary{\XeTeXinterchartokenstate\z@#1#2} + \zxjt@boundary} + +%%<*> rawjatext/rawentext (environment) +\newenvironment{rawjatext} + {\zxjt@raw@text{\zxjt@setCJKfont}}{\zxjt@boundary} +\newenvironment{rawentext} + {\zxjt@raw@text{\relax}}{\zxjt@boundary} +\def\zxjt@raw@text#1{ + \zxjt@boundary\XeTeXinterchartokenstate\z@#1} + +%% \zxjt@boundary +\def\zxjt@boundary{\ifhmode\hbox{}\fi} + +%% \zxjt@setCJKfont +% Sometimes needed instead of \xeCJK@setfont. +\def\zxjt@setCJKfont{ + \csname xeCJK@font@\xeCJK@family\endcsname} + +%%------ other adaptations + +% make U+2015 behave similarly as U+2014 +\xeCJK@postPunct{20}{15} +\expandafter\def\csname xeCJK@specialpunct^^^^2015\endcsname{} + +%% fix to \xeCJK@@checksingle +\def\zxjt@xeCJK@@checksingle{% + \ifcat ^^^^3002\@let@token \expandafter\xeCJK@@@checksingle + \else \expandafter\xeCJK@setcurrentchar@i \fi} +\ifx\xeCJK@@checksingle\zxjt@xeCJK@@checksingle +\def\xeCJK@@checksingle{% + \ifcat ^^^^3002\noexpand\@let@token \expandafter\xeCJK@@@checksingle + \else \expandafter\xeCJK@setcurrentchar@i \fi} +\fi +\let\zxjt@xeCJK@@checksingle\@undefined + +%%------ initial settings + +% cooperation with BXJS classes +\ifx\jsDocClass\@undefined\else +\edef\zxjt@scale{\jsScale} +%\let\jsInhibitGlue\inhibitglue +\fi + +% drivers for \UI & \Ux +\def\zxjt@Ux{\char\bxUcv} +\def\zxjt@Uxh#1{\char"#1 } +\def\zxjt@UI{{\xeCJK@setfont\char\bxUcv}} +\def\zxjt@UIh#1{{\xeCJK@setfont\char"#1 }} + +% when option 'default' is set +\ifzxjt@default + \zxjapanesestyle +\fi + +% verbatim font +\jafamilyinverbatim + +%%------ backward compatibility + +\def\zxjt@compat#1#2{\ifx#1\@undefined \let#1#2\fi} +\zxjt@compat\xeCJKjapanesestyle\zxjapanesestyle +\zxjt@compat\xeCJKusejapaneseparameters\zxusejapaneseparameters +\zxjt@compat\xeCJKuseoriginalparameters\zxuseoriginalparameters +\zxjt@compat\CJKinhibitglue\inhibitglue + +%%------ all done +\endlinechar `\^^M +\endinput +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\iffalse%% + +\cs_new:Nn \zxjt_get_CJKfont_info: + { + \tl_clear:N \l_CJKfont_info_tl + \int_compare:nNnT { \XeTeXcharclass "5B57 } = { \c_zxjt_CJK_class_int } + { + \group_begin: + \int_set:Nn \XeTeXinterchartokenstate { 1 } + \XeTeXcharclass `\? = \c_zxjt_Default_class_int + \XeTeXinterchartoks \c_zxjt_CJK_class_int + \c_zxjt_Default_class_int = { \scan_stop: } + \XeTeXinterchartoks \c_zxjt_Default_class_int + \c_zxjt_CJK_class_int = { \scan_stop: } + \cs_show:c { xeCJK@rm/m/n/10 } + \hbox_set:Nn \l_tmpa_box + { + ^^^^5b57 ?\bxDebug{\the\font/\f@family} + \cs_gset:Npn \g_zxjt_tmpa_tl + { { \f@encoding } { \f@family } } + ? ^^^^5b57 + }\box_show:N \l_tmpa_box + \group_end: + \cs_set_eq:NN \l_zxjt_CJKfont_info_tl \g_zxjt_tmpa_tl + } + } + +\fi%% +%% EOF diff --git a/Master/tlpkg/bin/tlpkg-ctan-check b/Master/tlpkg/bin/tlpkg-ctan-check index 45aa5a8824d..082b8f5e7a3 100755 --- a/Master/tlpkg/bin/tlpkg-ctan-check +++ b/Master/tlpkg/bin/tlpkg-ctan-check @@ -466,7 +466,7 @@ my @TLP_working = qw( xwatermark xyling xypic xypic-tut-pt xytree yafoot yagusylo yannisgr yax ydoc yfonts york-thesis youngtab yplan ytableau zed-csp zhnumber ziffer zhmetrics zhspacing zwgetfdate zwpagelayout - zxjafbfont zxjafont + zxjafbfont zxjafont zxjatype ); diff --git a/Master/tlpkg/tlpsrc/collection-langcjk.tlpsrc b/Master/tlpkg/tlpsrc/collection-langcjk.tlpsrc index 1422d69a059..852e13387c9 100644 --- a/Master/tlpkg/tlpsrc/collection-langcjk.tlpsrc +++ b/Master/tlpkg/tlpsrc/collection-langcjk.tlpsrc @@ -42,3 +42,4 @@ depend zhnumber depend zhspacing depend zxjafbfont depend zxjafont +depend zxjatype diff --git a/Master/tlpkg/tlpsrc/zxjatype.tlpsrc b/Master/tlpkg/tlpsrc/zxjatype.tlpsrc new file mode 100644 index 00000000000..e69de29bb2d -- cgit v1.2.3