Skip to content

Commit

Permalink
Merge pull request #335 from BITNP/windows-auto-fake-bold
Browse files Browse the repository at this point in the history
feat: enable Windows auto fake bold by default
  • Loading branch information
fky2015 authored May 26, 2023
2 parents 8fed2db + e5c5ea7 commit 124cc25
Show file tree
Hide file tree
Showing 9 changed files with 2,046 additions and 1,937 deletions.
1,940 changes: 1,940 additions & 0 deletions bithesis-doc.tex

Large diffs are not rendered by default.

1,949 changes: 17 additions & 1,932 deletions bithesis.dtx

Large diffs are not rendered by default.

14 changes: 13 additions & 1 deletion templates/graduate-thesis/bithesis.cls
Original file line number Diff line number Diff line change
Expand Up @@ -502,6 +502,9 @@
mathFont .initial:n = {cm},
% Options that will be pass to `unicode-math` pkgs.
unicodeMathOptions .tl_set:N = \l__bithesis_unicode_math_options_tl,
% Windows 平台开启宋体伪粗体。
windowsSimSunFakeBold .bool_set:N = \l__bithesis_style_windows_simsum_fake_bold,
windowsSimSunFakeBold .initial:n = {false},
}
\keys_define:nn { bithesis / TOC }
{
Expand Down Expand Up @@ -556,6 +559,7 @@
\ProcessOptions\relax
\LoadClass[zihao=-4,]{ctexbook}
\RequirePackage{geometry}
\RequirePackage[table,xcdraw]{xcolor}
\RequirePackage{xeCJK}
\RequirePackage{titletoc}
\RequirePackage{setspace}
Expand All @@ -568,7 +572,6 @@
\RequirePackage{tikz}
\RequirePackage{etoolbox}
\RequirePackage[bookmarksnumbered]{hyperref}
\RequirePackage{xcolor}
\RequirePackage[strut=off]{caption}
\RequirePackage{array}
\RequirePackage{amsmath}
Expand Down Expand Up @@ -666,6 +669,15 @@
\use:c { __bithesis_load_math_font_ \l__bithesis_style_math_font_tl : }
}
\ctex_at_end_preamble:n {
% 针对 Windows 字体采用 Fake Bold 宋体
\bool_if:NT \l__bithesis_style_windows_simsum_fake_bold
{
\RequirePackage{ifplatform}
\ifwindows
\setCJKmainfont{SimSun}[AutoFakeBold,AutoFakeSlant]
\fi
}

% 在导言区末尾加载数学字体。
\__bithesis_load_font:

Expand Down
2 changes: 2 additions & 0 deletions templates/graduate-thesis/main.tex
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@
},
style = {
pageVerticalAlign = scattered,
% 开启 Windows 平台下的中易宋体伪粗体。
% windowsSimSunFakeBold = true,
},
publications = {
% 以下两个选项将影响「攻读学位期间发表论文与研究成果清单」中名称列表的省略阈值。
Expand Down
14 changes: 13 additions & 1 deletion templates/paper-translation/bithesis.cls
Original file line number Diff line number Diff line change
Expand Up @@ -502,6 +502,9 @@
mathFont .initial:n = {cm},
% Options that will be pass to `unicode-math` pkgs.
unicodeMathOptions .tl_set:N = \l__bithesis_unicode_math_options_tl,
% Windows 平台开启宋体伪粗体。
windowsSimSunFakeBold .bool_set:N = \l__bithesis_style_windows_simsum_fake_bold,
windowsSimSunFakeBold .initial:n = {false},
}
\keys_define:nn { bithesis / TOC }
{
Expand Down Expand Up @@ -556,6 +559,7 @@
\ProcessOptions\relax
\LoadClass[zihao=-4,]{ctexbook}
\RequirePackage{geometry}
\RequirePackage[table,xcdraw]{xcolor}
\RequirePackage{xeCJK}
\RequirePackage{titletoc}
\RequirePackage{setspace}
Expand All @@ -568,7 +572,6 @@
\RequirePackage{tikz}
\RequirePackage{etoolbox}
\RequirePackage[bookmarksnumbered]{hyperref}
\RequirePackage{xcolor}
\RequirePackage[strut=off]{caption}
\RequirePackage{array}
\RequirePackage{amsmath}
Expand Down Expand Up @@ -666,6 +669,15 @@
\use:c { __bithesis_load_math_font_ \l__bithesis_style_math_font_tl : }
}
\ctex_at_end_preamble:n {
% 针对 Windows 字体采用 Fake Bold 宋体
\bool_if:NT \l__bithesis_style_windows_simsum_fake_bold
{
\RequirePackage{ifplatform}
\ifwindows
\setCJKmainfont{SimSun}[AutoFakeBold,AutoFakeSlant]
\fi
}

% 在导言区末尾加载数学字体。
\__bithesis_load_font:

Expand Down
14 changes: 13 additions & 1 deletion templates/undergraduate-thesis-en/bithesis.cls
Original file line number Diff line number Diff line change
Expand Up @@ -502,6 +502,9 @@
mathFont .initial:n = {cm},
% Options that will be pass to `unicode-math` pkgs.
unicodeMathOptions .tl_set:N = \l__bithesis_unicode_math_options_tl,
% Windows 平台开启宋体伪粗体。
windowsSimSunFakeBold .bool_set:N = \l__bithesis_style_windows_simsum_fake_bold,
windowsSimSunFakeBold .initial:n = {false},
}
\keys_define:nn { bithesis / TOC }
{
Expand Down Expand Up @@ -556,6 +559,7 @@
\ProcessOptions\relax
\LoadClass[zihao=-4,]{ctexbook}
\RequirePackage{geometry}
\RequirePackage[table,xcdraw]{xcolor}
\RequirePackage{xeCJK}
\RequirePackage{titletoc}
\RequirePackage{setspace}
Expand All @@ -568,7 +572,6 @@
\RequirePackage{tikz}
\RequirePackage{etoolbox}
\RequirePackage[bookmarksnumbered]{hyperref}
\RequirePackage{xcolor}
\RequirePackage[strut=off]{caption}
\RequirePackage{array}
\RequirePackage{amsmath}
Expand Down Expand Up @@ -666,6 +669,15 @@
\use:c { __bithesis_load_math_font_ \l__bithesis_style_math_font_tl : }
}
\ctex_at_end_preamble:n {
% 针对 Windows 字体采用 Fake Bold 宋体
\bool_if:NT \l__bithesis_style_windows_simsum_fake_bold
{
\RequirePackage{ifplatform}
\ifwindows
\setCJKmainfont{SimSun}[AutoFakeBold,AutoFakeSlant]
\fi
}

% 在导言区末尾加载数学字体。
\__bithesis_load_font:

Expand Down
14 changes: 13 additions & 1 deletion templates/undergraduate-thesis/bithesis.cls
Original file line number Diff line number Diff line change
Expand Up @@ -502,6 +502,9 @@
mathFont .initial:n = {cm},
% Options that will be pass to `unicode-math` pkgs.
unicodeMathOptions .tl_set:N = \l__bithesis_unicode_math_options_tl,
% Windows 平台开启宋体伪粗体。
windowsSimSunFakeBold .bool_set:N = \l__bithesis_style_windows_simsum_fake_bold,
windowsSimSunFakeBold .initial:n = {false},
}
\keys_define:nn { bithesis / TOC }
{
Expand Down Expand Up @@ -556,6 +559,7 @@
\ProcessOptions\relax
\LoadClass[zihao=-4,]{ctexbook}
\RequirePackage{geometry}
\RequirePackage[table,xcdraw]{xcolor}
\RequirePackage{xeCJK}
\RequirePackage{titletoc}
\RequirePackage{setspace}
Expand All @@ -568,7 +572,6 @@
\RequirePackage{tikz}
\RequirePackage{etoolbox}
\RequirePackage[bookmarksnumbered]{hyperref}
\RequirePackage{xcolor}
\RequirePackage[strut=off]{caption}
\RequirePackage{array}
\RequirePackage{amsmath}
Expand Down Expand Up @@ -666,6 +669,15 @@
\use:c { __bithesis_load_math_font_ \l__bithesis_style_math_font_tl : }
}
\ctex_at_end_preamble:n {
% 针对 Windows 字体采用 Fake Bold 宋体
\bool_if:NT \l__bithesis_style_windows_simsum_fake_bold
{
\RequirePackage{ifplatform}
\ifwindows
\setCJKmainfont{SimSun}[AutoFakeBold,AutoFakeSlant]
\fi
}

% 在导言区末尾加载数学字体。
\__bithesis_load_font:

Expand Down
29 changes: 29 additions & 0 deletions templates/undergraduate-thesis/chapters/1_chapter1.tex
Original file line number Diff line number Diff line change
Expand Up @@ -77,3 +77,32 @@ \subsubsection{生僻字}
% 使用自己定义的字体
% 使用提供了相应字型的字体:\CJKfamily{custom-font}{彧}。


\section{字体效果表格}

% 列:Regular、Italic、Bold、Bold Italic
% 行:宋体、黑体、楷体、Serif、Sans Serif、Typewriter、Math

\begin{table}[htb]
\linespread{1.5}
\zihao{5}
\centering
\caption{字体效果表格}
\begin{tabular}{@{}lllll@{}}
\toprule
& Regular & Bold & Italic & Bold Italic \\ \midrule
宋体 & 宋体 & \cellcolor{orange}\textbf{宋体粗体} & \textit{楷体} & \cellcolor{gray}\textbf{\textit{楷书粗斜体}} \\
黑体 & {\heiti{}黑体} & \textbf{\heiti{}黑体粗体} & \textit{\heiti{}黑体斜体} & \cellcolor{gray}\textit{\textbf{\heiti{}黑体粗斜体}} \\
楷体 & {\kaishu{}楷书} & \textbf{\kaishu{}楷书粗体} & \textit{\kaishu{}斜体楷体} & \cellcolor{gray}\textbf{\textit{\kaishu{}楷书粗斜体}} \\
Serif(Roman/Normal) & Regular & \textbf{Bold} & \textit{Italic} & \textbf{\textit{Bold Italic}} \\
Sans Serif & \textsf{Regular} & \textbf{\textsf{Bold}} & \textit{\textsf{Bold}} & \textbf{\textit{\textsf{Bold}}} \\
Typewriter & \texttt{Regular} & \textbf{\texttt{Bold}} & \textit{\texttt{Bold}} & \textbf{\textit{\texttt{Bold}}} \\
Math & $\mathnormal{Regular} \mathrm{Roman}$ & $\mathbf{Bold}$ & $\mathit{Italic}$ & $\mathbf{\mathit{Bold Italic}}$ \\ \bottomrule
\end{tabular}
\end{table}

\begin{itemize}[nosep]
\item \colorbox{orange}{宋体粗体}在 Windows 下会成为黑体。这是因为 Windows 的中易宋体没有粗体字重而进行的妥协。
如果想要获得宋体粗体的样式,请在配置中开启伪粗体选项。
\item \colorbox{gray}{粗斜体}的效果是因操作系统字体而定的,中文写作中不会使用这种字形,可以忽略。
\end{itemize}
7 changes: 6 additions & 1 deletion templates/undergraduate-thesis/main.tex
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@

% 开启盲审格式 blindPeerReview=true (如:[type=bachelor,blindPeerReview=true])

\PassOptionsToPackage{table}{xcolor}
\documentclass[type=bachelor]{bithesis}

\BITSetup{
Expand Down Expand Up @@ -56,9 +57,12 @@
% externalSupervisor = 左偏树,
},
style = {
% 保持参考文献的缩进样式与 Word 模板一致。
% 学校提供的 Word 模板没有使用悬挂缩进。
% 因此通过关闭这个选项保持参考文献的缩进样式与 Word 模板一致。
% 如果你不需要此样式,请将此行注释掉。
bibliographyIndent = false,
% 开启 Windows 平台下的中易宋体伪粗体。
% windowsSimSunFakeBold = true,
}
}

Expand All @@ -67,6 +71,7 @@
% 然而由于 minted 依赖 Python 的 Pygments 库作为外部依赖,因此出于模板的简洁程度考虑,我们没有提供 minted 进行代码块书写的示例。
\usepackage{listings}


\usepackage[
backend=biber,
style=gb7714-2015,
Expand Down

0 comments on commit 124cc25

Please sign in to comment.