This repository was archived by the owner on Nov 12, 2026. It is now read-only.
Repository navigation
feat(dioxus): Type::faces, font files a host brings for parley to measure with - #22
Merged
Merged
Conversation
…sure with
leaf-dioxus measured only with the system's fonts, so a host could name a
face only if the machine had it installed. A browser has no system fonts
that parley can read, and a host that wants the same page on every platform
has to bring its own files.
`Type` gains `faces: Faces`, a cheap-to-clone list of TrueType or OpenType
files. `Fonts` registers each file into its parley collection once, by blob
id, when the type is set, so `body` and `mono` can name a bundled face. The
stylesheet is unchanged: the files are the renderer's to load, and the host
gives Blitz's collection the same blobs (`Faces::blobs`). Which faces they
are is the host's choice. `Type::default()` still names Iowan and Menlo.
A test face, Atkinson Hyperlegible Next cut to the alphabet and renamed so
no system has it, shows parley sets text in a host's file.
Behavioural-change: `Type` has a new public field, `faces`, so a `Type { .. }`
literal that lists every field no longer compiles; add
`faces: Default::default()` or end the literal with `..Type::default()`.
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
leaf-dioxus measured text only with the system's fonts. A host could name a face only if the machine had it installed. A browser has no system fonts that parley can read. Diaryx wants the same page on the Mac, iOS and the web (diaryx's proposals A page is set in the same faces everywhere and The author's app runs in a browser), so it brings its own files.
What changes
Typegainsfaces: Faces: a cheap-to-clone list of TrueType or OpenType files, built withcollect()from anythingAsRef<[u8]>.Fontsregisters each file into its parley collection once, by blob id, when the type is set (Fonts::newandset_ty).bodyandmonocan then name a bundled face, andhas_familysees it.Faces::blobs()gives the host the same blobs to register in Blitz's collection (dioxus_native::Config::with_font_ctx). Then parley measures exactly what Blitz draws.Type::default()still names Iowan and Menlo: which faces to use is the host's choice, and leaf provides only the mechanism.leaf-dioxusandleaf-dioxus-tuipassfaces: Default::default().A 5.6 KB test face (Atkinson Hyperlegible Next, OFL, cut down to the alphabet and renamed
Leaf Test Face, so no system has it) shows that parley sets text in a host's file. The test checks that the glyph run's font is the host's blob.Breaking
Typehas a new public field. A struct literal that lists every field must addfaces: Default::default()or end with..Type::default(). diaryx already uses..Type::default().Checked
ship ci dioxus(fmt, clippy for both renderers, and tests for the widget and the app): green.cargo checkforapps/leaf-dioxus-tui: green.