1.1.5 release notes
Released
The measurement release. Testing the engine against real fonts and a real frame budget turned up seven correctness defects and two paths doing far more work than they needed to.
Fixed
- A contour started at the wrong point whenever its first point was off-curve. TrueType begins at point 0 if it is on-curve, otherwise at the last point if that one is, and only failing both at the midpoint. No rasterized comparison can catch this – a closed contour fills identically whichever vertex it starts from.
- CFF2 blending rounded every delta to a whole unit. Charstring coordinates are relative, so the error accumulated along the outline.
- CFF contours restated the closing segment that
closealready draws. - A font carrying both
glyfandCFFalways read CFF.sfntVersionis what breaks the tie. - Macintosh cmap subtables were all read as MacRoman, so a MacOS Turkish subtable resolved six
letters to
.notdef. - An axis tag shorter than four bytes matched nothing, because
fvarstores short tags space-padded.("wght", …)worked and("M1", …)was silently ignored. - Tai Tham was scored against the Universal Shaping Engine’s vowel ordering, which the script does not follow, so ordinary words came back marked as broken clusters. daegun now gives Tai Tham a cluster grammar of its own, scoped to that script so nothing else changes.
Performance
Two root causes account for most of it. Resolving an axis position built a BTreeMap and two
intermediate vectors to hold what is almost always a single axis; and the rasterizer’s overlap
resolution divided in its innermost loop.
| before | after | ||
|---|---|---|---|
Font::shape, cache hit |
285 ns, 13 allocations | 88 ns, 3 | −69% |
rasterize_glyph, first time |
25.7 µs, 31 allocations | 20.8 µs, 16 | −19% |
rasterize_glyph, cached |
73.4 ns | 63.5 ns | −13% |
advance_widths ×1 |
26.0 ns | 19.6 ns | −25% |
colr_v1_paint_graph_variable |
621.7 µs | 555.6 µs | −11% |
CPU raster pipeline, B at 16px |
4.999 µs | 4.543 µs | −9% |
Measured at the frame rather than the call, in a scrolling GPU app: re-laying-out a document of unchanged text fell from 0.0105 ms to 0.0048 ms a frame, and a page zoom from 12 to 96 pixels fell from 0.507 ms to 0.284 ms of rasterization a frame.
Bytes allocated per shape fell furthest of all, from 1,033 to 53.
Full figures in benchmark.md, which is re-measured for this release as the best of three runs.
Added
- Every cache budget is the caller’s. The glyph cache took a budget already; the curve,
outline, shape and variable-instance caches now do too, each with a
_statscall, and the cmap index takes an allowance. In Rust and in C alike. Those five were compile-time constants, which meant a CPU-only program carried the GPU curve cache, a Latin-only one carried a cmap index sized for CJK, and a fixed-weight one carried 64 MB of variable-instance headroom it never touched. daegun_vulkan_renderer_handles,daegun_d3d11_renderer_handlesanddaegun_d3d12_renderer_handles, the interop escape hatch that existed in Rust and had no C entry point.
Changed
Font::shapereturnsShared<ShapedRun>rather than an owned run. This is a breaking change.Sharedderefs toShapedRun, so field reads compile unchanged; moving a field out of the returned run now needs a.clone(). Three call sites needed that across daegun’s own tree.- The default glyph cache is 8 MB, up from 4. A full 12 to 96 pixel page zoom holds 6.9 MB of rasterized glyphs, so the old default evicted continuously through one. Measured: 8 MB removes that and 16 MB adds nothing.
- Resizing a cache evicts down to the new bound and keeps what still fits. It used to discard everything, so making a cache smaller cost you a warm one.