fix(glyph): let bake pass options to a technique - #118
Merged
Conversation
directRasterPlans hard-coded options: undefined for MSDF and Slug, so a technique's own parameters were unreachable from the CLI. Bitmap was the only one whose parameter arrived, and only because --bitmap encodes its strike list positionally. --msdf now takes em-size and pixel-range, parsed and passed to the baker, and a bare --msdf still means the defaults. Slug takes none of its own (SlugBakerOptions is undefined), so it is unchanged. The default em size is 64 atlas texels, and atlas cost is area, so a face set for small copy pays several times over with no way to say so: one multi-script set of 161 code points came to 4.64 MB, where a Telugu face shipped 592 KB for six glyphs. At em-size=32 the same set is 1.33 MB.
size-limit report 📦
|
thejustinwalsh
marked this pull request as ready for review
August 26, 2026 02:36
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.
glyph bakehard-codesoptions: undefinedfor every technique except Bitmap, so a technique's own bake parameters are unreachable from the CLI. The bakers accept them; the CLI never passes any.Bitmap is the only technique whose parameter arrives, and only because
--bitmap 16,32encodes it positionally.--helpdocuments--msdfas "Embed the default MSDF raster" — the default being the only thing on offer.What this changes
--msdfnow takes optional settings, in the same shape as--bitmap's strike list. A bare--msdfstill means the defaults, so nothing existing changes behaviour.Slug is untouched:
SlugBakerOptionsisundefined, so it genuinely has none of its own.Why it matters
emSizedefaults to 64 atlas texels per em, and atlas cost is area, so a face set for small copy pays several times over with no way to say so. Measured on the same six Telugu glyphs:--msdf(em-size 64)--msdf em-size=32--msdf em-size=24,pixel-range=6Quadrupling the atlas area quadruples the artifact, exactly as expected — and 64 was more than twice what a page setting at 28 css px can show. Across a 20-face multi-script set the difference was 4.64 MB → 1.33 MB.
Note for consumers
Raster options are part of the raster identity. A runtime request naming different options than the artifact was baked with derives a different
rasterKey, finds no matching raster, falls back to runtime generation, and fails withRASTER_SOURCE_UNAVAILABLE. Both sides have to name the same values — worth a line in the docs.Design discussion in #117.