From be88ab29c165e6b16091443c3e8f36c4febf8a27 Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Wed, 22 Jan 2020 03:02:40 +0000 Subject: CTAN sync 202001220302 --- language/japanese/zxjatype/zxjatype.sty | 99 +++++++++++++++++++++++++-------- 1 file changed, 77 insertions(+), 22 deletions(-) (limited to 'language/japanese/zxjatype/zxjatype.sty') diff --git a/language/japanese/zxjatype/zxjatype.sty b/language/japanese/zxjatype/zxjatype.sty index dba68ee443..d507d99a77 100644 --- a/language/japanese/zxjatype/zxjatype.sty +++ b/language/japanese/zxjatype/zxjatype.sty @@ -1,7 +1,7 @@ %% %% This is file 'zxjatype.sty'. %% -%% Copyright (c) 2018 Takayuki YATO (aka. "ZR") +%% Copyright (c) 2009-2020 Takayuki YATO (aka. "ZR") %% GitHub: https://github.com/zr-tex8r %% Twitter: @zr_tex8r %% @@ -10,11 +10,12 @@ %% package declaration \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{zxjatype}[2018/05/03 v0.6c ZX Japanese typeset] +\ProvidesPackage{zxjatype}[2020/01/22 v0.7 ZX Japanese typeset] \RequirePackage{ifxetex}\RequireXeTeX %% code guards \edef\zxjt@restore@codes{% + \catcode33=\the\catcode33% \catcode34=\the\catcode34% \catcode39=\the\catcode39% \catcode43=\the\catcode43% @@ -24,11 +25,13 @@ \catcode58=\the\catcode58% \catcode60=\the\catcode60% \catcode62=\the\catcode62% - \catcode63=\the\catcode63% \catcode94=\the\catcode94% \catcode96=\the\catcode96% + \catcode124=\the\catcode124% + \catcode126=\the\catcode126% \endlinechar=\the\endlinechar% \relax} +\catcode33=12 % \catcode34=12 % <"> \catcode39=12 % <'> \catcode43=12 % <+> @@ -38,9 +41,10 @@ \catcode58=12 % <:> \catcode60=12 % <<> \catcode62=12 % <>> -\catcode63=12 % \catcode94=7 % <^> \catcode96=12 % <`> +\catcode124=12 % <|> +\catcode126=13 % <~> \AtEndOfPackage{% \zxjt@restore@codes \let\zxjt@restore@codes\@undefined @@ -49,7 +53,7 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % BOOTSTRAP CODE -% +% %% definitions \def\zxjt@pkgname{zxjatype} @@ -58,7 +62,8 @@ \newif\ifzxjt@adjustcharclass \newif\ifzxjt@kanakinsoku \newif\ifzxjt@useinhibitglue -\providecommand*\bxDebug{\@gobble} +\newif\ifzxjt@prefercjk +\providecommand\bxDebug[1]{} %% process options \DeclareOption{default}{\zxjt@defaulttrue} @@ -76,6 +81,8 @@ \DeclareOption{nokanakinsoku}{\zxjt@kanakinsokufalse} \DeclareOption{useinhibitglue}{\zxjt@useinhibitgluetrue} \DeclareOption{nouseinhibitglue}{\zxjt@useinhibitgluefalse} +\DeclareOption{prefercjk}{\zxjt@prefercjktrue} +\DeclareOption{noprefercjk}{\zxjt@prefercjkfalse} % \DeclareOption*{\PassOptionsToPackage{\CurrentOption}{xeCJK}} \ExecuteOptions{default,CJKchecksingle,adjustcharclass} @@ -90,6 +97,10 @@ \let\zxjt@go@to@main\@empty }{% \bxDebug{xeCJK v2.x found.}% + \PackageWarningNoLine\zxjt@pkgname + {!!!!!!!! IMPORTANT !!!!!!!!\MessageBreak + Support for xeCJK v2.x will be *dropped*\MessageBreak + in the near future} \long\def\zxjt@go@to@main#1\zxjt@begin@old@code{}% } @@ -130,6 +141,11 @@ \ifzxjt@useinhibitglue \bool_set_true:N \l__zxjt_useinhibitglue_bool \fi +%% \l__zxjt_prefercjk_bool +\bool_new:N \l__zxjt_prefercjk_bool +\ifzxjt@prefercjk + \bool_set_true:N \l__zxjt_prefercjk_bool +\fi %%-------------------------------------- error messages @@ -150,8 +166,8 @@ } \__zxjt_msg_new:nn { jafamilyinverbatim-disabled } { - \token_to_str:N \(no)jafamilyinverbatim \c_space_tl - ~is~disabled~in~this~version. + \token_to_str:N \( no)jafamilyinverbatim~ + is~disabled~in~this~version. } \__zxjt_msg_new:nn { CJKfam-failed } { @@ -181,9 +197,9 @@ % (A mere \scan_stop: suffices?) \cs_new:Nn \__zxjt_boundary: { - \ifhmode + \if_mode_horizontal: \hbox:n {} - \fi + \fi: } %% \__zxjt_leavevmode: @@ -259,7 +275,7 @@ \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_gremove_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 } @@ -332,7 +348,7 @@ \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 + \prop_gput:NnV \g__zxjt_CJKfam_prop { #1 } \g__zxjt_onefam_info_tl } } @@ -360,6 +376,8 @@ % The encoding used for CJK-families. \tl_new:N \g__zxjt_encoding_tl \tl_gset:Nn \g__zxjt_encoding_tl { EU1 } +\cs_if_exist:NT \g_fontspec_encoding_tl + { \tl_set_eq:NN \g__zxjt_encoding_tl \g_fontspec_encoding_tl } %% \__zxjt_use_CJKfam: % Switches the NFSS family to the family corresponding to the current CJK- @@ -501,6 +519,7 @@ "30E7, "30EE, "30F5, "30F6, "30FC, "31F0, "31F1, "31F2, "31F3, "31F4, "31F5, "31F6, "31F7, "31F8, "31F9, "31FA, "31FB, "31FC, "31FD, "31FE, "31FF, "309D, "309E, "30FD, "30FE, + "1B150, "1B151, "1B152, "1B164, "1B165, "1B166, "1B167, } \xeCJKDeclareCharClass { FullRight } { @@ -518,6 +537,36 @@ \xeCJKsetup { LongPunct+ = { ^^^^2015 } } } +\bool_if:NT \l__zxjt_prefercjk_bool + { + \clist_map_inline:nn + { + "2002, "2010, "2011, "2016, "201A, "201E, "2020, "2021, + "2022, "2030, "2032, "2033, "2039, "203A, "203B, "203C, + "203E, "203F, "2042, "2044, "2047, "2048, "2049, "2051 + } + { \XeTeXcharclass #1 = \c__zxjt_CJK_class_int } + \clist_map_inline:nn + { + { "2070, "243F }, + { "2460, "27BF }, + { "2900, "29FF }, + { "2B00, "2BFF }, + { "FE50, "FE6F }, + { "1F100, "1F1DF } + } + { + \clist_set:Nn \l_tmpa_clist {#1} + \int_step_inline:nnn + { \clist_item:Nn \l_tmpa_clist { 1 } } + { \clist_item:Nn \l_tmpa_clist { 2 } } + { + \int_compare:nNnF { \XeTeXcharclass ##1 } = { \c__zxjt_CJK_class_int } + { \XeTeXcharclass ##1 = \c__zxjt_CJK_class_int } + } + } + } + %%-------------------------------------- public commands %%<*> \setjamainfont / \setjasansfont / \setjamonofont @@ -571,23 +620,29 @@ } } -%% \__zxjt_scale_tl +%% \l__zxjt_scale_tl % The scale value to be applied to CJK fonts. -\tl_new:N \__zxjt_scale_tl +\tl_new:N \l__zxjt_scale_tl %% \l__zxjt_scale_spec_tl \tl_new:N \l__zxjt_scale_spec_tl +%%<+> \zxjatypeJaScale +% The scale value to be applied to CJK fonts. +% (Same as \l__zxjt_scale_tl, but developer-level public.) + %%<*> \setjafontscale{} -%% Sets the value of \__zxjt_scale_tl, which defaults to 1. +%% Sets the value of \l__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_set:Nn \l__zxjt_scale_tl { #1 } + \tl_set_eq:NN \zxjatypeJaScale \l__zxjt_scale_tl + \tl_set_eq:cN { __zxjt_scale_tl } \l__zxjt_scale_tl + \tl_if_blank:VTF \l__zxjt_scale_tl { \tl_clear:N \l__zxjt_scale_spec_tl } - { + { \tl_set:Nn \l__zxjt_scale_spec_tl - { Scale = \__zxjt_scale_tl , } + { Scale = \l__zxjt_scale_tl , } } } @@ -616,11 +671,11 @@ { \cs_set:Npn \> { - \ifmmode + \if_mode_math: \mskip \medmuskip - \else + \else: \CJKecglue \scan_stop: - \fi + \fi: } } } -- cgit v1.2.3