From a47a7539aa2af548bbe2bdaecd18b51ecf6d5fb7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Renaud=20Gue=CC=81rin?= Date: Fri, 20 Mar 2026 01:46:25 +0000 Subject: [PATCH] fix: support both variable and static Source Sans fonts The current font configuration expects separate static font files for each weight (e.g. "Source Sans 3 Light", "Source Sans 3 Bold"), which are not found when only variable fonts are installed. Modern package managers (Homebrew, Google Fonts) ship Source Sans 3 exclusively as variable fonts, causing build failures on macOS and other platforms. Use fontspec RawFeature axis syntax to select weights from variable fonts, and fall back to "Source Sans Pro" (bundled with TeX Live) when "Source Sans 3" is not installed at all. This supports: - Variable fonts from Homebrew/Google Fonts - Static "Source Sans 3" from Adobe or Linux distro packages - Static "Source Sans Pro" from TeX Live (Overleaf, Docker, etc.) Fixes #606, fixes #610 Co-Authored-By: Claude Opus 4.6 --- awesome-cv.cls | 51 ++++++++++++++++++++++++++++++++++---------------- 1 file changed, 35 insertions(+), 16 deletions(-) diff --git a/awesome-cv.cls b/awesome-cv.cls index 8e68d92..47bb4d8 100644 --- a/awesome-cv.cls +++ b/awesome-cv.cls @@ -81,22 +81,41 @@ \defaultfontfeatures{ Renderer=HarfBuzz, } -\setmainfont{Source Sans 3}[ - UprightFont=*, - ItalicFont=* Italic, - BoldFont=* Bold, - BoldItalicFont=* Bold Italic, - FontFace={l}{n}{Font=* Light}, - FontFace={l}{it}{Font=* Light Italic}, -] -\setsansfont{Source Sans 3}[ - UprightFont=*, - ItalicFont=* Italic, - BoldFont=* Bold, - BoldItalicFont=* Bold Italic, - FontFace={l}{n}{Font=* Light}, - FontFace={l}{it}{Font=* Light Italic}, -] +% Support both "Source Sans 3" (variable or static, from Adobe/Homebrew/distro +% packages) and "Source Sans Pro" (static, bundled with TeX Live). +\IfFontExistsTF{Source Sans 3}{% + \setmainfont{Source Sans 3}[ + RawFeature={+axis={wght=400}}, + BoldFont={Source Sans 3}, + BoldFeatures={RawFeature={+axis={wght=700}}}, + ItalicFont={Source Sans 3 Italic}, + ItalicFeatures={RawFeature={+axis={wght=400}}}, + BoldItalicFont={Source Sans 3 Italic}, + BoldItalicFeatures={RawFeature={+axis={wght=700}}}, + FontFace={l}{n}{Font=Source Sans 3, RawFeature={+axis={wght=300}}}, + FontFace={l}{it}{Font=Source Sans 3 Italic, RawFeature={+axis={wght=300}}}, + ] + \setsansfont{Source Sans 3}[ + RawFeature={+axis={wght=400}}, + BoldFont={Source Sans 3}, + BoldFeatures={RawFeature={+axis={wght=700}}}, + ItalicFont={Source Sans 3 Italic}, + ItalicFeatures={RawFeature={+axis={wght=400}}}, + BoldItalicFont={Source Sans 3 Italic}, + BoldItalicFeatures={RawFeature={+axis={wght=700}}}, + FontFace={l}{n}{Font=Source Sans 3, RawFeature={+axis={wght=300}}}, + FontFace={l}{it}{Font=Source Sans 3 Italic, RawFeature={+axis={wght=300}}}, + ] +}{% + \setmainfont{Source Sans Pro}[ + FontFace={l}{n}{Font=*-Light}, + FontFace={l}{it}{Font=*-LightItalic}, + ] + \setsansfont{Source Sans Pro}[ + FontFace={l}{n}{Font=*-Light}, + FontFace={l}{it}{Font=*-LightItalic}, + ] +} \newfontfamily\roboto{Roboto}[ UprightFont=*, ItalicFont=* Italic,