diff options
author | Karl Berry <karl@freefriends.org> | 2019-03-23 22:05:34 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2019-03-23 22:05:34 +0000 |
commit | 45a15dfc571b3956bcec43266179a3e8d06311c1 (patch) | |
tree | 3a35f05e1254d5803cd22a4cd494e068eb646b17 /Master/texmf-dist/tex/platex/pxchfon | |
parent | 405f236589783c35089575ef93b2b42598e90051 (diff) |
pxchfon (23mar19)
git-svn-id: svn://tug.org/texlive/trunk@50556 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/platex/pxchfon')
-rw-r--r-- | Master/texmf-dist/tex/platex/pxchfon/pxchfon.sty | 205 |
1 files changed, 154 insertions, 51 deletions
diff --git a/Master/texmf-dist/tex/platex/pxchfon/pxchfon.sty b/Master/texmf-dist/tex/platex/pxchfon/pxchfon.sty index b7b236e0ed2..6206ddb0c8a 100644 --- a/Master/texmf-dist/tex/platex/pxchfon/pxchfon.sty +++ b/Master/texmf-dist/tex/platex/pxchfon/pxchfon.sty @@ -10,7 +10,7 @@ %% package declaration \NeedsTeXFormat{pLaTeX2e} -\ProvidesPackage{pxchfon}[2019/03/20 v1.3a] +\ProvidesPackage{pxchfon}[2019/03/24 v1.4a] \def\pxcz@pkgname{pxchfon} %% preparations @@ -219,10 +219,10 @@ kozuka-pro,kozuka-pr6,kozuka-pr6n,hiragino-pro,hiragino-pron,% hiragino-elcapitan-pro,hiragino-elcapitan-pron,% morisawa-pro,morisawa-pr6n,yu-win,yu-win10,yu-win10+,yu-osx,% - sourcehan-otc,sourcehan,noto-otc,noto,% + sourcehan-otc,sourcehan,sourcehan-jp,noto-otc,noto,noto-jp,% sourcehan-otc+,sourcehan+,noto-otc+,noto+,% %(alias) - hiragino,% + hiragino,noto-otf,% noEmbed,kozuka,hiragino-elcapitan,morisawa} \pxcz@onlypreamble@def\pxcz@all@abolished@preset{% ipa-otf,ipa-otf-dx,kozuka4,kozuka6,kozuka6n, @@ -355,7 +355,10 @@ \let\pxcz@switch@font@xjistrue\pxcz@switch@font@xjisfalse \fi -%--------------------------------------- preset-triggered setup +%--------------------------------------- preset-dependent setup + +%% variables +\newif\ifpxcz@warn@unless@all@defined %% \pxcz@apply@opt@unicode % Forces the 'unicode' setup (unless a directunicode option was given). @@ -399,8 +402,11 @@ % equivalent to the corresponding 'XXXX+' preset. \pxcz@do{sourcehan}{\pxcz@apply@opt@unicode} \pxcz@do{sourcehan-otc}{\pxcz@apply@opt@unicode} +\pxcz@do{sourcehan-jp}{\pxcz@apply@opt@unicode} \pxcz@do{noto}{\pxcz@apply@opt@unicode} +\pxcz@do{noto-otf}{\pxcz@apply@opt@unicode} \pxcz@do{noto-otc}{\pxcz@apply@opt@unicode} +\pxcz@do{noto-jp}{\pxcz@apply@opt@unicode} \pxcz@do{sourcehan+}{\pxcz@apply@opt@unicodeP} \pxcz@do{sourcehan-otc+}{\pxcz@apply@opt@unicodeP} \pxcz@do{noto+}{\pxcz@apply@opt@unicodeP} @@ -474,6 +480,9 @@ \fi \let\pxcz@expert=f \fi +\if t\pxcz@expert + \pxcz@warn@unless@all@definedtrue +\fi %--------------------------------------- user interface @@ -605,6 +614,11 @@ \newcommand*\usefontmapfile[1]{% \JaFontUserDefinedMap{\pxcz@addtospec@alt\pxcz@mapfile{#1}}} +%% \pxcz@check@extra +% Executed at the begin-document hook. +\@onlypreamble\pxcz@check@extra +\let\pxcz@check@extra\@empty + %--------------------------------------- map entry handling %%<*> \setnewglyphcmapprefix{<str>} @@ -796,14 +810,13 @@ \pxcz@declare@entry@modifier{HWid}{% \ifx\pxcz@font\pxcz@noembed \let\pxcz@cmap\pxcz@cmap@hwuni + \else\ifnum\pxcz@directunicode=\pxcz@directunicode@full + \let\pxcz@cmap\pxcz@cmap@directuni \else \let\pxcz@cmap\pxcz@cmap@uni \pxcz@switch@font@for{hwid}% - \fi - \pxcz@add@lopt{hwid}% - \def\pxcz@tmpa{mgr}\ifx\pxcz@sym\pxcz@tmpa - \let\pxcz@font\@empty - \fi} + \fi\fi + \pxcz@add@lopt{hwid}} % FWid \pxcz@declare@entry@modifier{FWid}{% \pxcz@switch@font@for{fwid}% @@ -952,12 +965,19 @@ } \pxcz@mapentry{ALPHA}{% \Entry{mnl}{r-cfjar-l-@PXcjk0@}{unicode} {HWid}% +\Entry{mnl}{r-cfjar-lz-@PXcjk0@}{UniJIS-UCS2-H} {Uni*,FWid}% \Entry{mnr}{r-cfjar-r-@PXcjk0@}{unicode} {HWid}% +\Entry{mnr}{r-cfjar-rz-@PXcjk0@}{UniJIS-UCS2-H} {Uni*,FWid}% \Entry{mnb}{r-cfjar-b-@PXcjk0@}{unicode} {HWid}% +\Entry{mnb}{r-cfjar-bz-@PXcjk0@}{UniJIS-UCS2-H} {Uni*,FWid}% \Entry{gtr}{r-cfjas-r-@PXcjk0@}{unicode} {HWid}% +\Entry{gtr}{r-cfjas-rz-@PXcjk0@}{UniJIS-UCS2-H} {Uni*,FWid}% \Entry{gtb}{r-cfjas-b-@PXcjk0@}{unicode} {HWid}% +\Entry{gtb}{r-cfjas-bz-@PXcjk0@}{UniJIS-UCS2-H} {Uni*,FWid}% \Entry{gtx}{r-cfjas-x-@PXcjk0@}{unicode} {HWid}% -\Entry{mgr}{r-cfjas-r-@PXcjk0@}{unicode} {HWid}% +\Entry{gtx}{r-cfjas-xz-@PXcjk0@}{UniJIS-UCS2-H} {Uni*,FWid}% +\Entry{mgr}{r-cfjam-r-@PXcjk0@}{unicode} {HWid}% +\Entry{mgr}{r-cfjam-rz-@PXcjk0@}{UniJIS-UCS2-H} {Uni*,FWid}% } \pxcz@mapentry{UTF}{% \Entry{mnr}{unijmin-h} {UniJIS-UTF16-H} {Uni*,Switch}% @@ -1366,26 +1386,40 @@ %--------------------------------------- 'alphabet' option -%% \pxcz@decl@shape{<fam>}{<ser>}{<font>} +%% \pxcz@afont@enc@list +\def\pxcz@afont@enc@list{OT1,T1} +%% \pxcz@decl@family{<fam>} +\@onlypreamble\pxcz@decl@family +\def\pxcz@decl@family#1{% + \@for\pxcz@x:=\pxcz@afont@enc@list\do{% + \DeclareFontFamily{\pxcz@x}{#1}{}}} +%% \pxcz@decl@shape{<fam>}{<ser>}<sw>{<font>} \@onlypreamble\pxcz@decl@shape -\def\pxcz@decl@shape#1#2#3{% -\DeclareFontShape{OT1}{#1}{#2}{n}{<->#3}{}% -\DeclareFontShape{OT1}{#1}{#2}{it}{<->ssub*#1/#2/n}{}} +\def\pxcz@decl@shape#1#2#3#4{% + \if s#3% + \@for\pxcz@x:=\pxcz@afont@enc@list\do{% + \DeclareFontShape{\pxcz@x}{#1}{#2}{n}{<->ssub*#4}{}}% + \else + \DeclareFontShape{OT1}{#1}{#2}{n}{<->#4-l0j}{}% + \DeclareFontShape {T1}{#1}{#2}{n}{<->#4-l0j}{}% FIXME + \fi + \@for\pxcz@x:=\pxcz@afont@enc@list\do{% + \DeclareFontShape{\pxcz@x}{#1}{#2}{it}{<->ssub*#1/#2/n}{}% + \DeclareFontShape{\pxcz@x}{#1}{#2}{sl}{<->ssub*#1/#2/n}{}}} -\let\pxcz@check@extra\@empty -\@onlypreamble\pxcz@check@extra -% \ifpxcz@alphafont %---- <*alphabet> \ifpxcz@otf@deluxe %---- <*otfdx> : otf with deluxe option % define families cfjar & cfjas -\DeclareFontFamily{OT1}{cfjar}{}% -\pxcz@decl@shape{cfjar}{l}{cfjar-l-l0j}% -\pxcz@decl@shape{cfjar}{m}{cfjar-r-l0j}% -\pxcz@decl@shape{cfjar}{bx}{cfjar-b-l0j}% -\DeclareFontFamily{OT1}{cfjas}{}% -\pxcz@decl@shape{cfjas}{m}{cfjas-r-l0j}% -\pxcz@decl@shape{cfjas}{bx}{cfjas-b-l0j}% -\pxcz@decl@shape{cfjas}{eb}{cfjas-x-l0j}% +\pxcz@decl@family{cfjar}% +\pxcz@decl@shape{cfjar}{l}n{cfjar-l}% +\pxcz@decl@shape{cfjar}{m}n{cfjar-r}% +\pxcz@decl@shape{cfjar}{bx}n{cfjar-b}% +\pxcz@decl@family{cfjas}% +\pxcz@decl@shape{cfjas}{m}n{cfjas-r}% +\pxcz@decl@shape{cfjas}{bx}n{cfjas-b}% +\pxcz@decl@shape{cfjas}{eb}n{cfjas-x}% +\pxcz@decl@family{cfjam}% +\pxcz@decl@shape{cfjam}{m}n{cfjam-r}% % redefine \ltseries & \ebseries so they affect roman font \let\ltseries\relax \let\ebseries\relax \DeclareRobustCommand\ltseries{% @@ -1395,18 +1429,18 @@ \not@math@alphabet\ebseries\relax \fontseries\ebdefault\selectfont}% \else %---- <*!otfdx> -\DeclareFontFamily{OT1}{cfjar}{}% -\pxcz@decl@shape{cfjar}{m}{cfjar-r-l0j}% -\pxcz@decl@shape{cfjar}{bx}{ssub*cfjas/m/n}% -\DeclareFontFamily{OT1}{cfjas}{}% -\pxcz@decl@shape{cfjas}{m}{cfjas-r-l0j}% -\pxcz@decl@shape{cfjas}{bx}{ssub*cfjas/m/n}% +\pxcz@decl@family{cfjar}% +\pxcz@decl@shape{cfjar}{m}n{cfjar-r}% +\pxcz@decl@shape{cfjar}{bx}s{cfjas/m/n}% +\pxcz@decl@family{cfjas}% +\pxcz@decl@shape{cfjas}{m}n{cfjas-r}% +\pxcz@decl@shape{cfjas}{bx}s{cfjas/m/n}% \@onlypreamble\pxcz@err@dxotf \def\pxcz@err@dxotf#1{% \pxcz@error{Loaded before '#1' with 'deluxe'}% {This package must be loaded after '#1' with 'deluxe' option when using both.}} -\def\pxcz@check@extra{% +\g@addto@macro\pxcz@check@extra{% \expandafter\let\expandafter\pxcz@x\csname pxcz@FS/mnr\endcsname \ifx\pxcz@x\@empty\else % if mnr is replaced but gtr is not then ... @@ -1422,6 +1456,12 @@ %--------------------------------------- begin-document hook +%% variables +\let\pxcz@afont@enc\relax + +%% \pxcz@mgfamily@hook +\def\pxcz@mgfamily@hook{\romanfamily{cfjam}} + %% \pxcz@set@page@hook{<text>} \@onlypreamble\pxcz@set@page@hook \ifpxcz@everypage @@ -1435,13 +1475,41 @@ \global\setbox\@begindvibox\vbox{\yoko\unvbox\@begindvibox#1}} \fi -%% the begin-document hook +%% \pxcz@check@alldefined{<sym>,...} \@onlypreamble\pxcz@check@alldefined \def\pxcz@check@alldefined#1{% \pxcz@oktrue \@for\pxcz@x:={#1}\do{% \expandafter\ifx\csname pxcz@FS/\pxcz@x\endcsname\@empty \pxcz@okfalse \fi}} + +%% \pxcz@decl@relfont{<fam>}{<afam>}{<ser>,...} +\@onlypreamble\pxcz@decl@relfont +\def\pxcz@decl@relfont#1#2#3{% + \@for\pxcz@x:={#3}\do{% + \expandafter\ifx\csname\k@encoding/#1/\pxcz@x/n\endcsname\relax\else + \edef\pxcz@tmpa{\noexpand\DeclareRelationFont + {\k@encoding}{#1}{\pxcz@x}{}{\pxcz@afont@enc}{#2}{\pxcz@x}{}% + }\pxcz@tmpa + \fi}% + \pxcz@info{Relation font set for \k@encoding/#1}} + +%% \pxcz@check@afont@enc +\@onlypreamble\pxcz@check@afont@enc +\def\pxcz@check@afont@enc{% + \pxcz@oktrue % OT1 is always okay + \def\pxcz@tmpa{OT1}\ifx\pxcz@tmpa\pxcz@afont@enc\else + % otherwise, noembed must not be used + \@for\pxcz@x:=\pxcz@sym@list\do{% + \expandafter\ifx\csname pxcz@FS/\pxcz@x\endcsname\pxcz@noembed + \pxcz@okfalse \fi}% + \expandafter\ifx\csname\pxcz@afont@enc+cfjar\endcsname\relax + \pxcz@okfalse \fi + \fi + % if not okay, use OT1 instead + \ifpxcz@ok\else \def\pxcz@afont@enc{OT1}\fi} + +%% the begin-document hook \@onlypreamble\pxcz@doc@hook \def\pxcz@doc@hook{% \pxcz@user@hook @@ -1451,24 +1519,41 @@ \ifx t\pxcz@strict@csi \pxcz@inspect@flavor@all \fi - \ifpxcz@alpha + \ifpxcz@alpha % 'alphabet' \pxcz@check@alldefined{mnl,mnr,mnb}% \ifpxcz@ok \renewcommand\rmdefault{cfjar}\fi \pxcz@check@alldefined{gtr,gtb,gtx}% \ifpxcz@ok \renewcommand\sfdefault{cfjas}\fi - \edef\pxcz@tmpa{\encodingdefault}\def\pxcz@tmpb{OT1} - \ifx\pxcz@tmpa\pxcz@tmpb\else + % attach hook to \mgfamily if mgr font is defined + \pxcz@check@alldefined{mgr} + \ifpxcz@ok\ifpxcz@otf@deluxe + \begingroup + \def\pxcz@x##1{\toks@\expandafter{##1}% + \xdef##1{\noexpand\pxcz@mgfamily@hook\the\toks@}% + }\expandafter\pxcz@x\csname mgfamily \endcsname + \endgroup + \fi\fi + % decide alphabet font encoding + \edef\pxcz@afont@enc{\encodingdefault}% + \pxcz@check@afont@enc\ifpxcz@ok\else \pxcz@warn{Default encoding is changed to 'OT1' because% \MessageBreak'alphabet' option is in effect}% + \renewcommand\encodingdefault{OT1}% \fi - \renewcommand\encodingdefault{OT1}\normalfont + \normalfont \pxcz@addtospec{ALPHA}% \fi - \ifpxcz@rel + \ifpxcz@rel % 'relfont' + \edef\pxcz@afont@enc{\encodingdefault}% + \pxcz@check@afont@enc \pxcz@check@alldefined{mnl,mnr,mnb}% - \ifpxcz@ok \pxcz@decl@relfont\mcdefault{cfjar}{l}\fi + \ifpxcz@ok \pxcz@decl@relfont\mcdefault{cfjar}{m,bx,l}\fi \pxcz@check@alldefined{gtr,gtb,gtx}% - \ifpxcz@ok \pxcz@decl@relfont\gtdefault{cfjas}{eb}\fi + \ifpxcz@ok \pxcz@decl@relfont\gtdefault{cfjas}{m,bx,eb}\fi + \pxcz@check@alldefined{mgr}% + \ifpxcz@ok\ifpxcz@otf@deluxe + \pxcz@decl@relfont\mgdefault{cfjam}{m}% + \fi\fi \pxcz@addtospec{ALPHA}% \fi \ifpxcz@uptex\else @@ -1499,6 +1584,20 @@ \@ifpackageloaded{pxfontenc}{\pxcz@oktrue}{}% \ifpxcz@ok \pxcz@addtospec{PXOTF}% \fi + % warn if some weights are not substituted, and if necessaty + \ifpxcz@warn@unless@all@defined + \ifpxcz@otf@deluxe + \pxcz@check@alldefined{mnl,mnr,mnb,gtr,gtb,gtx,mgr}% + \else \pxcz@check@alldefined{mnr,mnb,gtr,gtb}% + \fi + \ifpxcz@ok\else + \PackageWarningNoLine\pxcz@pkgname + {Some font weights are not substituted.\MessageBreak + Thus some features of pxchfon might not work\MessageBreak + properly when applied to such weights}% + \fi + \fi + % \pxcz@check@extra \pxcz@addtospec{USR}% \ifpxcz@enabled @@ -1517,17 +1616,6 @@ } \AtBeginDocument{\pxcz@doc@hook} -%% \pxcz@decl@relfont -\@onlypreamble\pxcz@decl@relfont -\def\pxcz@decl@relfont#1#2#3{% - \DeclareRelationFont{\k@encoding}{#1}{m}{}{OT1}{#2}{m}{}% - \DeclareRelationFont{\k@encoding}{#1}{bx}{}{OT1}{#2}{bx}{}% - \ifpxcz@otf@deluxe - \DeclareRelationFont{\k@encoding}{#1}{#3}{}{OT1}{#2}{#3}{}% - \fi - \pxcz@info{Relation font set for \k@encoding/#1}% -} - %--------------------------------------- strict-CSI mode \ifx t\pxcz@strict@csi % In this section, the e-TeX extension plus \pdffiledump and @@ -1877,6 +1965,13 @@ {SourceHanSans-Regular.otf}{SourceHanSans-Bold.otf}% {SourceHanSans-Heavy.otf}{SourceHanSans-Medium.otf}% {SourceHanSans-Medium.otf}} +% Source Han Sans/Serif, "Region-specific Subset OTF" +\pxcz@declare@preset{sourcehan-jp}{% + \pxcz@multiweight{SourceHanSerifJP-Light.otf}% + {SourceHanSerifJP-Regular.otf}{SourceHanSerifJP-Bold.otf}% + {SourceHanSansJP-Regular.otf}{SourceHanSansJP-Bold.otf}% + {SourceHanSansJP-Heavy.otf}{SourceHanSansJP-Medium.otf}% + {SourceHanSansJP-Medium.otf}} % Noto Sans/Serif CJK, "OpenType/CFF Collection (OTC)" \pxcz@declare@preset{noto-otc}{% \pxcz@multiweight{:0:NotoSerifCJK-Light.ttc}% @@ -1891,12 +1986,20 @@ {NotoSansCJKjp-Regular.otf}{NotoSansCJKjp-Bold.otf}% {NotoSansCJKjp-Black.otf}{NotoSansCJKjp-Medium.otf}% {NotoSansCJKjp-Medium.otf}} +% Noto Sans/Serif CJK, "Region-specific Subset OpenType/CFF (Subset OTF)" +\pxcz@declare@preset{noto-jp}{% + \pxcz@multiweight{NotoSerifJP-Light.otf}% + {NotoSerifJP-Regular.otf}{NotoSerifJP-Bold.otf}% + {NotoSansJP-Regular.otf}{NotoSansJP-Bold.otf}% + {NotoSansJP-Black.otf}{NotoSansJP-Medium.otf}% + {NotoSansJP-Medium.otf}} %(alias) \pxcz@declare@preset@alias{hiragino}{hiragino-pro} \pxcz@declare@preset@alias{noEmbed}{noembed} \pxcz@declare@preset@alias{kozuka}{kozuka-pro} \pxcz@declare@preset@alias{hiragino-elcapitan}{hiragino-elcapitan-pro} \pxcz@declare@preset@alias{morisawa}{morisawa-pro} +\pxcz@declare@preset@alias{noto-otf}{noto} %(plus-variants) \pxcz@declare@preset@alias{sourcehan+}{sourcehan} \pxcz@declare@preset@alias{sourcehan-otc+}{sourcehan-otc} |