refactor(templates): migrate CV/cover-letter icons from PNG to recolorable SVG#212
Merged
Conversation
…rable SVG Why: the bundled CV template icons were raster PNGs — ~717 KB under templates/cv (the sidebar-portrait portrait.png alone was 431 KB) — which bloats the published jar and cannot be recoloured per template. What: - New internal SvgGlyph helper (cv/v2/widgets) loads a bundled SVG, flattens its filled layers into one ShapeOutline (dropping near-white backing rects), and exposes it for inline rendering via rich.shape(outline, colour). Colour becomes a per-template code knob — one bundled glyph recolours for every template and the icons stay crisp at any zoom. - Migrated the contact / social glyphs in all four icon CV presets (v2 and the deprecated v1: MintEditorial, MonogramSidebar, SidebarPortrait, TimelineMinimal) and the paired TimelineMinimalLetter cover letter to SVG + SvgGlyph; deleted the 29 PNGs. The mint expertise badge keeps its stroked look via SvgIcon.node, recoloured in-file to the mint accent. - Sidebar-portrait avatar is now an SVG rendered via SvgIcon.node — a swappable placeholder users can later replace with their own image. Its CSS-<style> colours were inlined as presentation attributes (the SVG reader does not read <style>), with translucency baked into #rrggbbaa. - IconTextRow now takes the SvgGlyph + colour; the dead raster overload and the WidgetSmokeTest path that loaded the now-deleted phone.png were removed. Result: templates/cv assets drop ~717 KB -> ~133 KB. No public API change and the CV / cover-letter layout is unchanged. Visual baselines were refreshed for the new glyphs and the sidebar-portrait layout snapshot updated for the vector avatar. Verification: ./mvnw clean verify -pl . green (1395 tests); the four CV example PDFs and the timeline cover letter render correctly — icons recoloured per template, and the globe / house / location-pin / avatar all render right.
…lity The PNG->SVG migration removed the public IconTextRow.render(DocumentImageData, ...) overload, which japicmp flagged as METHOD_REMOVED against the v1.7.0 baseline — IconTextRow is public API, so external template authors could call it. Restored the overload (the bundled presets use the recolorable SvgGlyph overload; the raster one stays for callers with their own raster icons), keeping the change source- and binary-compatible.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
The bundled CV template icons were raster PNGs — ~717 KB under
templates/cv(the sidebar-portraitportrait.pngalone was 431 KB) — which bloats the published jar and can't be recoloured per template.What changed
SvgGlyph(cv/v2/widgets) loads a bundled SVG, flattens its filled layers into oneShapeOutline(dropping near-white backing rects), and the presets render it inline + recoloured viarich.shape(glyph.outline(size), ICON_COLOR, …). Colour is a per-template code knob — one bundled glyph recolours for every template and the icons stay crisp at any zoom.TimelineMinimalLettercover letter to SVG +SvgGlyph; deleted the 29 PNGs. The mint expertise badge keeps its stroked look viaSvgIcon.node, recoloured in-file.portrait.svg) viaSvgIcon.node— users can later replace it with their own image. Its CSS-<style>colours were inlined as presentation attributes (the SVG reader doesn't read<style>), translucency baked into#rrggbbaa.IconTextRownow takes theSvgGlyph+ colour; the dead raster overload and theWidgetSmokeTestpath loading the now-deletedphone.pngwere removed.Result:
templates/cvassets ~717 KB → ~133 KB. No public API change; CV/cover-letter layout unchanged.Verification
./mvnw clean verify -pl .→ 1395 tests, 0 failures.Note
Independent of #211 (fonts split) but both edit
CHANGELOG.mdv1.8.0 — whichever merges second may need a one-line CHANGELOG conflict resolution.