fix: embed portable static fonts for CV preview and PDF fidelity

This commit is contained in:
cesnimda
2026-10-24 19:27:10 +02:00
parent 57dd88322a
commit e80815f8df
50 changed files with 1114 additions and 7 deletions
+4 -3
View File
@@ -43,7 +43,8 @@ public sealed class ThemedCvRenderer : IThemedCvRenderer
? SplitColumns(model, theme, sidebarSections, settings)
: (string.Empty, RenderSections(model.Sections, theme, settings));
var css = BuildCss(theme, settings, accent, headerInk, ink, muted, paper, headingColor, headingFont, bodyFont, headingStyle, density, pageDims, layout, twoColumn);
var css = CvDocumentFonts.Embed(headingFont, bodyFont, theme.UtilityFont)
+ BuildCss(theme, settings, accent, headerInk, ink, muted, paper, headingColor, CvDocumentFonts.Stack(headingFont), CvDocumentFonts.Stack(bodyFont), headingStyle, density, pageDims, layout, twoColumn);
var header = RenderHeader(model, theme, showIcons, twoColumn, headerStyle);
var body = layout switch
{
@@ -255,7 +256,7 @@ public sealed class ThemedCvRenderer : IThemedCvRenderer
.header-plain{{border-bottom:2px solid {accent};}}";
var numberedSections = t.NumberSections
? $@".main{{counter-reset:cv-section;}} .main>.section>.section-title{{counter-increment:cv-section;font-family:{t.UtilityFont};font-weight:600;}} .main>.section>.section-title::before{{content:counter(cv-section,decimal-leading-zero) ' — ';color:var(--cv-accent-color);}}"
? $@".main{{counter-reset:cv-section;}} .main>.section>.section-title{{counter-increment:cv-section;font-family:{CvDocumentFonts.Stack(t.UtilityFont)};font-weight:600;}} .main>.section>.section-title::before{{content:counter(cv-section,decimal-leading-zero) ' — ';color:var(--cv-accent-color);}}"
: string.Empty;
return $@"
@@ -304,7 +305,7 @@ h1,h2{{font-family:{headingFont};}}
.paragraphs p{{margin:0 0 {F(1.8 * density)}mm;white-space:pre-line;}}
.skill-groups{{display:grid;gap:{F(1.7 * density)}mm;}}
.skill-group{{display:grid;grid-template-columns:minmax(24mm,.3fr) minmax(0,1fr);gap:3mm;break-inside:avoid-page;page-break-inside:avoid;}}
.skill-group-name{{font-family:{t.UtilityFont};font-weight:700;color:var(--cv-accent-color);overflow-wrap:anywhere;}}
.skill-group-name{{font-family:{CvDocumentFonts.Stack(t.UtilityFont)};font-weight:700;color:var(--cv-accent-color);overflow-wrap:anywhere;}}
.skill-group-items{{display:flex;flex-wrap:wrap;gap:.8mm 3mm;list-style:none;margin:0;padding:0;}}
.skill-group-items li{{overflow-wrap:anywhere;}}
.entry{{margin-bottom:{entryGap}mm;}}