From 51119d11f3700a5be7da086dacad56dd219a5c90 Mon Sep 17 00:00:00 2001
From: Norbert Preining <norbert@preining.info>
Date: Tue, 22 Mar 2022 03:01:37 +0000
Subject: CTAN sync 202203220301

---
 language/japanese/zxjafont/zxjafont.sty | 117 +++++++++++++++-----------------
 1 file changed, 55 insertions(+), 62 deletions(-)

(limited to 'language/japanese/zxjafont/zxjafont.sty')

diff --git a/language/japanese/zxjafont/zxjafont.sty b/language/japanese/zxjafont/zxjafont.sty
index 7c297fd291..50da25a7bc 100644
--- a/language/japanese/zxjafont/zxjafont.sty
+++ b/language/japanese/zxjafont/zxjafont.sty
@@ -1,7 +1,7 @@
 %%
 %% This is file 'zxjafont.sty'.
 %%
-%% Copyright (c) 2009-2020 Takayuki YATO (aka. "ZR")
+%% Copyright (c) 2009-2022 Takayuki YATO (aka. "ZR")
 %%   GitHub:   https://github.com/zr-tex8r
 %%   Twitter:  @zr_tex8r
 %%
@@ -10,7 +10,7 @@
 
 %% package declaration
 \NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{zxjafont}[2020/02/24 v1.2]
+\ProvidesPackage{zxjafont}[2022/03/21 v1.3]
 \def\zxjf@pkgname{zxjafont}
 
 %% preparation
@@ -148,6 +148,7 @@
 \DeclareOption{noignorejatype}{\zxjf@ignore@jatypefalse}
 % 'expert'
 \DeclareOption{expert}{\zxjf@experttrue}
+\DeclareOption{noexpert}{\zxjf@expertfalse}
 % dummy options for compatibility with luatexja-preset
 \DeclareOption{match}{}% xeCJK always work as 'match' is on
 \DeclareOption{fontspec}{}% always on
@@ -180,7 +181,7 @@
   \PackageError\zxjf@pkgname
    {Preset name not specified}
    {You must give one of the following names as option.\MessageBreak
-    \space\space\zxjf@all@main@preset}
+    \zxjf@all@main@preset}
 \expandafter\endinput\fi\relax
 
 %% detect zxjatype/xeCJK
@@ -200,7 +201,7 @@
 %% check for 'threeweight'
 \unless\ifzxjf@fontspec@mw\ifzxjf@threeweight
   \PackageError\zxjf@pkgname
-   {Option 'threeweight' cannot be used, bebause\MessageBreak
+   {Option 'threeweight' cannot be used, because\MessageBreak
     your 'fontspec' is too old}
    {\@ehc}
   \zxjf@threeweightfalse
@@ -211,7 +212,7 @@
   % If zxjatype is used, try \zxjatypeJaScale, \zxjt@scale,
   % and \__zxjt_scale_tl.
   \ifnum\zxjf@jatype=\zxjf@jatype@@zxjatype
-    \ifdefined\zxjatypeJaScale \let\zxjf@scale\zxjatypeJaScale
+    \if\zxjf@isvalid{zxjatypeJaScale}\let\zxjf@scale\zxjatypeJaScale
     \else\if\zxjf@isvalid{zxjt@scale}\let\zxjf@scale\zxjt@scale
     \else\if\zxjf@isvalid{__zxjt_scale_tl}%
       \letcs\zxjf@scale{__zxjt_scale_tl}
@@ -246,14 +247,16 @@
   \unless\ifx\zxjf@feature\@empty
     ,\expandonce\zxjf@feature
   \fi}
-\bxDebug{zxjafont>>scale=\zxjf@scale/feat={\zxjf@whole@feature}/%
+\bxDebug{zxjafont>>feature={\zxjf@whole@feature}/%
   preset=\zxjf@main@preset/\zxjf@sub@preset}
 
 %--------------------------------------- font setup helpers
 
 %% \zxjf@font@set
-\zxjf@onlypreamble@def\zxjf@font@set#1#2{%
-  \noexpand#1[\expandonce\zxjf@whole@feature,#2]}
+\zxjf@onlypreamble@def\zxjf@font@set#1#2#3{%
+  \edef\zxjf@do{\noexpand#1[\expandonce\zxjf@whole@feature,#2]{#3}}%
+  \bxDebug{run:\meaning\zxjf@do}%
+  \zxjf@do}
 %% \zxjf@newfamily@gen\CSnewjafamily
 \@onlypreamble\zxjf@newfamily@gen\edef\zxjf@newfamily@gen{%
   \noexpand\zxjf@newfamily@gen@a
@@ -267,19 +270,19 @@
 
 %% \zxjf@setmainfont{<attributes>}{<fam_name>}, etc.
 \ifnum\zxjf@jatype=\zxjf@jatype@@xeCJK
-\edef\zxjf@setmainfont#1{\zxjf@font@set\setCJKmainfont{#1}}
-\edef\zxjf@setsansfont#1{\zxjf@font@set\setCJKsansfont{#1}}
-\edef\zxjf@setmonofont#1{\zxjf@font@set\setCJKmonofont{#1}}
+\def\zxjf@setmainfont{\zxjf@font@set\setCJKmainfont}
+\def\zxjf@setsansfont{\zxjf@font@set\setCJKsansfont}
+\def\zxjf@setmonofont{\zxjf@font@set\setCJKmonofont}
 \zxjf@newfamily@gen{\setCJKfamilyfont}
 \else\ifnum\zxjf@jatype=\zxjf@jatype@@zxjatype
-\edef\zxjf@setmainfont#1{\zxjf@font@set\setjamainfont{#1}}
-\edef\zxjf@setsansfont#1{\zxjf@font@set\setjasansfont{#1}}
-\edef\zxjf@setmonofont#1{\zxjf@font@set\setjamonofont{#1}}
+\def\zxjf@setmainfont{\zxjf@font@set\setjamainfont}
+\def\zxjf@setsansfont{\zxjf@font@set\setjasansfont}
+\def\zxjf@setmonofont{\zxjf@font@set\setjamonofont}
 \zxjf@newfamily@gen{\setjafamilyfont}
 \else
-\edef\zxjf@setmainfont#1{\zxjf@font@set\setmainfont{#1}}
-\edef\zxjf@setsansfont#1{\zxjf@font@set\setsansfont{#1}}
-\edef\zxjf@setmonofont#1{\zxjf@font@set\setmonofont{#1}}
+\def\zxjf@setmainfont{\zxjf@font@set\setmainfont}
+\def\zxjf@setsansfont{\zxjf@font@set\setsansfont}
+\def\zxjf@setmonofont{\zxjf@font@set\setmonofont}
 \edef\zxjf@newfamily#1#2{%
   \unexpanded{\zxjf@with@cs\newfontfamily}{#1family}%
       [\expandonce\zxjf@whole@feature,#2]}
@@ -287,63 +290,53 @@
 
 %--------------------------------------- preset japanese font mappings
 
-%% \zxjf@declare@preset{<name>}{<text>}, etc.
+%% \zxjf@declare@preset{<name>}{<text>}
 \zxjf@onlypreamble@def\zxjf@declare@preset#1{%
   \zxjf@with@cs\zxjf@onlypreamble@def{zxjf@the@preset@#1}}
 \zxjf@declare@preset{}{}
-\ifzxjf@fontspec@mw %TODO: temporary fix
+%% \zxjf@uniweight{<mincho>}{<gothic>}{<feats>}
 \zxjf@onlypreamble@def\zxjf@uniweight#1#2#3{%
-  \zxjf@setmainfont{#3,FontFace={bx}{n}{#2},BoldFont=#2}{#1}%
-  \zxjf@setsansfont{#3,FontFace={bx}{n}{#2},BoldFont=#2}{#2}%
-  \zxjf@setmonofont{#3,FontFace={bx}{n}{#2},BoldFont=#2}{#2}}
+  \zxjf@setmainfont{#3,\zxjf@BoldFont{#2}}{#1}%
+  \zxjf@setsansfont{#3,\zxjf@BoldFont{#2}}{#2}%
+  \zxjf@setmonofont{#3,\zxjf@BoldFont{#2}}{#2}}
+%% \zxjf@multiweight{ML}{MM}{MB}{GM}{GB}{GE}{GU}{<feats>}
 \zxjf@onlypreamble@def\zxjf@multiweight#1#2#3#4#5#6#7#8{%
   \ifzxjf@bold
-    \zxjf@setmainfont{#8,FontFace={bx}{n}{#5},BoldFont=#5}{#2}%
-    \zxjf@setsansfont{#8,FontFace={bx}{n}{#5},BoldFont=#5}{#5}%
-    \zxjf@setmonofont{#8,FontFace={bx}{n}{#5},BoldFont=#5}{#5}%
+    \zxjf@setmainfont{#8,\zxjf@BoldFont{#5}}{#2}%
+    \zxjf@setsansfont{#8,\zxjf@BoldFont{#5}}{#5}%
+    \zxjf@setmonofont{#8,\zxjf@BoldFont{#5}}{#5}%
   \else\ifzxjf@oneweight
-    \zxjf@setmainfont{#8,FontFace={bx}{n}{#7},BoldFont=#7}{#2}%
-    \zxjf@setsansfont{#8,FontFace={bx}{n}{#7},BoldFont=#7}{#7}%
-    \zxjf@setmonofont{#8,FontFace={bx}{n}{#7},BoldFont=#7}{#7}%
+    \zxjf@setmainfont{#8,\zxjf@BoldFont{#7}}{#2}%
+    \zxjf@setsansfont{#8,\zxjf@BoldFont{#7}}{#7}%
+    \zxjf@setmonofont{#8,\zxjf@BoldFont{#7}}{#7}%
   \else\ifzxjf@threeweight
-    \zxjf@setmainfont{#8,FontFace={bx}{n}{#3},BoldFont=#3,
-        FontFace={l}{n}{#1}}{#2}%
-    \zxjf@setsansfont{#8,FontFace={bx}{n}{#5},BoldFont=#5,
-        FontFace={eb}{n}{#6}}{#4}%
-    \zxjf@setmonofont{#8,FontFace={bx}{n}{#5},BoldFont=#5,
-        FontFace={eb}{n}{#6}}{#4}%
+    \zxjf@check@extra@font\zxjf@Fx{#1}{#2}%
+    \zxjf@setmainfont{#8,\zxjf@BoldFont{#3},
+        FontFace={l}{n}{\zxjf@Fx}}{#2}%
+    \zxjf@check@extra@font\zxjf@Fx{#6}{#5}%
+    \zxjf@setsansfont{#8,\zxjf@BoldFont{#5},
+        FontFace={eb}{n}{\zxjf@Fx}}{#4}%
+    \zxjf@setmonofont{#8,\zxjf@BoldFont{#5},
+        FontFace={eb}{n}{\zxjf@Fx}}{#4}%
   \else
-    \zxjf@setmainfont{#8,FontFace={bx}{n}{#3},BoldFont=#3}{#2}%
-    \zxjf@setsansfont{#8,FontFace={bx}{n}{#5},BoldFont=#5}{#4}%
-    \zxjf@setmonofont{#8,FontFace={bx}{n}{#5},BoldFont=#5}{#4}%
+    \zxjf@setmainfont{#8,\zxjf@BoldFont{#3}}{#2}%
+    \zxjf@setsansfont{#8,\zxjf@BoldFont{#5}}{#4}%
+    \zxjf@setmonofont{#8,\zxjf@BoldFont{#5}}{#4}%
   \fi\fi\fi}
+%% \zxjf@BoldFont{<name>}
+\ifzxjf@fontspec@mw
+  \zxjf@onlypreamble@def\zxjf@BoldFont#1{FontFace={bx}{n}{#1},BoldFont=#1}
 \else
-\zxjf@onlypreamble@def\zxjf@uniweight#1#2#3{%
-  \zxjf@setmainfont{#3,BoldFont=#2}{#1}%
-  \zxjf@setsansfont{#3,BoldFont=#2}{#2}%
-  \zxjf@setmonofont{#3,BoldFont=#2}{#2}}
-\zxjf@onlypreamble@def\zxjf@multiweight#1#2#3#4#5#6#7#8{%
-  \ifzxjf@bold
-    \zxjf@setmainfont{#8,BoldFont=#5}{#2}%
-    \zxjf@setsansfont{#8,BoldFont=#5}{#5}%
-    \zxjf@setmonofont{#8,BoldFont=#5}{#5}%
-  \else\ifzxjf@oneweight
-    \zxjf@setmainfont{#8,BoldFont=#7}{#2}%
-    \zxjf@setsansfont{#8,BoldFont=#7}{#7}%
-    \zxjf@setmonofont{#8,BoldFont=#7}{#7}%
-  \else\ifzxjf@threeweight
-    \zxjf@setmainfont{#8,BoldFont=#3,
-        FontFace={l}{n}{#1}}{#2}%
-    \zxjf@setsansfont{#8,BoldFont=#5,
-        FontFace={eb}{n}{#6}}{#4}%
-    \zxjf@setmonofont{#8,BoldFont=#5,
-        FontFace={eb}{n}{#6}}{#4}%
-  \else
-    \zxjf@setmainfont{#8,BoldFont=#3}{#2}%
-    \zxjf@setsansfont{#8,BoldFont=#5}{#4}%
-    \zxjf@setmonofont{#8,BoldFont=#5}{#4}%
-  \fi\fi\fi}
+  \zxjf@onlypreamble@def\zxjf@BoldFont#1{BoldFont=#1}
 \fi
+%% \zxjf@check@extra@font\CS{<target>}{<replace>}
+\zxjf@onlypreamble@def\zxjf@check@extra@font#1#2#3{%
+  \zxjf@if@font@exists{#2}{\def#1{#2}}{%else
+    \PackageWarningNoLine\zxjf@pkgname
+     {Font '#2' is not found,\MessageBreak
+      substituted by '#3'}%
+    \def#1{#3}}}
+
 %% \zxjf@declare@preset@with@prop{<name>}{<text>}
 \zxjf@onlypreamble@def\zxjf@declare@preset@with@prop#1#2{%
   \zxjf@declare@preset{#1}{#2{RawFeature=-palt;-kern}}%
-- 
cgit v1.2.3

