LaTeX template: requires 'Source Serif 4 SemiBold' font that isn't installed #14

Closed
opened 2026-07-09 15:43:47 -04:00 by jared · 1 comment
Owner

Summary

The LaTeX preamble inst/quarto/latex/civilytics.tex requires a Source Serif 4 SemiBold system font that the package never installs and that a standard Source Serif 4 install doesn't include, so xelatex/lualatex renders fail.

The offending lines

\setmainfont{Source Serif 4}[
  UprightFont = *,
  ItalicFont = * Italic,
  BoldFont = * SemiBold,
  BoldItalicFont = * SemiBold Italic,
  Ligatures = TeX,
]

Error

Package fontspec Error: The font "Source Serif 4 SemiBold" cannot be found.

Root cause

  • The package installs no system fonts for the PDF/fontspec path. R/fonts.R only registers fonts via sysfonts/showtext (for ggplot2 raster output), and the SCSS pulls webfonts — neither puts a SemiBold face on the system where fontspec looks.
  • A standard Source Serif 4 install ships Regular / Bold / Italic / BoldItalic — there is no SemiBold weight by default.
  • Even when a SemiBold weight is present, naming is inconsistent: Adobe's static face is Source Serif 4 Semibold (lowercase "b"), while Google names it SemiBold — so BoldFont = * SemiBold still won't match Adobe's file.

Suggested fix

Don't require a weight that isn't guaranteed. Use the always-present Bold weight — drop the explicit BoldFont/BoldItalicFont overrides so fontspec auto-selects the family's native Bold/BoldItalic:

\setmainfont{Source Serif 4}[
  UprightFont = *,
  ItalicFont  = * Italic,
  Ligatures   = TeX,
]

(If the lighter SemiBold look is desired, ship the SemiBold face with the package or via a font-install helper and select it by weight — but the template shouldn't hard-require a face the setup doesn't provide.)

Found while rendering a branded PDF (COG finance API spec).

## Summary The LaTeX preamble `inst/quarto/latex/civilytics.tex` requires a **Source Serif 4 SemiBold** system font that the package never installs and that a standard Source Serif 4 install doesn't include, so xelatex/lualatex renders fail. ## The offending lines ```latex \setmainfont{Source Serif 4}[ UprightFont = *, ItalicFont = * Italic, BoldFont = * SemiBold, BoldItalicFont = * SemiBold Italic, Ligatures = TeX, ] ``` ## Error ``` Package fontspec Error: The font "Source Serif 4 SemiBold" cannot be found. ``` ## Root cause - The package installs **no system fonts** for the PDF/fontspec path. `R/fonts.R` only registers fonts via `sysfonts`/`showtext` (for ggplot2 raster output), and the SCSS pulls webfonts — neither puts a SemiBold face on the system where `fontspec` looks. - A standard Source Serif 4 install ships **Regular / Bold / Italic / BoldItalic** — there is no SemiBold weight by default. - Even when a SemiBold weight is present, naming is inconsistent: Adobe's static face is `Source Serif 4 Semibold` (lowercase "b"), while Google names it `SemiBold` — so `BoldFont = * SemiBold` still won't match Adobe's file. ## Suggested fix Don't require a weight that isn't guaranteed. Use the always-present Bold weight — drop the explicit `BoldFont`/`BoldItalicFont` overrides so `fontspec` auto-selects the family's native Bold/BoldItalic: ```latex \setmainfont{Source Serif 4}[ UprightFont = *, ItalicFont = * Italic, Ligatures = TeX, ] ``` (If the lighter SemiBold look is desired, ship the SemiBold face with the package or via a font-install helper and select it by weight — but the template shouldn't hard-require a face the setup doesn't provide.) Found while rendering a branded PDF (COG finance API spec).
Author
Owner

Fixed in PR #15 (merged to master).

Fixed in PR #15 (merged to master).
jared closed this issue 2026-07-09 16:19:18 -04:00
Sign in to join this conversation.
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Civilytics/civilyticsR#14