Repository navigation
refactor: shape text with HarfRust and draw glyphs with Skrifa - #230
Merged
Merged
Conversation
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.
What this changes
Text shaping, glyph drawing and a few hand-written Unicode and image routines move to maintained implementations. Refs DEEIX-AI/Winc#953, where a Devanagari reph crashed the old shaper.
र्कno longer drops or panics; fonts that shape only throughmorx, such as Thai's Thonburi on macOS, are used directly, so the stand-in fonts for them are gone; emoji sequences such as families show as one picture on Windows. Shape plans are cached per font and settings.read-fontswith HarfRust. Color glyphs are drawn here: solidCOLRlayers, andsbix/CBDTimages through a small PNG decoder. Optical sizes follow the font'savarand stay within the axis. zeno is used directly.icu_segmenterapplies the Unicode line breaking rules, with the strict rules for CJK punctuation. Lines also break after hyphens and at zero-width spaces, never at no-break spaces or within numbers.word-breakstill adds the dictionaries for Thai, Lao, Khmer and Myanmar.Bitmap::from_pngand the clipboard; thepngcrate is no longer a dependency. Thepngfeature is kept and does nothing, so builds that enable it still work.hellosize budget moves from 2.5 MB to 3.0 MB.Measurements
macOS, Apple M4 Pro, release builds, scale 2. "Before" is
devat 3bd810c, "after" is this branch. Frame times are medians of 4 runs ofcpui-bench, as p50 / p95.helloexecutablelistwindowlistwindowhellowindowhellocpui-benchframe, p50 / p95 (ms)The size grows by 436 KB, mostly HarfRust (about 374 KB of code, its AAT support included) and the
read-fontsfont model. Specimens of every script were drawn before and after on macOS, Linux and Windows; Latin and CJK on Linux are identical pixel for pixel, hinting included.Checks
See CONTRIBUTING.md for the details.
scripts/check.shpassesCHANGELOG.mdis updated for a change users will noticedocs/anddocs/zh-CN/, if they are affectedcargo run --release -p cpui-benchstays within budget, if per-frame code changed