summaryrefslogtreecommitdiff
path: root/language/japanese/zxjafont/zxjafont.sty
diff options
context:
space:
mode:
Diffstat (limited to 'language/japanese/zxjafont/zxjafont.sty')
-rw-r--r--language/japanese/zxjafont/zxjafont.sty72
1 files changed, 63 insertions, 9 deletions
diff --git a/language/japanese/zxjafont/zxjafont.sty b/language/japanese/zxjafont/zxjafont.sty
index 18a2a699ae..60327c52f5 100644
--- a/language/japanese/zxjafont/zxjafont.sty
+++ b/language/japanese/zxjafont/zxjafont.sty
@@ -10,7 +10,7 @@
%% package declaration
\NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{zxjafont}[2020/02/08 v1.1]
+\ProvidesPackage{zxjafont}[2020/02/15 v1.1a]
\def\zxjf@pkgname{zxjafont}
%% preparation
@@ -56,6 +56,13 @@
\def\zxjf@isvalid#1{%
\ifcsvoid{#1}{F}{T}T}
+%% \zxjf@if@font@exists
+\ifdefined\IfFontExistsTF
+ \let\zxjf@if@font@exists\IfFontExistsTF
+\else % fallback
+ \def\zxjf@if@font@exists#1{\@firstoftwo}
+\fi
+
%--------------------------------------- handle options
%% errors
@@ -275,6 +282,33 @@
\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@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@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}%
+ \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}%
+ \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}%
+ \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}%
+ \fi\fi\fi}
+\else
\zxjf@onlypreamble@def\zxjf@uniweight#1#2#3{%
\zxjf@setmainfont{#3,BoldFont=#2}{#1}%
\zxjf@setsansfont{#3,BoldFont=#2}{#2}%
@@ -300,6 +334,7 @@
\zxjf@setsansfont{#8,BoldFont=#5}{#4}%
\zxjf@setmonofont{#8,BoldFont=#5}{#4}%
\fi\fi\fi}
+\fi
%% \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}}%
@@ -314,8 +349,17 @@
\zxjf@declare@preset@alias{#1}{#2}%
\zxjf@declare@preset@alias{#1/prop}{#2/prop}}
+%% \zxjf@declare@preproc{<name>}{<text>}
+\zxjf@onlypreamble@def\zxjf@declare@preproc#1{%
+ \zxjf@with@cs\zxjf@onlypreamble@def{zxjf@the@preproc@#1}}
+%% \zxjf@declare@preproc@alias{<name1>}{<name2>}
+\zxjf@onlypreamble@def\zxjf@declare@preproc@alias#1#2{%
+ \zxjf@with@cs\@onlypreamble{zxjf@the@preproc@#1}%
+ \csletcs{zxjf@the@preproc@#1}{zxjf@the@preproc@#2}}
+
%% \zxjf@use@preset{<name>}
\zxjf@onlypreamble@def\zxjf@use@preset#1{%
+ \csuse{zxjf@the@preproc@#1}%
\undef\zxjf@do
\ifzxjf@prop \letcs\zxjf@do{zxjf@the@preset@#1/prop}\fi
\unless\ifdefined\zxjf@do \letcs\zxjf@do{zxjf@the@preset@#1}\fi
@@ -343,10 +387,15 @@
\zxjf@multiweight{IPAPMincho}{IPAPMincho}{HGPMinchoE}%
{HGPGothicM}{HGGothicE}{hgrsgu.ttc}{IPAPGothic}{}}
\zxjf@declare@preset{ipaex}{%
- \zxjf@uniweight{ipaexm.ttf}{ipaexg.ttf}{}}
+ \zxjf@uniweight{\zxjf@Fa}{\zxjf@Fb}{}}
+\zxjf@declare@preproc{ipaex}{%
+ \zxjf@if@font@exists{ipaexm.ttf}%
+ {\def\zxjf@Fa{ipaexm.ttf}\def\zxjf@Fb{ipaexg.ttf}}%
+ {\def\zxjf@Fa{IPAexMincho}\def\zxjf@Fb{IPAexGothic}}}
\zxjf@declare@preset{ipaex-hg}{%
- \zxjf@multiweight{ipaexm.ttf}{ipaexm.ttf}{HGSMinchoE}%
- {HGSGothicM}{HGSGothicE}{hgrsgu.ttc}{ipaexg.ttf}{}}
+ \zxjf@multiweight{\zxjf@Fa}{\zxjf@Fa}{HGSMinchoE}%
+ {HGSGothicM}{HGSGothicE}{hgrsgu.ttc}{\zxjf@Fb}{}}
+\zxjf@declare@preproc@alias{ipaex-hg}{ipaex}
\zxjf@declare@preset{moga}{%
\zxjf@multiweight{MogaExMincho}{MogaExMincho}{MogaExMincho Bold}%
{MogaExGothic}{MogaExGothic Bold}{MogaExGothic Bold}{MogaExGothic}{}}
@@ -413,9 +462,12 @@
{NotoSansJP-Regular}{NotoSansJP-Bold}{NotoSansJP-Black}%
{NotoSansJP-Medium}}
\zxjf@declare@preset@with@prop{haranoaji}{%
- \zxjf@multiweight{HaranoAjiMincho-Light}{HaranoAjiMincho-Regular}{HaranoAjiMincho-Bold}%
- {HaranoAjiGothic-Regular}{HaranoAjiGothic-Bold}{HaranoAjiGothic-Heavy}%
- {HaranoAjiGothic-Medium}}
+ \zxjf@multiweight{HaranoAjiMincho-Light\zxjf@Fa}{HaranoAjiMincho-Regular\zxjf@Fa}{HaranoAjiMincho-Bold\zxjf@Fa}%
+ {HaranoAjiGothic-Regular\zxjf@Fa}{HaranoAjiGothic-Bold\zxjf@Fa}{HaranoAjiGothic-Heavy\zxjf@Fa}%
+ {HaranoAjiGothic-Medium\zxjf@Fa}}
+\zxjf@declare@preproc{haranoaji}{%
+ \zxjf@if@font@exists{HaranoAjiMincho-Regular.otf}%
+ {\def\zxjf@Fa{.otf}}{\let\zxjf@Fa\@empty}}
%(alias)
\zxjf@declare@preset@alias@with@prop{kozuka}{kozuka-pro}
\zxjf@declare@preset@alias@with@prop{morisawa}{morisawa-pro}
@@ -474,13 +526,15 @@
\def\ltdefault{l}
\DeclareRobustCommand\ltseries{%
\not@math@alphabet\ltseries\relax
- \fontseries\ltdefault\selectfont
+ % \fontseries{\ltdefault} fails on New NFSS
+ % unless alphabetic font also has 'l' series.
+ \edef\f@series{\ltdefault}\selectfont
}
%%<*> \ebdefault/\ebseries
\def\ebdefault{eb}
\DeclareRobustCommand\ebseries{%
\not@math@alphabet\ebseries\relax
- \fontseries\ebdefault\selectfont
+ \edef\f@series{\ebdefault}\selectfont
}
\fi