Add Optional Parley Text Engine#931
Draft
CryZe wants to merge 2 commits into
Draft
Conversation
This adds Parley as an optional path based text engine alongside the existing cosmic-text implementation. It can be selected with the `parley-text-engine` feature, including together with `software-rendering` or `svg-rendering`, while cosmic-text remains the default for existing users. Parley handles font matching, fallback, shaping, bidirectional text, and glyph positioning, while Skrifa extracts the resulting glyph outlines. The implementation preserves the existing renderer-facing font and label API, including ellipsis truncation, tabular number features, monospaced digit emulation, variable font coordinates, and glyph path caching. This also supports COLR version 0 color fonts by expanding CPAL-colored layers into the ordered paths understood by the software and SVG renderers. Rendering tests have separate expected hashes for Parley where its shaping, fallback, or path generation differs from cosmic-text.
Enable the Fontique fontconfig-dlopen feature whenever the optional Parley text engine is selected. This keeps Linux system font discovery available without requiring the Fontconfig development package or its pkg-config metadata at build time. The all-features Clippy and benchmark jobs previously failed in yeslogic-fontconfig-sys before compiling LiveSplit because the GitHub runner does not provide fontconfig.pc. Runtime loading matches the intended portable Fontique configuration and leaves the Windows and Apple system font backends unchanged.
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.
This adds Parley as an optional path based text engine alongside the
existing cosmic-text implementation. It can be selected with the
parley-text-enginefeature, including together withsoftware-renderingorsvg-rendering, while cosmic-text remains thedefault for existing users.
Parley handles font matching, fallback, shaping, bidirectional text, and
glyph positioning, while Skrifa extracts the resulting glyph outlines.
The implementation preserves the existing renderer-facing font and
label API, including ellipsis truncation, tabular number features,
monospaced digit emulation, variable font coordinates, and glyph path
caching.
This also supports COLR version 0 color fonts by expanding CPAL-colored
layers into the ordered paths understood by the software and SVG
renderers. Rendering tests have separate expected hashes for Parley
where its shaping, fallback, or path generation differs from
cosmic-text.
Draft Status
This is currently a draft because Parley / Fontique has a known system
font fallback problem on Windows, tracked in
linebender/parley#644.
Fontique currently asks DirectWrite for a single fallback family for a
script and locale by probing a representative script sample. For Han,
the sample is
今, which causes DirectWrite to selectYu Gothic UIonthe affected system. Fontique then caches that as the only Han fallback
family.
Yu Gothic UIcontains字and漢, but not simplified汉,even though another installed family such as
Microsoft YaHei UIcontains all three. As a result, Parley renders
汉as the missing-glyphsymbol.
The implementation remains opt-in until fallback selection can consider
the actual text or expose enough ordered fallback families for Parley's
coverage checks to select a suitable font.
Validation
cargo check --no-default-features --features parley-text-enginecargo test --no-default-features --features std,software-rendering,parley-text-engine --test renderingcargo test --no-default-features --features std,svg-rendering,parley-text-engine --test renderingcargo check --all-featurescargo clippy --no-default-features --features std,localization,software-rendering,parley-text-engine --lib -- -D warnings