Skip to content
Snippets Groups Projects
Commit a608ec77 authored by Yu Xiong's avatar Yu Xiong :confounded:
Browse files

add: 改写了字体样式的不同平台判断

parent 998e649b
No related branches found
No related tags found
No related merge requests found
% \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}}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment