mirror of
https://github.com/Komediruzecki/token-circles.git
synced 2026-10-20 09:46:43 +02:00
Reported from the app: Beginnings and Building sat high in their black cutout while Mastery and Legacy looked right, and several glyphs were not dead centre in the medallion. Three separate causes. The faces were cropped out of the generated row by hand, so each medallion landed somewhere slightly different. Beginnings and Building were 19px high in a 440px frame and also smaller than Mastery, 379 and 385 wide against 402. All four are now cropped from the masters by measurement: the content box is found by threshold, the crop is centred on it, and the side is diameter / 0.945 so every band fills its frame identically. All four now centre on (220, 220) within a pixel. The glyphs are drawn by hand and their ink lands where the paths fall, not where the 48-unit box says. a-quarter sat 8.95 units high, half-a-year 7.35, and 23 of 34 were off by at least 0.4. BadgeMedallion has no DOM to measure against — it builds the share card as a string — so the corrections live in GLYPH_OFFSET and are applied in the glyph transform. scripts/measure-badge-glyphs.mjs generates that table by rasterising each glyph at the app's stroke and scanning the alpha channel, so caps and joins count. Every glyph now centres within 0.12 units of the medallion's middle. The comeback's arrowhead was a corner bracket sitting next to an arc that started somewhere else entirely. Both are now generated from one circle: the endpoints sit on r=13 about (24,24) and the head's vertex is the arc's own end point, so the chevron cannot drift off the ring. Two tests guard the table: a typo'd key would miss the lookup silently, and the transform must actually carry the offset.