From a773f956133dd46fdbb8d5c972ae248089cbc1b0 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Tue, 24 Jun 2014 18:04:08 +0000 Subject: xcjk2uni (20jun14) git-svn-id: svn://tug.org/texlive/trunk@34382 c570f23f-e606-0410-a88d-b1316a301751 --- .../texmf-dist/source/latex/xcjk2uni/xCJK2uni.dtx | 242 ++++++++++++--------- .../texmf-dist/source/latex/xcjk2uni/xCJK2uni.ins | 71 +++++- 2 files changed, 198 insertions(+), 115 deletions(-) (limited to 'Master/texmf-dist/source/latex/xcjk2uni') diff --git a/Master/texmf-dist/source/latex/xcjk2uni/xCJK2uni.dtx b/Master/texmf-dist/source/latex/xcjk2uni/xCJK2uni.dtx index b9cbc4eaff0..db5f14cf178 100644 --- a/Master/texmf-dist/source/latex/xcjk2uni/xCJK2uni.dtx +++ b/Master/texmf-dist/source/latex/xcjk2uni/xCJK2uni.dtx @@ -28,7 +28,8 @@ This work consists of the file xCJK2uni.dtx, and the derived files xCJK2uni.pdf, xCJK2uni.sty, xCJK2uni.ins, - xCJK2uni-make.ltx, + xCJK2uni-make.tex, + xCJK2uni-sfd.def, xCJK2uni-UBg5plus.def, xCJK2uni-UBig5.def, xCJK2uni-UGB.def, @@ -70,10 +71,8 @@ The package is supplied in dtx format and as a pre-extracted zip file, xCJK2uni.tds.zip. The later is most convenient for most users: simply unzip this in your local texmf directory and run texhash to update the database of file locations. If you want to unpack the dtx yourself, -running "xetex xCJK2uni.dtx" will extract the package whereas +running "luatex xCJK2uni.dtx" will extract the package whereas "xelatex xCJK2uni.dtx" will typeset the documentation. -Then run "lualatex --shell-escape xCJK2uni-make.ltx" to generate some -definition files and /ToUnicode mapping files. The package requires LaTeX3 support as provided in the l3kernel. It is available on CTAN as ready-to-install zip files. @@ -119,7 +118,8 @@ and some specific Chinese Simplified fonts. and the derived files xCJK2uni.pdf, xCJK2uni.sty, xCJK2uni.ins, - xCJK2uni-make.ltx, + xCJK2uni-make.tex, + xCJK2uni-sfd.def, xCJK2uni-UBg5plus.def, xCJK2uni-UBig5.def, xCJK2uni-UGB.def, @@ -130,16 +130,61 @@ and some specific Chinese Simplified fonts. README. \endpostamble -\generate{ - \usedir{source/latex/xcjk2uni} - \file{\jobname.ins}{\from{\jobname.dtx}{install}} - \usedir{tex/latex/xcjk2uni} - \file{\jobname.sty}{\from{\jobname.dtx}{package}} - \file{\jobname-make.ltx}{\from{\jobname.dtx}{make}} - \nopreamble\nopostamble - \usedir{doc/latex/xcjk2uni} - \file{README.txt}{\from{\jobname.dtx}{readme}} -} +\declarepostamble\emptypostamble +\endpostamble + +\generate + { + \usedir{source/latex/xcjk2uni} + \file{xCJK2uni.ins} {\from{\jobname.dtx}{install}} + \usedir{tex/latex/xcjk2uni} + \file{xCJK2uni.sty} {\from{\jobname.dtx}{package}} + \file{xCJK2uni-make.tex} {\from{\jobname.dtx}{make}} + \nopreamble\nopostamble + \usedir{doc/latex/xcjk2uni} + \file{README.txt} {\from{\jobname.dtx}{readme}} + } + +\let\input\@@input +\def\CJKtuend{\ExplSyntaxOff} +\input xCJK2uni-make % +\let\input\skip@input + +\generate + { + \usedir{tex/latex/xcjk2uni} + \usepostamble\emptypostamble + \file{xCJK2uni-UBig5.def} + { + \from{\jobname.dtx} {def,Bg5} + \from{xCJK2uni-sfd.def} {Bg5} + } + \file{xCJK2uni-UBg5plus.def} + { + \from{\jobname.dtx} {def,Bg5+} + \from{xCJK2uni-sfd.def} {Bg5+} + } + \file{xCJK2uni-UGB.def} + { + \from{\jobname.dtx} {def,GB} + \from{xCJK2uni-sfd.def} {GB} + } + \file{xCJK2uni-UGBK.def} + { + \from{\jobname.dtx} {def,GBK} + \from{xCJK2uni-sfd.def} {GBK} + } + \file{xCJK2uni-UJIS.def} + { + \from{\jobname.dtx} {def,JIS} + \from{xCJK2uni-sfd.def} {JIS} + } + \file{xCJK2uni-UKS.def} + { + \from{\jobname.dtx} {def,KS} + \from{xCJK2uni-sfd.def} {KS} + } + } \endbatchfile % @@ -147,21 +192,38 @@ and some specific Chinese Simplified fonts. \fi % % -%<*driver|package|make> +%<*driver|package|make|def> +%<*!(make|def)> \NeedsTeXFormat{LaTeX2e} \RequirePackage{expl3} -\GetIdInfo$Id: xCJK2uni.dtx 655 2014-05-12 15:25:37Z sobenlee $ +% +%\input expl3-generic % +\GetIdInfo$Id: xCJK2uni.dtx 691 2014-06-20 09:20:07Z sobenlee $ {Convert CJK character to Unicode.} %<*driver> \ProvidesExplFile{\ExplFileName.\ExplFileExtension} % %\ProvidesExplPackage{\ExplFileName} -%\ProvidesExplFile{xCJK2uni-make.ltx} - {\ExplFileDate}{0.3}{\ExplFileDescription} +%\ExplSyntaxOn +%\cs_if_exist:NF \ProvidesExplFile +% { +% \group_begin: +% \cs_set_nopar:Npn \ProvidesExplFile #1#2#3#4 +% { \iow_log:x { File:~#1~#2~v#3~#4 } } +% \exp_after:wN \group_end: +% } +%\ProvidesExplFile{xCJK2uni-make.tex} +%\ProvidesExplFile{xCJK2uni-UBig5.def} +%\ProvidesExplFile{xCJK2uni-UBg5plus.def} +%\ProvidesExplFile{xCJK2uni-UGB.def} +%\ProvidesExplFile{xCJK2uni-UGBK.def} +%\ProvidesExplFile{xCJK2uni-UJIS.def} +%\ProvidesExplFile{xCJK2uni-UKS.def} + {\ExplFileDate}{0.4}{\ExplFileDescription} %<*driver> \ExplSyntaxOff % -% +% % %<*driver> \documentclass[full,a4paper]{l3doc} @@ -171,8 +233,11 @@ and some specific Chinese Simplified fonts. \hypersetup{pdfstartview=FitH} \geometry{includemp,hmargin={0mm,15mm},vmargin=15mm,footskip=7mm} \linespread{1.1} -\setmainfont[Ligatures=TeX]{TeX Gyre Pagella} -\setmonofont{CMU Typewriter Text} +\setmainfont{TeX Gyre Pagella} +\setsansfont{CMU Sans Serif} +\setmonofont[ + UprightFont=* Light, BoldFont=* Bold, + SlantedFont=* Light Oblique]{CMU Typewriter Text} \setCJKmainfont[BoldFont=Adobe Heiti Std,ItalicFont=Adobe Kaiti Std]{Adobe Song Std} \setCJKmonofont{Adobe Kaiti Std} \xeCJKsetup{PunctStyle=kaiming} @@ -207,7 +272,7 @@ and some specific Chinese Simplified fonts. % % \fi % -% \CheckSum{655} +% \CheckSum{615} % \GetFileInfo{\jobname.dtx} % % \title{\bfseries\pkg{xCJK2uni} 宏包} @@ -523,22 +588,26 @@ and some specific Chinese Simplified fonts. % \end{macro} % % \begin{macrocode} -\cs_if_exist_use:NTF \hypersetup { { unicode } } - { \PassOptionsToPackage { unicode } { hyperref } } -\AtBeginDocument +\cs_if_exist_use:NTF \hypersetup { { unicode , CJKbookmarks = false } } + { \PassOptionsToPackage { unicode , CJKbookmarks = false } { hyperref } } +\msg_new:nnn { xCJK2uni } { UTF-8-encoding } + { It~is~not~necessary~to~load~xCJK2uni~in~UTF-8~encoding. } +\tl_if_exist:NF \pdfstringdefPreHook { \tl_new:N \pdfstringdefPreHook } +\@ifpackageloaded { CJKutf8 } + { \msg_warning:nn { xCJK2uni } { UTF-8-encoding } } { - \@ifpackageloaded { CJKutf8 } - { \msg_warning:nn { xCJK2uni } { UTF-8-encoding } } + \cs_new_eq:NN \CJKtu@bookmarks@hook \CJKtu_bookmarks_hook: + \tl_gput_right:Nn \pdfstringdefPreHook { \CJKtu@bookmarks@hook } + \AtBeginDocument { - \cs_if_free:NF \pdfstringdefDisableCommands + \@ifpackageloaded { CJKutf8 } { - \hypersetup { CJKbookmarks = false } - \pdfstringdefDisableCommands { \CJKtu_bookmarks_hook: } + \cs_gset_eq:NN \CJKtu@bookmarks@hook \scan_stop: + \msg_warning:nn { xCJK2uni } { UTF-8-encoding } } + { \cs_if_exist_use:NT \hypersetup { { CJKbookmarks = false } } } } } -\msg_new:nnn { xCJK2uni } { UTF-8-encoding } - { It~is~not~necessary~to~load~xCJK2uni~in~UTF-8~encoding. } % \end{macrocode} % % \begin{macro}{\useCJKencmap,\CJKchartouni,\CJKsfdtouni} @@ -549,8 +618,23 @@ and some specific Chinese Simplified fonts. % \end{macrocode} % \end{macro} % +% \begin{macro}[internal]{\@@_initial:N} % \begin{macrocode} -\useCJKencmap { GBK } +\cs_new_protected_nopar:Npn \@@_initial:N #1 + { + \tl_if_exist:NTF #1 + { + \prop_get:NxNTF \c_@@_sfd_prop {#1} \l_@@_sfd_tl + { \@@_enc_map:nn {#1} { \l_@@_sfd_tl } } + { \@@_use_enc_map:n { GBK } } + } + { \@@_use_enc_map:n { GBK } } + } +% \end{macrocode} +% \end{macro} +% +% \begin{macrocode} +\exp_args:Nc \@@_initial:N { CJK @ @ @ enc } % \end{macrocode} % % \begin{macrocode} @@ -564,50 +648,32 @@ and some specific Chinese Simplified fonts. % \end{macrocode} % % \begin{macrocode} -\luatex_if_engine:T - { \RequirePackage { pdftexcmds } } -% \end{macrocode} -% -% \begin{macrocode} \msg_new:nnn { xCJK2uni } { file-not-found } { SFD file~`#2'~for~encoding~`#1'~not~found.\\ xCJK2uni~will~not~work! } -\msg_new:nnn { xCJK2uni } { shell-escape } - { Please~call~`#1'~with~the~`--shell-escape'~option. } % \end{macrocode} % % \begin{macrocode} -\char_set_catcode_letter:N \@ -\int_compare:nNnF - { - \cs_if_exist_use:NF \pdf@shellescape - { \cs_if_exist_use:NF \shellescape { \pdfshellescape } } - } = \c_one +\ior_new:N \g_@@_sfd_ior +\tl_new:N \g_@@_path_str +\luatex_if_engine:TF { - \msg_fatal:nnx { xCJK2uni } { shell-escape } + \tl_gset:Nx \g_@@_path_str { - \luatex_if_engine:TF { LuaLaTeX } + \luatex_directlua:D { - \pdftex_if_engine:TF - { \if_case:w \pdftex_pdfoutput:D LaTeX \else: pdfLaTeX \fi: } - { XeLaTeX } + kpse.set_program_name("luatex") ~ + local ~ sfd = kpse.find_file("UGBK.sfd", "subfont~definition~files") ~ + if ~ sfd ~ then ~ + tex.write(sfd) ~ + end } } } -% \end{macrocode} -% -% \begin{macrocode} -\ior_new:N \g_@@_sfd_ior -\tl_new:N \g_@@_path_str -\tl_const:Nn \c_@@_cmd_tl { kpsewhich ~ UGBK.sfd } -\luatex_if_engine:TF - { \tl_gset:Nx \g_@@_path_str { \pdf@pipe { \c_@@_cmd_tl } } } { - \tex_immediate:D \tex_write:D 18 - { \c_@@_cmd_tl > \c_job_name_tl .aux } - \ior_open:NnTF \g_@@_sfd_ior { \c_job_name_tl .aux } + \ior_open:NnTF \g_@@_sfd_ior { |kpsewhich ~ UGBK.sfd } { \ior_get_str:NN \g_@@_sfd_ior \g_@@_path_str \ior_close:N \g_@@_sfd_ior @@ -664,8 +730,7 @@ and some specific Chinese Simplified fonts. { \group_end: \seq_clear:N \l_@@_sfd_plane_seq - \iow_open:Nn \g_@@_sfd_map_iow { xCJK2uni-#3.def } - \@@_write_sfd_map_header:nn {#1} {#3} + \@@_write_sfd_map_header:n {#1} \ior_str_map_inline:Nn \g_@@_sfd_ior { \str_if_eq:nnT {##1} { 00 ~ 0x0000_0x00FF } { \ior_map_break: } } \ior_str_map_inline:Nn \g_@@_sfd_ior @@ -674,14 +739,13 @@ and some specific Chinese Simplified fonts. { \ior_map_break:n { - \@@_write_sfd_map_trailer:n {#3} + \@@_write_sfd_map_trailer:n {#1} \@@_write_cmap_file:n {#2} } } { \@@_read_sfd_line:nnn {##1} {#1} {#2} } } \iow_close:N \g_@@_sfd_cmap_iow - \iow_close:N \g_@@_sfd_map_iow \ior_close:N \g_@@_sfd_ior \seq_clear:N \l_@@_sfd_plane_seq \seq_clear:N \l_@@_sfd_line_seq @@ -831,19 +895,15 @@ and some specific Chinese Simplified fonts. % \end{macrocode} % \end{macro} % -% \begin{macro}[internal]{\@@_write_sfd_map_header:nn} +% \begin{macro}[internal]{\@@_write_sfd_map_header:n} % \begin{macrocode} \group_begin: \char_set_catcode_other:N \% -\cs_new_protected_nopar:Npn \@@_write_sfd_map_header:nn #1#2 +\cs_new_protected_nopar:Npn \@@_write_sfd_map_header:n #1 { \iow_now:Nx \g_@@_sfd_map_iow { - %% \iow_newline: - %%~This~is~file~`xCJK2uni-#2.def',\iow_newline: - %%~generated~from~file~`#2.sfd'~by~`xCJK2uni-make.ltx'.\iow_newline: - %% \iow_newline: - \@@_identification:n { xCJK2uni-#2.def } + %<*#1> \iow_newline: \cs_new_nopar:cpn { ~ CJKtu_#1_sfd_map:nn ~ } ~ \c_@@_hash_str 1 \iow_newline: \c_@@_indent_str \c_@@_lbrace_str \iow_newline: \c_@@_indent_str \c_@@_indent_str @@ -858,31 +918,6 @@ and some specific Chinese Simplified fonts. % \end{macrocode} % \end{macro} % -% \begin{macro}[internal]{\@@_identification:n} -% \begin{macrocode} -\group_begin: -\char_set_catcode_space:n { 32 } -\tl_const:Nx \c_@@_svn_id_str - {\tl_to_str:n {$Id: xCJK2uni.dtx 655 2014-05-12 15:25:37Z sobenlee $}} -\group_end: -\cs_new_nopar:Npx \@@_identification:n #1 - { - \token_to_str:N \GetIdInfo \c_@@_svn_id_str - \iow_newline: - \c_@@_indent_str - \c_@@_lbrace_str Convert~CJK~character~to~Unicode. \c_@@_rbrace_str - \iow_newline: - \token_to_str:N \ProvidesExplFile \c_@@_lbrace_str #1 \c_@@_rbrace_str - \iow_newline: - \c_@@_indent_str - \c_@@_lbrace_str \token_to_str:N \ExplFileDate \c_@@_rbrace_str - \c_@@_lbrace_str 0.2 \c_@@_rbrace_str - \c_@@_lbrace_str \token_to_str:N \ExplFileDescription \c_@@_rbrace_str - \iow_newline: - } -% \end{macrocode} -% \end{macro} -% % \begin{macro}[internal]{\@@_write_sfd_map_trailer:n} % \begin{macrocode} \cs_new_protected_nopar:Npn \@@_write_sfd_map_trailer:n #1 @@ -892,8 +927,7 @@ and some specific Chinese Simplified fonts. \c_@@_indent_str \c_@@_indent_str \token_to_str:N \fi: \iow_newline: \c_@@_indent_str \c_@@_rbrace_str \iow_newline: - %% \iow_newline: - %%~End~of~file~`xCJK2uni-#1.def'. + % } } % \end{macrocode} @@ -937,7 +971,7 @@ and some specific Chinese Simplified fonts. { \iow_newline: endcmap \iow_newline: - CMapName~currentdict~/CMap defineresource~pop \iow_newline: + CMapName~currentdict~/CMap~defineresource~pop \iow_newline: end \iow_newline: end \iow_newline: \iow_newline: %%EndResource \iow_newline: @@ -949,12 +983,14 @@ and some specific Chinese Simplified fonts. % \end{macro} % % \begin{macrocode} +\iow_open:Nn \g_@@_sfd_map_iow { xCJK2uni-sfd.def } \prop_map_inline:Nn \c_@@_sfd_map_prop { \@@_write_file:nnn {#1} #2 } +\iow_close:N \g_@@_sfd_map_iow % \end{macrocode} % % \begin{macrocode} -\tex_end:D +\cs_if_exist_use:NF \CJKtuend { \tex_end:D } % \end{macrocode} % % \begin{macrocode} diff --git a/Master/texmf-dist/source/latex/xcjk2uni/xCJK2uni.ins b/Master/texmf-dist/source/latex/xcjk2uni/xCJK2uni.ins index 66450ecd8e2..4aadea83f18 100644 --- a/Master/texmf-dist/source/latex/xcjk2uni/xCJK2uni.ins +++ b/Master/texmf-dist/source/latex/xcjk2uni/xCJK2uni.ins @@ -45,7 +45,8 @@ and the derived files xCJK2uni.pdf, xCJK2uni.sty, xCJK2uni.ins, - xCJK2uni-make.ltx, + xCJK2uni-make.tex, + xCJK2uni-sfd.def, xCJK2uni-UBg5plus.def, xCJK2uni-UBig5.def, xCJK2uni-UGB.def, @@ -56,16 +57,61 @@ README. \endpostamble -\generate{ - \usedir{source/latex/xcjk2uni} - \file{\jobname.ins}{\from{\jobname.dtx}{install}} - \usedir{tex/latex/xcjk2uni} - \file{\jobname.sty}{\from{\jobname.dtx}{package}} - \file{\jobname-make.ltx}{\from{\jobname.dtx}{make}} - \nopreamble\nopostamble - \usedir{doc/latex/xcjk2uni} - \file{README.txt}{\from{\jobname.dtx}{readme}} -} +\declarepostamble\emptypostamble +\endpostamble + +\generate + { + \usedir{source/latex/xcjk2uni} + \file{xCJK2uni.ins} {\from{\jobname.dtx}{install}} + \usedir{tex/latex/xcjk2uni} + \file{xCJK2uni.sty} {\from{\jobname.dtx}{package}} + \file{xCJK2uni-make.tex} {\from{\jobname.dtx}{make}} + \nopreamble\nopostamble + \usedir{doc/latex/xcjk2uni} + \file{README.txt} {\from{\jobname.dtx}{readme}} + } + +\let\input\@@input +\def\CJKtuend{\ExplSyntaxOff} +\input xCJK2uni-make % +\let\input\skip@input + +\generate + { + \usedir{tex/latex/xcjk2uni} + \usepostamble\emptypostamble + \file{xCJK2uni-UBig5.def} + { + \from{\jobname.dtx} {def,Bg5} + \from{xCJK2uni-sfd.def} {Bg5} + } + \file{xCJK2uni-UBg5plus.def} + { + \from{\jobname.dtx} {def,Bg5+} + \from{xCJK2uni-sfd.def} {Bg5+} + } + \file{xCJK2uni-UGB.def} + { + \from{\jobname.dtx} {def,GB} + \from{xCJK2uni-sfd.def} {GB} + } + \file{xCJK2uni-UGBK.def} + { + \from{\jobname.dtx} {def,GBK} + \from{xCJK2uni-sfd.def} {GBK} + } + \file{xCJK2uni-UJIS.def} + { + \from{\jobname.dtx} {def,JIS} + \from{xCJK2uni-sfd.def} {JIS} + } + \file{xCJK2uni-UKS.def} + { + \from{\jobname.dtx} {def,KS} + \from{xCJK2uni-sfd.def} {KS} + } + } \endbatchfile %% @@ -73,7 +119,8 @@ %% and the derived files xCJK2uni.pdf, %% xCJK2uni.sty, %% xCJK2uni.ins, -%% xCJK2uni-make.ltx, +%% xCJK2uni-make.tex, +%% xCJK2uni-sfd.def, %% xCJK2uni-UBg5plus.def, %% xCJK2uni-UBig5.def, %% xCJK2uni-UGB.def, -- cgit v1.2.3