158 lines
4.7 KiB
TeX
158 lines
4.7 KiB
TeX
\NeedsTeXFormat{LaTeX2e}
|
|
\ProvidesExplPackage{PrimeTeX/packages/Fonts}{2025-09-18}{1.0}{
|
|
Font definitions.
|
|
}
|
|
|
|
% Loading math fonts takes a long time, so skip it in draft mode.
|
|
\bool_if:NF \g_draft_bool {
|
|
\RequirePackage{notomath}
|
|
}
|
|
|
|
\NewDocumentCommand{\fontpath}{}{PrimeTeX/fonts}
|
|
|
|
% Main font: Roboto Serif (Light), with symbols merged in from, in order of
|
|
% priority, Noto Serif, Noto Emoji, Noto Sans Symbols, and Noto
|
|
% Sans Symbols 2.
|
|
\setmainfont{RobotoSerif}[
|
|
Path = {\fontpath/RobotoSerif/},
|
|
Extension = .ttf,
|
|
UprightFont = *-Light,
|
|
BoldFont = *-SemiBold,
|
|
ItalicFont = *-LightItalic,
|
|
BoldItalicFont = *-SemiBoldItalic,
|
|
]
|
|
|
|
% Sans serif font: Roboto (Medium).
|
|
\setsansfont{Roboto}[
|
|
Path = {\fontpath/Roboto/},
|
|
Extension = .ttf,
|
|
UprightFont = *-Medium,
|
|
BoldFont = *-Bold,
|
|
ItalicFont = *-MediumItalic,
|
|
BoldItalicFont = *-BoldItalic,
|
|
]
|
|
|
|
% Monospace font: Roboto Mono
|
|
\setmonofont{RobotoMono}[
|
|
Path = {\fontpath/RobotoMono/},
|
|
Extension = .ttf,
|
|
UprightFont = *-Regular,
|
|
BoldFont = *-Bold,
|
|
ItalicFont = *-Italic,
|
|
BoldItalicFont = *-BoldItalic,
|
|
]
|
|
|
|
% Headings & Titles font: Roboto Slab (Semibold).
|
|
\newfontfamily{\sbfamily}{RobotoSlab}[
|
|
Path = {\fontpath/},
|
|
Extension = .ttf,
|
|
UprightFont = RobotoSlab/RobotoSlab-SemiBold,
|
|
BoldFont = RobotoSlab/RobotoSlab-Black,
|
|
% Roboto Slab doesn't have any italic form, so use
|
|
% the Roboto Serif version.
|
|
ItalicFont = RobotoSerif/RobotoSerif-SemiBoldItalic,
|
|
BoldItalicFont = RobotoSerif/RobotoSerif-ExtraBoldItalic,
|
|
]
|
|
|
|
% Emoji font: Noto Emoji
|
|
% \newfontfamily{\emojifamily}{NotoEmoji}[
|
|
% Path = {\fontpath/},
|
|
% Extension = .ttf,
|
|
% UprightFont = NotoEmoji/NotoEmoji-Regular,
|
|
% BoldFont = NotoEmoji/NotoEmoji-Bold,
|
|
% ItalicFont = NotoEmoji/NotoEmoji-Light,
|
|
% BoldItalicFont = NotoEmoji/NotoEmoji-SemiBold,
|
|
% ]
|
|
|
|
% \newfontfamily{\mathfamily}{NotoSerif}[
|
|
% Path = {\fontpath/NotoSerif/},
|
|
% Extension = .ttf,
|
|
% UprightFont = *-Regular,
|
|
% BoldFont = *-Bold,
|
|
% ItalicFont = *-Italic,
|
|
% BoldItalicFont = *-BoldItalic,
|
|
% ]
|
|
|
|
% % Symbol font: Noto Sans Symbols 2
|
|
% \newfontfamily{\symbfamily}{NotoSansSymbols}[
|
|
% Path = {\fontpath/NotoSansSymbols/},
|
|
% Extension = .ttf,
|
|
% UprightFont = *-Regular,
|
|
% BoldFont = *-Bold,
|
|
% ItalicFont = *-Light,
|
|
% BoldItalicFont = *-SemiBold,
|
|
% ]
|
|
|
|
\setmathrm{RobotoSerif}
|
|
|
|
\NewDocumentCommand{\serif}{m}{\textrm{#1}}
|
|
\NewDocumentCommand{\sans}{m}{\textsf{#1}}
|
|
\NewDocumentCommand{\mono}{m}{\texttt{#1}}
|
|
\NewDocumentCommand{\slab}{m}{{\sbfamily{}#1}}
|
|
\NewDocumentCommand{\code}{m}{\mono{\small{}#1}}
|
|
% \NewDocumentCommand{\emoji}{m}{{\emojifamily{}#1}}
|
|
% \NewDocumentCommand{\maths}{m}{{\mathfamily{}#1}}
|
|
% \NewDocumentCommand{\symb}{m}{{\symbfamily{}#1}}
|
|
|
|
%------------------------------- Symbol Commands -------------------------------
|
|
|
|
% Line-breaking zero-width space.
|
|
\NewDocumentCommand{\zws}{}{\hspace{0pt}}
|
|
% Line-breaking dot.
|
|
\NewDocumentCommand{\bdot}{}{.\zws}
|
|
|
|
% Text-mode angle bracket ornaments.
|
|
\NewDocumentCommand{\ab}{s O{}}{〈#1〉}
|
|
|
|
\NewDocumentCommand{\checkmark}{s O{PrimeGreen} O{PrimeBrightGreen}}{
|
|
\bool_if:nTF {#1} {
|
|
\ColorText[#2][#3][]{✓}
|
|
} {
|
|
{✓}
|
|
}
|
|
}
|
|
\NewDocumentCommand{\xmark}{s O{PrimeRed} O{PrimeBrightRed}}{
|
|
\bool_if:nTF {#1} {
|
|
\ColorText[#2][#3][]{✗}
|
|
} {
|
|
{✗}
|
|
}
|
|
}
|
|
|
|
%--------------------------- MenuKeys Configuration ----------------------------
|
|
|
|
\newmenucolortheme{autoModeColor}{named}{pageColor}{textColor}{textColor}[pageColor][textColor][textColor]
|
|
|
|
\changemenucolortheme{hyphenatepaths}{autoModeColor}
|
|
\changemenucolortheme{shadowedroundedkeys}{autoModeColor}
|
|
\changemenucolortheme{angularmenus}{autoModeColor}
|
|
|
|
\cs_new:Nn \__MenuKeys_path_style: {
|
|
\sffamily\color{\usemenucolor{txt}}\CurrentMenuElement
|
|
}
|
|
|
|
\changemenuelement*{hyphenatepaths}{first}{\__MenuKeys_path_style:}
|
|
\changemenuelement*{hyphenatepaths}{middle}{\__MenuKeys_path_style:}
|
|
\changemenuelement*{hyphenatepaths}{last}{\__MenuKeys_path_style:}
|
|
\changemenuelement*{hyphenatepaths}{single}{\__MenuKeys_path_style:}
|
|
|
|
\renewmenumacro{\directory}[/]{hyphenatepaths}
|
|
\renewmenumacro{\keys}[+]{shadowedroundedkeys}
|
|
\renewmenumacro{\menu}[>]{angularmenus}
|
|
|
|
\RenewDocumentCommand{\ctrlname}{}{$\wedge$}
|
|
|
|
\NewDocumentCommand{\ControlString}{}{Ctrl}
|
|
\NewDocumentCommand{\EnterString}{}{Enter\,\return}
|
|
\NewDocumentCommand{\ShiftString}{}{Shift\,\shift}
|
|
\NewDocumentCommand{\AltString}{}{Alt\,\altmac}
|
|
\NewDocumentCommand{\TabString}{}{Tab\,\tab}
|
|
|
|
\NewDocumentCommand{\ControlKey}{}{\keys{\ControlString}}
|
|
\NewDocumentCommand{\EnterKey}{}{\keys{\EnterString}}
|
|
\NewDocumentCommand{\ShiftKey}{}{\keys{\ShiftString}}
|
|
\NewDocumentCommand{\AltKey}{}{\keys{\AltString}}
|
|
\NewDocumentCommand{\TabKey}{}{\keys{\TabString}}
|
|
|
|
% Suppress warning about obsolete font encodings because we're using Unicode.
|
|
\@tw@hyphenatepaths@warnigfalse %[sic] |