Replies: 1 comment
-
|
Hello @bezkma , I’ve moved this to the Fonts repository, as this is where outline loading and glyph caching are handled. The assertions in the original issue are extremely broad and lack any supporting evidence. They name FreeType, Skia, and HarfBuzz, but give no explanation of what “lazy load glyphs” means in concrete terms, nor how those engines allegedly behave differently. The vague language reads like AI-generated text rather than a technical comparison. For clarity: SixLabors.Fonts does not eagerly rasterize anything. It parses the outline and metrics data required for shaping up front, exactly as HarfBuzz and other layout engines do. Composite glyphs are parsed structurally, but the expansion of component outlines is deferred through the internal GlyphLoader, so expensive work only happens when needed. That already matches the practical on-demand behaviour used in real engines. If you intend to claim behavioural differences between Fonts and specific engines, you need to provide actual technical evidence: what part of the glyph data they defer, where in their code that happens, and how this differs from Fonts. Without that, the current claim is too sweeping to act on. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Summary
SixLabors.Fontseagerly loads and parses all glyph data duringAdd()/LoadFont().For many real-world applications, this creates major performance and memory problems, especially with large CJK or emoji fonts (30–100+ MB).
In many software scenarios, the application may only need 1–2 glyphs from a large font, yet the entire font’s glyph tables (
glyf,CFF,loca, kerning, metrics) are parsed upfront.This leads to unnecessary CPU work, high memory usage, and slow startup times.
I would like to request support for on-demand glyph loading (lazy glyph parsing) so that glyph outlines are only parsed when they are actually used during rendering or layout.
Problem Description
Currently:
FileFontMetricsandStreamFontMetricseagerly parse all glyphs.FontMetricsmaterializes glyph-related data for every glyph.FontCollection.Add(path)orAdd(stream).This results in:
Examples of real usage where only a very small subset of glyphs is needed:
Yet the entire font must still be parsed, which is wasteful.
Why On-Demand Glyph Loading Is Important
Other text engines like:
perform:
cmap,maxp,loca, metrics)This drastically improves loading time and reduces memory for large fonts.
SixLabors.Fontscurrently has no mechanism such as:GlyphTableSo performance for large fonts is significantly worse than necessary.
Proposed Feature
Support a way to load glyph outlines only when they are needed.
Option A — Lazy Glyph Table
Provide an interface such as:
Allow
FontMetricsto use a loader instead of fully materializing glyphs.Option B — Lazy Font Loading API
Example:
Option C — Partial Font Loading Strategy
head,maxp,cmap,loca)Benefits
Beta Was this translation helpful? Give feedback.
All reactions