Size CV heading accent bar to the word width

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-07-03 20:26:28 +02:00
co-authored by Claude Opus 4.8
parent 482d8d86fa
commit 0af731695a
+8 -3
View File
@@ -637,22 +637,27 @@ const RC = {
// motif that gives every section a confident, consistent anchor.
function cvHeading(doc, S, dry, cur, title, ruleRight) {
const pt = 10.5;
const cs = 0.9 * S;
cur.y += 3.6 * S;
doc.setFont('Lato', 'bold');
doc.setFontSize(pt * S);
const label = String(title).toUpperCase();
const lineY = cur.y + pt * S * PT * 1.08;
if (!dry) {
doc.setCharSpace(0.9 * S);
doc.setCharSpace(cs);
doc.setTextColor(RC.accent[0], RC.accent[1], RC.accent[2]);
doc.text(String(title).toUpperCase(), RV.mx, cur.y + pt * S * PT * 0.76);
doc.text(label, RV.mx, cur.y + pt * S * PT * 0.76);
doc.setCharSpace(0);
const right = ruleRight || RV_R;
// Thick accent segment runs exactly as wide as the heading word (charSpace
// adds one gap after every glyph), the thin hairline continues to the edge.
const wordW = doc.getTextWidth(label) + cs * label.length;
doc.setDrawColor(RC.hair[0], RC.hair[1], RC.hair[2]);
doc.setLineWidth(0.3 * S);
doc.line(RV.mx, lineY, right, lineY);
doc.setDrawColor(RC.accent[0], RC.accent[1], RC.accent[2]);
doc.setLineWidth(1.0 * S);
doc.line(RV.mx, lineY, Math.min(RV.mx + 15 * S, right), lineY);
doc.line(RV.mx, lineY, Math.min(RV.mx + wordW, right), lineY);
}
cur.y += pt * S * PT + 4.0 * S;
}