From a608ec774d1fc494221e8850ab8458d157e0e355 Mon Sep 17 00:00:00 2001 From: atxy <181850195@smail.nju.edu.cn> Date: Sun, 5 Sep 2021 19:44:32 +0800 Subject: [PATCH] =?UTF-8?q?add:=20=E6=94=B9=E5=86=99=E4=BA=86=E5=AD=97?= =?UTF-8?q?=E4=BD=93=E6=A0=B7=E5=BC=8F=E7=9A=84=E4=B8=8D=E5=90=8C=E5=B9=B3?= =?UTF-8?q?=E5=8F=B0=E5=88=A4=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- profile/font.sty | 103 ++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 83 insertions(+), 20 deletions(-) diff --git a/profile/font.sty b/profile/font.sty index 8a08075..a806765 100644 --- a/profile/font.sty +++ b/profile/font.sty @@ -1,27 +1,90 @@ -% \ProvidesExplPackage{profile/font}{2021-9-4}{0.1}{Some things I wrote} +%\ProvidesExplPackage{profile/font}{-9-4}{0.1}{SomethingsIwrote} +% 瑕嗙洊 ctex 瀛椾綋璁剧疆 -% 瑕嗙洊Ctex瀛椾綋璁剧疆 -\sys_if_platform_windows:TF -{ - % \setCJKfamilyfont{zhfs} {FangSong} [AutoFakeBold={\FakeBoldSize}] - % \setCJKfamilyfont{zhhei} {SimHei} [AutoFakeBold={\FakeBoldSize}] - \setCJKfamilyfont{zhkai} {KaiTi} [AutoFakeBold=2.17] - \setCJKfamilyfont{zhsong} {SimSun} [AutoFakeBold=2.17] +\newcommand\use_fontset_windows{ + % 璁剧疆瑗挎枃瀛椾綋 + \setmainfont{Times~New~Roman} + \setsansfont{Arial} + \setmonofont{Courier~New}[Scale=MatchLowercase] + % 璁剧疆涓枃瀛椾綋 + \setCJKmainfont{SimSun}[AutoFakeBold=true, ItalicFont=KaiTi] + \setCJKsansfont{SimHei} + \setCJKmonofont{FangSong} + \setCJKfamilyfont{zhsong}{SimSun}[AutoFakeBold=2.17] + \setCJKfamilyfont{zhhei}{SimHei} + \setCJKfamilyfont{zhfs}{FangSong} + \setCJKfamilyfont{zhkai}{KaiTi}[AutoFakeBold=2.17] + \setCJKfamilyfont{zhnewhei}{Microsoft~YaHei}[BoldFont=Microsoft~YaHei~Bold] +} - % \setCJKmainfont[AutoFakeBold={2.17}]{SimSun} +\newcommand\use_fontset_macos{ + % 璁剧疆瑗挎枃瀛椾綋 + \setmainfont{Times~New~Roman} + \setsansfont{Arial} + \setmonofont{Menlo}[Scale=MatchLowercase] + % 璁剧疆涓枃瀛椾綋 + \setCJKmainfont{Songti~SC~Light}[BoldFont=Songti~SC~Bold, ItalicFont=Kaiti~SC, BoldItalicFont=Kaiti~SC~Bold] + \setCJKsansfont{Heiti~SC~Light}[BoldFont=Heiti~SC~Medium] + \setCJKmonofont{STFangsong} + \setCJKfamilyfont{zhsong}{Songti~SC~Light}[BoldFont=Songti~SC~Bold] + \setCJKfamilyfont{zhhei}{Heiti~SC~Light}[BoldFont=Heiti~SC~Medium] + \setCJKfamilyfont{zhfs}{STFangsong} + \setCJKfamilyfont{zhkai}{Kaiti~SC}[BoldFont=Kaiti~SC~Bold] + \setCJKfamilyfont{zhnewhei}{PingFang~SC} } -{ - % 妫€娴嬫槸鍚︽槸Macos - % TODO: 涓嶅悓OS鐗堟湰瀛椾綋搴旀湁涓嶅悓璁剧疆锛堟病MAC锛� - \ctex_if_platform_macos:TF - { - } - { +\newcommand\use_fontset_linux{ + % 绉婚櫎 does not contain script "CJK" 璀﹀憡 + \msg_redirect_name:nnn {fontspec} {no-script} {info} + % 璁剧疆瑗挎枃瀛椾綋 + \setmainfont{texgyretermes}[ + Extension=.otf, + UprightFont=*-regular, + BoldFont=*-bold, + ItalicFont=*-italic, + BoldItalicFont=*-bolditalic] + \setsansfont{texgyreheros}[ + Extension=.otf, + UprightFont=*-regular, + BoldFont=*-bold, + ItalicFont=*-italic, + BoldItalicFont=*-bolditalic] + \setmonofont{texgyrecursor}[ + Extension=.otf, + UprightFont=*-regular, + BoldFont=*-bold, + ItalicFont=*-italic, + BoldItalicFont=*-bolditalic, + Scale=MatchLowercase, + Ligatures=CommonOff] + % 璁剧疆涓枃瀛椾綋 + \setCJKmainfont{FandolSong-Regular}[Extension=.otf,BoldFont=FandolSong-Bold,ItalicFont=FandolKai-Regular] + \setCJKsansfont{FandolHei-Regular}[Extension=.otf,BoldFont=FandolHei-Bold] + \setCJKmonofont{FandolFang-Regular}[Extension=.otf] + \setCJKfamilyfont{zhsong}{FandolSong-Regular}[Extension=.otf,BoldFont=FandolSong-Bold] + \setCJKfamilyfont{zhhei}{FandolHei-Regular}[Extension=.otf,BoldFont=FandolHei-Bold] + \setCJKfamilyfont{zhfs}{FandolFang-Regular}[Extension=.otf] + \setCJKfamilyfont{zhkai}{FandolKai-Regular}[Extension=.otf]} - } - +% 妫€娴嬫槸鍚︽槸 Windows +\sys_if_platform_windows:TF +{ + \use_fontset_windows +} +{ + % 妫€娴嬫槸鍚︽槸 MacOS + \ctex_if_platform_macos:TF + { + \use_fontset_macos + } + % 鍏朵綑绯荤粺涓€寰嬭瘑鍒负 Linux + { + \use_fontset_linux + } } -%Times New Roman -\setmainfont{Times~New~Roman} \ No newline at end of file +\NewDocumentCommand\songti{}{\CJKfamily{zhsong}} +\NewDocumentCommand\heiti{}{\CJKfamily{zhhei}} +\NewDocumentCommand\fangsong{}{\CJKfamily{zhfs}} +\NewDocumentCommand\kaishu{}{\CJKfamily{zhkai}} +\NewDocumentCommand\lishu{}{\CJKfamily{zhli}} -- GitLab