fix: specify sans-serif font in OG image SVG text elements
The SVG text elements had no font-family, causing usvg to default to Times New Roman which isn't installed on the server. Specifying sans-serif uses the system default and silences the warnings. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -309,14 +309,14 @@ fn render_contributions_png(
|
||||
String::new()
|
||||
};
|
||||
svg.push_str(&format!(
|
||||
r##"<text x="{x}" y="18" fill="#ecf0f1" font-size="12" opacity="0.6">{total} contributions since {from}{repo_text}</text>"##,
|
||||
r##"<text x="{x}" y="18" fill="#ecf0f1" font-family="sans-serif" font-size="12" opacity="0.6">{total} contributions since {from}{repo_text}</text>"##,
|
||||
x = year_label_w,
|
||||
));
|
||||
|
||||
for (row_idx, row) in rows.iter().enumerate() {
|
||||
let y_base = title_h + (row_idx as f64) * step;
|
||||
svg.push_str(&format!(
|
||||
r##"<text x="{x}" y="{y}" text-anchor="end" dominant-baseline="central" fill="#ecf0f1" font-size="9" opacity="0.6">{yr}</text>"##,
|
||||
r##"<text x="{x}" y="{y}" text-anchor="end" dominant-baseline="central" fill="#ecf0f1" font-family="sans-serif" font-size="9" opacity="0.6">{yr}</text>"##,
|
||||
x = year_label_w - 4.0,
|
||||
y = y_base + radius,
|
||||
yr = row.year,
|
||||
|
||||
Reference in New Issue
Block a user