changeset 204:afecfdcfd288

A new style "charter" for PDFs with "XCharter", "Lato" and "Inconsolata". Used e.g. for ConfigMix PDF docs.
author Franz Glasner <fzglas.hg@dom66.de>
date Wed, 13 May 2026 14:34:39 +0200
parents ede8b44f6faf
children c80b430fdc0f
files docs/_latex/my-doc-fonts.sty docs/conf.py
diffstat 2 files changed, 44 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/docs/_latex/my-doc-fonts.sty	Wed May 13 13:56:29 2026 +0200
+++ b/docs/_latex/my-doc-fonts.sty	Wed May 13 14:34:39 2026 +0200
@@ -15,18 +15,21 @@
 }
 
 \newif\if@mdf@@sscode\@mdf@@sscodefalse
+\newif\if@mdf@@inconsolata\@mdf@@inconsolatafalse
 
 \newif\if@mdf@WithDejaVuSansMono
 \newif\if@mdf@WithPlexMono
 \newif\if@mdf@WithAdobeSource
 \newif\if@mdf@WithSpectral
+\newif\if@mdf@WithCharter
 
-\def\@mdf@reset@font@options{\@mdf@WithDejaVuSansMonofalse\@mdf@WithPlexMonofalse\@mdf@WithAdobeSourcefalse}
+\def\@mdf@reset@font@options{\@mdf@WithDejaVuSansMonofalse\@mdf@WithPlexMonofalse\@mdf@WithAdobeSourcefalse\@mdf@WithCharterfalse}
 
 \DeclareOptionX{dejavusansmono}[true]{\@mdf@reset@font@options\csname @mdf@WithDejaVuSansMono#1\endcsname}
 \DeclareOptionX{plexmono}[true]{\@mdf@reset@font@options\csname @mdf@WithPlexMono#1\endcsname}
 \DeclareOptionX{adobesource}[true]{\@mdf@reset@font@options\csname @mdf@WithAdobeSource#1\endcsname}
 \DeclareOptionX{spectral}[true]{\@mdf@reset@font@options\csname @mdf@WithSpectral#1\endcsname}
+\DeclareOptionX{charter}[true]{\@mdf@reset@font@options\csname @mdf@WithCharter#1\endcsname}
 
 %
 % By default use the safe option dejavusansmono because is contains
@@ -108,6 +111,18 @@
   ]
   \@mdf@@sscodetrue
 \fi
+\if@mdf@WithCharter
+  \defaultfontfeatures{Ligatures=TeX,Numbers={Lining,Tabular}}
+  \setmainfont{XCharter}
+  \setsansfont{Lato}[
+    UprightFont = * Regular,
+    BoldFont = * Bold,
+    ItalicFont = * Italic,
+    BoldItalicFont = * Bold Italic,
+    Scale = MatchLowercase,
+  ]
+  \@mdf@@inconsolatatrue
+\fi
 
 \defaultfontfeatures{}
 
@@ -142,6 +157,31 @@
     {sphinx}
 \fi
 
+\if@mdf@@inconsolata
+  \RequirePackage{newunicodechar}
+  \defaultfontfeatures{Ligatures=TeX,Numbers={Lining,Tabular},Scale=MatchLowercase}
+  \setmonofont{Inconsolata LGC Nerd Font Mono}[%
+    UprightFont = *,
+    BoldFont = * Bold,
+    ItalicFont = * Italic,
+    BoldItalicFont = * Bold Italic,
+  ]
+  \defaultfontfeatures{}
+  \newfontfamily\DejaVuSansMono{DejaVu Sans Mono}[%
+    UprightFont = *,
+    BoldFont = * Bold,
+    ItalicFont = * Oblique,
+    BoldItalicFont = * Bold Oblique,
+  ]
+  \newunicodechar{∶}{{\DejaVuSansMono ∶}}% U+2236
+  \newunicodechar{⟵}{{\DejaVuSansMono ⟵}}% U+27F5
+  \newunicodechar{⟶}{{\DejaVuSansMono ⟶}}% U+27F6
+  \newunicodechar{⟷}{{\DejaVuSansMono ⟷}}% U+27F7
+  \newunicodechar{≟}{{\DejaVuSansMono ≟}}% U+225F
+  \newunicodechar{∈}{{\DejaVuSansMono ∈}}% U+2208
+  \newunicodechar{∌}{{\DejaVuSansMono ∌}}% U+220C
+\fi
+
 \defaultfontfeatures{}
 
 \endinput
--- a/docs/conf.py	Wed May 13 13:56:29 2026 +0200
+++ b/docs/conf.py	Wed May 13 14:34:39 2026 +0200
@@ -146,9 +146,10 @@
 latex_elements = {
     "papersize": "a4paper",
     "babel": r"\usepackage{babel}",
-#    "fontpkg": r"\usepackage[plexmono]{my-doc-fonts}",
-   "fontpkg": r"\usepackage[adobesource]{my-doc-fonts}",
+#   "fontpkg": r"\usepackage[plexmono]{my-doc-fonts}",
+    "fontpkg": r"\usepackage[adobesource]{my-doc-fonts}",
 #   "fontpkg": r"\usepackage[spectral]{my-doc-fonts}",
+#   "fontpkg": r"\usepackage[charter]{my-doc-fonts}",
     "releasename": "Version",
     "fncychap": r"\usepackage[Sonny]{fncychap}",
 }