diff docs/_latex/my-doc-fonts.sty @ 221:38e2d8ab4965

Implement a style that uses the Libertinus fonts
author Franz Glasner <fzglas.hg@dom66.de>
date Fri, 15 May 2026 18:19:46 +0200
parents 2af9ad8230c7
children be0cca3df1eb
line wrap: on
line diff
--- a/docs/_latex/my-doc-fonts.sty	Fri May 15 17:25:05 2026 +0200
+++ b/docs/_latex/my-doc-fonts.sty	Fri May 15 18:19:46 2026 +0200
@@ -24,6 +24,7 @@
 \newif\if@mdf@WithAdobeSourcePro
 \newif\if@mdf@WithSpectral
 \newif\if@mdf@WithCharter
+\newif\if@mdf@WithLibertinus
 
 % A key compatible with options processing as option "fonts" but choices.
 \define@choicekey*{my-doc-fonts.sty}{fonts}[\val\nr]{%
@@ -32,7 +33,8 @@
   plex-dejavusansmono,
   adobesourcepro, adobesource,
   spectral,
-  charter}{%
+  charter,
+  libertinus}{%
   % Not used for now : store the normalized option value (global and expanded)
   \xdef\@mdf@fonts{\val}%
   % Reset all option related font selection flags
@@ -42,6 +44,7 @@
   \@mdf@WithAdobeSourceProfalse
   \@mdf@WithSpectralfalse
   \@mdf@WithCharterfalse
+  \@mdf@WithLibertinusfalse
   % Now set the needed font selection flag
   \ifcase\nr\relax
     \@mdf@WithDejaVuSansMonotrue
@@ -63,6 +66,8 @@
    \@mdf@WithSpectraltrue
   \or
     \@mdf@WithChartertrue
+  \or
+    \@mdf@WithLibertinustrue
   \fi
 }
 
@@ -164,6 +169,43 @@
   ]
   \@mdf@mono@inconsolatatrue
 \fi
+\if@mdf@WithLibertinus
+  \RequirePackage{newunicodechar}
+  \RequirePackage[lining,tabular]{libertinus-otf}
+  \defaultfontfeatures{}
+  \newfontfamily\DejaVuSansMono{DejaVu Sans Mono}[%
+    UprightFont = *,
+    BoldFont = * Bold,
+    ItalicFont = * Oblique,
+    BoldItalicFont = * Bold Oblique,
+    Scale=MatchLowercase,
+    Ligatures=TeX,
+  ]
+  \newunicodechar{▷}{{\DejaVuSansMono ▷}}% U+25B7
+  \newunicodechar{∶}{{\DejaVuSansMono ∶}}% U+2236
+  \newunicodechar{◆}{{\DejaVuSansMono ◆}}% U+25C6
+  \newunicodechar{▪}{{\DejaVuSansMono ▪}}% U+25AA
+  \newunicodechar{⟵}{{\DejaVuSansMono ⟵}}% U+27F5
+  \newunicodechar{⟶}{{\DejaVuSansMono ⟶}}% U+27F6
+  \newunicodechar{⟷}{{\DejaVuSansMono ⟷}}% U+27F7
+  \newunicodechar{⇒}{{\DejaVuSansMono ⇒}}% U+21D2
+  \newunicodechar{⇔}{{\DejaVuSansMono ⇔}}% U+21D4
+  \newunicodechar{≟}{{\DejaVuSansMono ≟}}% U+225F
+  \newunicodechar{∈}{{\DejaVuSansMono ∈}}% U+2208
+  \newunicodechar{∌}{{\DejaVuSansMono ∌}}% U+220C
+  \newunicodechar{≠}{{\DejaVuSansMono ≠}}% U+2260
+  \newunicodechar{≤}{{\DejaVuSansMono ≤}}% U+2264
+  \newunicodechar{≥}{{\DejaVuSansMono ≥}}% U+2265
+  %\newunicodechar{␣}{{\DejaVuSansMono ␣}}% U+2423  Missing!
+  %\newunicodechar{^^^^2423}{{\DejaVuSansMono^^^^2423}}% U+2423
+  %\newunicodechar{␣}{\textvisiblespace}% U+2423
+  %\catcode`^^^^2423\active\protected\def^^^^2423{\textvisiblespace}
+
+  \PassOptionsToPackage{%
+    verbatimvisiblespace={\textcolor{red}{{\DejaVuSansMono^^^^2423}}},%
+    verbatimcontinued={\textcolor{red}{{\DejaVuSansMono^^^^21aa}}}}%
+    {sphinx}
+\fi
 
 \defaultfontfeatures{}