Size CV heading accent bar to the word width
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
+8
-3
@@ -637,22 +637,27 @@ const RC = {
|
|||||||
// motif that gives every section a confident, consistent anchor.
|
// motif that gives every section a confident, consistent anchor.
|
||||||
function cvHeading(doc, S, dry, cur, title, ruleRight) {
|
function cvHeading(doc, S, dry, cur, title, ruleRight) {
|
||||||
const pt = 10.5;
|
const pt = 10.5;
|
||||||
|
const cs = 0.9 * S;
|
||||||
cur.y += 3.6 * S;
|
cur.y += 3.6 * S;
|
||||||
doc.setFont('Lato', 'bold');
|
doc.setFont('Lato', 'bold');
|
||||||
doc.setFontSize(pt * S);
|
doc.setFontSize(pt * S);
|
||||||
|
const label = String(title).toUpperCase();
|
||||||
const lineY = cur.y + pt * S * PT * 1.08;
|
const lineY = cur.y + pt * S * PT * 1.08;
|
||||||
if (!dry) {
|
if (!dry) {
|
||||||
doc.setCharSpace(0.9 * S);
|
doc.setCharSpace(cs);
|
||||||
doc.setTextColor(RC.accent[0], RC.accent[1], RC.accent[2]);
|
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);
|
doc.setCharSpace(0);
|
||||||
const right = ruleRight || RV_R;
|
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.setDrawColor(RC.hair[0], RC.hair[1], RC.hair[2]);
|
||||||
doc.setLineWidth(0.3 * S);
|
doc.setLineWidth(0.3 * S);
|
||||||
doc.line(RV.mx, lineY, right, lineY);
|
doc.line(RV.mx, lineY, right, lineY);
|
||||||
doc.setDrawColor(RC.accent[0], RC.accent[1], RC.accent[2]);
|
doc.setDrawColor(RC.accent[0], RC.accent[1], RC.accent[2]);
|
||||||
doc.setLineWidth(1.0 * S);
|
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;
|
cur.y += pt * S * PT + 4.0 * S;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user