summaryrefslogtreecommitdiff
path: root/fonts/cascadia-code/latex/cascadia-code.sty
diff options
context:
space:
mode:
Diffstat (limited to 'fonts/cascadia-code/latex/cascadia-code.sty')
-rw-r--r--fonts/cascadia-code/latex/cascadia-code.sty60
1 files changed, 60 insertions, 0 deletions
diff --git a/fonts/cascadia-code/latex/cascadia-code.sty b/fonts/cascadia-code/latex/cascadia-code.sty
new file mode 100644
index 0000000000..ae9d577772
--- /dev/null
+++ b/fonts/cascadia-code/latex/cascadia-code.sty
@@ -0,0 +1,60 @@
+\NeedsTeXFormat{LaTeX2e}
+\ProvidesPackage{cascadia-code}
+ [2021/01/19 (Carl-Clemens Ebinger & autoinst) Style file for Cascadia Code fonts.]
+
+\RequirePackage{xkeyval}
+\newcommand*{\CascadiaCodThree@scale}{1}
+\DeclareOptionX{scale}{\renewcommand*{\CascadiaCodThree@scale}{#1}}
+\DeclareOptionX{scaled}{\renewcommand*{\CascadiaCodThree@scale}{#1}}
+
+\DeclareOptionX{lining}{\edef\CascadiaCodThree@figurestyle{LF}}
+\DeclareOptionX{tabular}{\edef\CascadiaCodThree@figurealign{T}}
+\DeclareOptionX{mainfont}{
+ \renewcommand{\familydefault}{\rmdefault}
+}
+\DeclareOptionX{semibold}{\edef\bfseries@rm{semibold}}
+\DeclareOptionX{bold}{\edef\bfseries@rm{bold}}
+\DeclareOptionX{regular}{\edef\mdseries@rm{regular}}
+\ExecuteOptionsX{lining,tabular}
+\ProcessOptionsX\relax
+
+\RequirePackage{fontenc,textcomp}
+\RequirePackage{ifthen}
+\RequirePackage{mweights}
+
+\IfFileExists{fontaxes.sty}{
+ \RequirePackage{fontaxes}
+ \fa@naming@exception{figures}{{superior}{proportional}}{Sup}
+ \fa@naming@exception{figures}{{superior}{tabular}}{Sup}
+ \def\supfigures{\@nomath\supfigures
+ \fontfigurestyle{superior}\selectfont}
+ \let\sufigures\supfigures
+ \DeclareTextFontCommand{\textsup}{\supfigures}
+ \let\textsu\textsup
+ \let\textsuperior\textsup
+
+}{}
+
+% Here we implement the scale=MatchLowercase option.
+% If this is given, we must compute the correct value of
+% the "\CascadiaCodThree@scale" parameter before loading the .fd files;
+% but to determine that value we of course need the font's x-height.
+% To avoid triggering the loading of .fd files,
+% we use plain TeX's \font primitive to load the testfont.
+% We then compute the ratio of the current x-height to our font's x-height;
+% this is the "\CascadiaCodThree@scale" we will pass to the .fd files.
+\ifthenelse{\equal{\CascadiaCodThree@scale}{MatchLowercase}}
+ { \newlength{\CascadiaCodThree@currentx}
+ \settoheight{\CascadiaCodThree@currentx}{x}
+ \newlength{\CascadiaCodThree@xheight}
+ \settoheight{\CascadiaCodThree@xheight}
+ {{\font\testfont=CascadiaCod3-Regular-tlf-ot1 at \f@size pt\testfont x}}
+ \renewcommand*{\CascadiaCodThree@scale}
+ {\strip@pt\dimexpr\number\numexpr\number\dimexpr\CascadiaCodThree@currentx\relax*65536/\number\dimexpr\CascadiaCodThree@xheight\relax\relax sp\relax}}
+ {}
+
+\renewcommand*
+ {\ttdefault}
+ {CascadiaCodThree-\CascadiaCodThree@figurealign\CascadiaCodThree@figurestyle}
+
+\endinput