diff options
Diffstat (limited to 'Master/texmf-dist/tex/xelatex/xduts/xdufont.sty')
-rw-r--r-- | Master/texmf-dist/tex/xelatex/xduts/xdufont.sty | 152 |
1 files changed, 110 insertions, 42 deletions
diff --git a/Master/texmf-dist/tex/xelatex/xduts/xdufont.sty b/Master/texmf-dist/tex/xelatex/xduts/xdufont.sty index a1916f28425..bb245bf9f6f 100644 --- a/Master/texmf-dist/tex/xelatex/xduts/xdufont.sty +++ b/Master/texmf-dist/tex/xelatex/xduts/xdufont.sty @@ -6,34 +6,36 @@ %% %% xduts.dtx (with options: `sty,xdufont') %% -%% Copyright (C) 2022--2022 by @note286 in GitHub -%% --------------------------------------------------------------------- +%% Copyright 2022--2022 by @note286 in GitHub and CTAN %% -%% This work may be distributed and/or modified under the -%% conditions of the LaTeX Project Public License, either -%% version 1.3c of this license or (at your option) any later -%% version. This version of this license is in -%% http://www.latex-project.org/lppl/lppl-1-3c.txt -%% and the latest version of this license is in -%% http://www.latex-project.org/lppl.txt -%% and version 1.3 or later is part of all distributions of -%% LaTeX version 2005/12/01 or later. +%% This work may be distributed and/or modified under the +%% conditions of the LaTeX Project Public License, either version 1.3 +%% of this license or (at your option) any later version. +%% The latest version of this license is in +%% http://www.latex-project.org/lppl.txt +%% and version 1.3 or later is part of all distributions of LaTeX +%% version 2005/12/01 or later. %% -%% This work has the LPPL maintenance status "maintained". +%% This work has the LPPL maintenance status `author-maintained'. %% -%% --------------------------------------------------------------------- +%% The Current Maintainer of this work is @note286 in GitHub and CTAN. +%% +%% This work consists of the files README.md, xduts.dtx, and xduts.ins +%% and the derived files xduts.pdf, xduugthesis.cls, and xdufont.sty. +%% +%% The copyright of xidian-text.pdf and xidian-logo.pdf is Xidian University. %% \NeedsTeXFormat{LaTeX2e} \RequirePackage{expl3} \ProvidesExplPackage{xdufont} - {2022/04/11}{0.7.0.0} + {2022/04/16}{1.2.0.0} {Xidian University Font package} \RequirePackage { xparse, l3keys2e } \PassOptionsToPackage { quiet } { xeCJK } \RequirePackage { xeCJK } \tl_new:N \l__xdu_cjk_font_tl -\str_new:N \l__xdu_fake_bold_str -\str_new:N \l__xdu_fake_slant_str +\tl_new:N \l__xdu_fake_bold_tl +\tl_new:N \l__xdu_fake_slant_tl \tl_new:N \l__xdu_latin_font_tl \tl_new:N \l__xdu_math_font_tl \tl_new:N \l__xdu_unicode_math_tl @@ -44,9 +46,9 @@ cjk-font .choices:nn = { win, adobe, founder, sinotype, fandol, none } { \tl_set_eq:NN \l__xdu_cjk_font_tl \l_keys_choice_tl }, - cjk-fake-bold .str_set:N = \l__xdu_fake_bold_str, - cjk-fake-slant .str_set:N = \l__xdu_fake_slant_str, - latin-font .choices:nn = { tacn, thcs, none } + cjk-fake-bold .tl_set:N = \l__xdu_fake_bold_tl, + cjk-fake-slant .tl_set:N = \l__xdu_fake_slant_tl, + latin-font .choices:nn = { tacn, thcs, gyre, none } { \tl_set_eq:NN \l__xdu_latin_font_tl \l_keys_choice_tl }, math-font .choices:nn = { @@ -61,14 +63,14 @@ } \keys_set:nn { xdu } { - style / cjk-font = win, - style / cjk-fake-bold = 3, - style / cjk-fake-slant = 0.2, - style / latin-font = tacn, - style / math-font = cm, - style / unicode-math = { }, - style / font-type = font, - style / font-path = fonts + style / cjk-font = fandol, + style / cjk-fake-bold = 3, + style / cjk-fake-slant = 0.2, + style / latin-font = gyre, + style / math-font = cm, + style / unicode-math = { }, + style / font-type = font, + style / font-path = fonts } \cs_new:Npn \__xdu_if_platform_macos:FT #1#2 { \file_if_exist:nTF { /System/Library/Fonts/Menlo.ttc } { #2 } { #1 } } @@ -93,26 +95,26 @@ \cs_new:Npn \__xdu_cfg_cjk_font_sub_fb:n #1 { BoldFont = { #1 }, - BoldFeatures = { FakeBold = \l__xdu_fake_bold_str } + BoldFeatures = { FakeBold = \l__xdu_fake_bold_tl } } \cs_new:Npn \__xdu_cfg_cjk_font_sub_fs:n #1 { SlantedFont = { #1 }, - SlantedFeatures = { FakeSlant = \l__xdu_fake_slant_str } + SlantedFeatures = { FakeSlant = \l__xdu_fake_slant_tl } } \cs_new:Npn \__xdu_cfg_cjk_font_sub_fbfs:n #1 { BoldSlantedFont = { #1 }, BoldSlantedFeatures = { - FakeBold = \l__xdu_fake_bold_str, - FakeSlant = \l__xdu_fake_slant_str + FakeBold = \l__xdu_fake_bold_tl, + FakeSlant = \l__xdu_fake_slant_tl } } \cs_new:Npn \__xdu_cfg_cjk_font_sub_bfs:n #1 { BoldSlantedFont = { #1 }, - BoldSlantedFeatures = { FakeSlant = \l__xdu_fake_slant_str } + BoldSlantedFeatures = { FakeSlant = \l__xdu_fake_slant_tl } } \cs_new:Npn \__xdu_cfg_cjk_font_sub_i:n #1 { @@ -121,20 +123,20 @@ \cs_new:Npn \__xdu_cfg_cjk_font_sub_fi:n #1 { ItalicFont = { #1 }, - ItalicFeatures = { FakeSlant = \l__xdu_fake_slant_str } + ItalicFeatures = { FakeSlant = \l__xdu_fake_slant_tl } } \cs_new:Npn \__xdu_cfg_cjk_font_sub_ifb:n #1 { BoldItalicFont = { #1 }, - BoldItalicFeatures = { FakeBold = \l__xdu_fake_bold_str } + BoldItalicFeatures = { FakeBold = \l__xdu_fake_bold_tl } } \cs_new:Npn \__xdu_cfg_cjk_font_sub_fifb:n #1 { BoldItalicFont = { #1 }, BoldItalicFeatures = { - FakeBold = \l__xdu_fake_bold_str, - FakeSlant = \l__xdu_fake_slant_str + FakeBold = \l__xdu_fake_bold_tl, + FakeSlant = \l__xdu_fake_slant_tl } } \cs_new:Npn \__xdu_cfg_cjk_font_r:n #1 @@ -250,30 +252,78 @@ \cs_new:Npn \__xdu_load_cjk_font_none: { } \cs_new:Npn \__xdu_set_latin_font:nnn #1#2#3 { - \__xdu_font_path: BoldFont = { #1 }, SlantedFont = { #2 }, BoldSlantedFont = { #3 }, ItalicFont = { #2 }, BoldItalicFont = { #3 } } +\cs_new:Npn \__xdu_set_latin_scale: + { Scale = MatchLowercase , } +\cs_new:Npn \__xdu_off_latin_ligatures: + { Ligatures = CommonOff , } \cs_new:Npn \__xdu_set_latin_main_font:nnnnn #1#2#3#4#5 { \str_if_eq:NNTF { \l__xdu_font_type_tl } { font } { \setmainfont { #1 } } - { \setmainfont { #2 } [ \__xdu_set_latin_font:nnn { #3 } { #4 } { #5 } ] } + { + \setmainfont { #2 } + [ + \__xdu_font_path: + \__xdu_set_latin_font:nnn { #3 } { #4 } { #5 } + ] + } } \cs_new:Npn \__xdu_set_latin_sans_font:nnnnn #1#2#3#4#5 { \str_if_eq:NNTF { \l__xdu_font_type_tl } { font } - { \setsansfont { #1 } } - { \setsansfont { #2 } [ \__xdu_set_latin_font:nnn { #3 } { #4 } { #5 } ] } + { \setsansfont { #1 } [ \__xdu_set_latin_scale: ] } + { + \setsansfont { #2 } + [ + \__xdu_font_path: + \__xdu_set_latin_scale: + \__xdu_set_latin_font:nnn { #3 } { #4 } { #5 } + ] + } } \cs_new:Npn \__xdu_set_latin_mono_font:nnnnn #1#2#3#4#5 { \str_if_eq:NNTF { \l__xdu_font_type_tl } { font } - { \setmonofont{ #1 } } - { \setmonofont{ #2 } [ \__xdu_set_latin_font:nnn { #3 } { #4 } { #5 } ] } + { \setmonofont{ #1 } [ \__xdu_set_latin_scale: \__xdu_off_latin_ligatures: ]} + { + \setmonofont{ #2 } + [ + \__xdu_font_path: + \__xdu_set_latin_scale: + \__xdu_off_latin_ligatures: + \__xdu_set_latin_font:nnn { #3 } { #4 } { #5 } + ] + } + } +\cs_new:Npn \__xdu_set_latin_main_font:nnnn #1#2#3#4 + { + \setmainfont { #1 } + [ + \__xdu_set_latin_font:nnn { #2 } { #3 } { #4 } + ] + } +\cs_new:Npn \__xdu_set_latin_sans_font:nnnn #1#2#3#4 + { + \setsansfont { #1 } + [ + \__xdu_set_latin_scale: + \__xdu_set_latin_font:nnn { #2 } { #3 } { #4 } + ] + } +\cs_new:Npn \__xdu_set_latin_mono_font:nnnn #1#2#3#4 + { + \setmonofont{ #1 } + [ + \__xdu_set_latin_scale: + \__xdu_off_latin_ligatures: + \__xdu_set_latin_font:nnn { #2 } { #3 } { #4 } + ] } \cs_new:Npn \__xdu_load_latin_font_tacn: { @@ -305,6 +355,24 @@ { CourierStd-Oblique.otf } { CourierStd-BoldOblique.otf } } +\cs_new:Npn \__xdu_load_latin_font_gyre: + { + \__xdu_set_latin_main_font:nnnn + { texgyretermes-regular.otf } + { texgyretermes-bold.otf } + { texgyretermes-italic.otf } + { texgyretermes-bolditalic.otf } + \__xdu_set_latin_sans_font:nnnn + { texgyreheros-regular.otf } + { texgyreheros-bold.otf } + { texgyreheros-italic.otf } + { texgyreheros-bolditalic.otf } + \__xdu_set_latin_mono_font:nnnn + { texgyrecursor-regular.otf } + { texgyrecursor-bold.otf } + { texgyrecursor-italic.otf } + { texgyrecursor-bolditalic.otf } + } \cs_new:Npn \__xdu_load_latin_font_none: { } \cs_new:Npn \__xdu_load_unicode_math_pkg: { |