summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/xcjk2uni/xCJK2uni.dtx
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2014-04-29 21:51:02 +0000
committerKarl Berry <karl@freefriends.org>2014-04-29 21:51:02 +0000
commit30e11d658c0df10f5739383e0e4e92e6e440c617 (patch)
tree763f84c94693e8bbac07e3587831839238bba67e /Master/texmf-dist/source/latex/xcjk2uni/xCJK2uni.dtx
parent3603d66ecbc122dc0b287c5cebde72beafeba67c (diff)
xcjk2uni (29apr14)
git-svn-id: svn://tug.org/texlive/trunk@33752 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex/xcjk2uni/xCJK2uni.dtx')
-rw-r--r--Master/texmf-dist/source/latex/xcjk2uni/xCJK2uni.dtx114
1 files changed, 95 insertions, 19 deletions
diff --git a/Master/texmf-dist/source/latex/xcjk2uni/xCJK2uni.dtx b/Master/texmf-dist/source/latex/xcjk2uni/xCJK2uni.dtx
index c6913b46d74..37525db94dd 100644
--- a/Master/texmf-dist/source/latex/xcjk2uni/xCJK2uni.dtx
+++ b/Master/texmf-dist/source/latex/xcjk2uni/xCJK2uni.dtx
@@ -72,10 +72,8 @@ 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
"xelatex xCJK2uni.dtx" will typeset the documentation.
-You should copy "UBg5plus.sfd", "UBig5.sfd", "UGB.sfd", "UGBK.sfd",
-"UJIS.sfd", and "UKS.sfd" from main texmf directory to current directory.
-Then run "latex xCJK2uni-make.ltx" to generate some definition files and
-/ToUnicode mapping files.
+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.
@@ -152,14 +150,14 @@ and some specific Chinese Simplified fonts.
%<*driver|package|make>
\NeedsTeXFormat{LaTeX2e}
\RequirePackage{expl3}
-\GetIdInfo$Id: xCJK2uni.dtx 512 2013-08-17 15:03:03Z sobenlee $
+\GetIdInfo$Id: xCJK2uni.dtx 643 2014-04-29 09:36:22Z sobenlee $
{Convert CJK character to Unicode.}
%<*driver>
\ProvidesExplFile{\ExplFileName.\ExplFileExtension}
%</driver>
%<package>\ProvidesExplPackage{\ExplFileName}
%<make>\ProvidesExplFile{xCJK2uni-make.ltx}
- {\ExplFileDate}{0.1}{\ExplFileDescription}
+ {\ExplFileDate}{0.2}{\ExplFileDescription}
%<*driver>
\ExplSyntaxOff
%</driver>
@@ -208,7 +206,7 @@ and some specific Chinese Simplified fonts.
%</driver>
% \fi
%
-% \CheckSum{569}
+% \CheckSum{653}
% \GetFileInfo{\jobname.dtx}
%
% \title{\bfseries\pkg{xCJK2uni} 宏包}
@@ -344,7 +342,7 @@ and some specific Chinese Simplified fonts.
\int_set_eq:Nc \l_@@_gap_end_int { c_@@_ #1 _gap_end_int }
\int_set_eq:Nc \l_@@_plane_int { c_@@_ #1 _plane_int }
\cs_if_exist:cF { CJKtu_ #1 _sfd_map:nn }
- { \group_begin: \ExplSyntaxOn \file_input:n { xCJK2uni-#2.def } \group_end: }
+ { \group_begin: \file_input:n { xCJK2uni-#2.def } \group_end: }
\cs_set_eq:Nc \CJKtu_sfd_map:nn { CJKtu_ #1 _sfd_map:nn }
}
% \end{macrocode}
@@ -418,9 +416,9 @@ and some specific Chinese Simplified fonts.
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}[internal]{\@@_bookmarks_hook:}
+% \begin{macro}[internal]{\CJKtu_bookmarks_hook:}
% \begin{macrocode}
-\cs_new_protected_nopar:Npn \@@_bookmarks_hook:
+\cs_new_protected_nopar:Npn \CJKtu_bookmarks_hook:
{
\cs_set_eq:NN ^^7f \@@_byte:Nwnw
\cs_set_eq:NN \CJK@XX \CJKtu_byte:NN
@@ -534,7 +532,7 @@ and some specific Chinese Simplified fonts.
\cs_if_free:NF \pdfstringdefDisableCommands
{
\hypersetup { CJKbookmarks = false }
- \pdfstringdefDisableCommands { \@@_bookmarks_hook: }
+ \pdfstringdefDisableCommands { \CJKtu_bookmarks_hook: }
}
}
}
@@ -565,13 +563,70 @@ and some specific Chinese Simplified fonts.
% \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
+ {
+ \msg_fatal:nnx { xCJK2uni } { shell-escape }
+ {
+ \luatex_if_engine:TF { LuaLaTeX }
+ {
+ \pdftex_if_engine:TF
+ { \if_case:w \pdftex_pdfoutput:D LaTeX \else: pdfLaTeX \fi: }
+ { XeLaTeX }
+ }
+ }
+ }
+% \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_get_str:NN \g_@@_sfd_ior \g_@@_path_str
+ \ior_close:N \g_@@_sfd_ior
+ }
+ { \msg_fatal:nnnn { xCJK2uni } { file-not-found } { GBK } { UGBK.sfd } }
+ }
+% \end{macrocode}
+%
+% \begin{macrocode}
+\tl_if_blank:oTF { \g_@@_path_str }
+ { \msg_fatal:nnnn { xCJK2uni } { file-not-found } { GBK } { UGBK.sfd } }
+ {
+ \seq_set_split:NnV \l_tmpa_seq { / } \g_@@_path_str
+ \seq_pop_right:NN \l_tmpa_seq \g_@@_path_str
+ \tl_gset:Nx \g_@@_path_str { \seq_use:Nn \l_tmpa_seq { / } }
+ }
+% \end{macrocode}
+%
+% \begin{macrocode}
\tl_const:Nx \c_@@_hash_str { \iow_char:N \# }
\tl_const:Nx \c_@@_lbrace_str { \iow_char:N \{ }
\tl_const:Nx \c_@@_rbrace_str { \iow_char:N \} }
\tl_const:Nx \c_@@_backslash_str { \iow_char:N \\ }
\tl_const:Nx \c_@@_indent_str
{ \c_catcode_other_space_tl \c_catcode_other_space_tl }
-\ior_new:N \g_@@_sfd_ior
\iow_new:N \g_@@_sfd_map_iow
\iow_new:N \g_@@_sfd_cmap_iow
\seq_new:N \l_@@_sfd_plane_seq
@@ -598,7 +653,7 @@ and some specific Chinese Simplified fonts.
\cs_new_protected_nopar:Npn \@@_write_file:nnn #1#2#3
{
\group_begin:
- \file_path_include:n { sfd/ }
+ \file_path_include:n { \g_@@_path_str / }
\ior_open:NnTF \g_@@_sfd_ior { #3.sfd }
{
\group_end:
@@ -630,11 +685,6 @@ and some specific Chinese Simplified fonts.
\msg_critical:nnxx { xCJK2uni } { file-not-found } {#1} { #3.sfd }
}
}
-\msg_new:nnn { xCJK2uni } { file-not-found }
- {
- SFD file~`#2'~for~encoding~`#1'~not~found.\\
- xCJK2uni~will~not~work!
- }
% \end{macrocode}
% \end{macro}
%
@@ -682,7 +732,7 @@ and some specific Chinese Simplified fonts.
\iow_now:Nx \g_@@_sfd_map_iow
{
\c_@@_indent_str \c_@@_indent_str \c_@@_indent_str
- \seq_use:Nnnn \l_@@_sfd_line_seq { \or: } { \or: } { \or: }
+ \seq_use:Nn \l_@@_sfd_line_seq { \or: }
\token_to_str:N \or:
}
}
@@ -787,6 +837,7 @@ and some specific Chinese Simplified fonts.
%%~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 }
\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
@@ -801,6 +852,31 @@ 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 643 2014-04-29 09:36:22Z 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