Add load_with_options: partial loading and per-source failure reporting - #32
Closed
tomconroy wants to merge 1 commit into
Closed
Add load_with_options: partial loading and per-source failure reporting#32tomconroy wants to merge 1 commit into
tomconroy wants to merge 1 commit into
Conversation
Closed
Implements the API sketched in simoncozens#33: a LoadOptions struct with load_axes / load_masters / load_glyphs / load_layers flags, all defaulting to true, and a top-level load_with_options returning LoadResult { font, source_failures }. load() is now a thin façade over it and behaves exactly as before. The UFO, designspace, and Glyphs convertors skip the ingestion work for parts that are not requested; the remaining formats are loaded in full and then filtered, so the result has the same shape for every format. - load_layers: false parses no .glif file at all (norad's DataRequest::default().layers(false)); UFO/designspace glyphs become name-only stubs read from the default layer's contents.plist, keeping lib-derived categories, production names, and export flags. - load_masters: false does not open designspace source UFOs at all; masters become bare records of what the document declares (name, location, filename). - Designspace <source> elements that fail to load are reported in LoadResult::source_failures instead of being silently dropped. Measured on googlefonts/roboto-serif (RobotoSerif.designspace, 81 sources, release build): full load 5.0s; load_layers: false 460ms; document only (load_masters/glyphs: false) 0.6ms. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
tomconroy
force-pushed
the
silent-source-drop-report
branch
from
July 13, 2026 12:38
3920c63 to
057528d
Compare
simoncozens
reviewed
Jul 13, 2026
| chrono = { version = "0.4.3", features = ["serde"] } | ||
| glyphslib = { version = "0.2.6", optional = true } | ||
| norad = { version = "0.17.0", features = ["kurbo"], optional = true } | ||
| plist = { version = "1", optional = true } |
Owner
There was a problem hiding this comment.
I'm not sure this dependency is actually used?
Contributor
Author
There was a problem hiding this comment.
It's used in the new ufo::converters::default_layer_glyph_names – added so that we can still output the glyph names without any layers:
// full load // load_layers: false
{ {
"name": "A", "name": "A",
"category": "Base", "category": "Base"
"codepoints": [65], }
"layers": [ /* 2 layers */ ]
}
Contributor
Author
|
See #33 (comment) |
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.
Reworked to implement the
load_with_optionsAPI you sketched in #33, folding in the source-failure reporting this PR originally proposed.API
load()is now a thin façade overload_with_optionsand behaves exactly as before (including silently skipping unloadable designspace sources).Semantics
load_axes: false— no axes on the returned font.load_masters: false— masters are bare records of what the file declares (name, id, location; for designspace sources also filename/style name), and designspace source UFOs are not opened at all. Combined withload_glyphs: falsethis parses just the designspace XML: your "axes/masters/instances without the sources" case. Implies no layers, since layers belong to masters.load_glyphs: false— no glyphs.load_layers: false— glyphs are layer-less stubs. For UFO/designspace the names come from the default layer'scontents.plist, so no.gliffile is parsed anywhere (noradDataRequest::default().layers(false)); lib-derived categories, production names and export flags are kept, codepoints aren't (they live in the glifs). Glyphs-format stubs keep codepoints and kern-group membership.Implementation notes
source_failuresinstead of vanishing in thefilter_map; each failure leaves the font without that master.load_masters: falsestill returns correctly-interpreted axes.Numbers
Measured against googlefonts/roboto-serif's
RobotoSerif.designspace(81 sources, release build) — the case that motivated #33:load_layers: falseload_masters/glyphs: false(The remaining 4 of the 81 sources fail on an unrelated norad fontinfo issue — linebender/norad#414 — and are now visible in
source_failuresrather than silently missing.)🤖 Generated with Claude Code