1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
// SPDX-FileCopyrightText: Copyright (c) 2026 Mike Li/Mikewolfli/Wei Li(mikewolfli@163.com)
// SPDX-License-Identifier: MIT
//! The text layer: where glyphs come from, and which face wins.
//!
//! # Two questions, two types
//!
//! Rendering one character needs two answers that are easy to entangle and expensive to
//! separate later:
//!
//! 1. *"What are this character's pixels?"* — a [`GlyphSource`].
//! 2. *"I have several faces; which one answers?"* — a [`FontStack`], resolved first-hit.
//!
//! # Data is opt-in
//!
//! The default build carries **no font data** beyond the crate's historical 8x8 face, so it
//! draws Latin/ASCII and the fallback glyph for everything else — the same bytes it always
//! did. A face that covers more (today: `fonts-cjk-bitmap`, a generated 16x16 CJK subset) is
//! added by enabling a feature, which appends one entry to the stack. Nothing in this module
//! allocates, and no glyph table is ever resident in RAM: a resolved glyph borrows its rows
//! from the binary's read-only section.
// The opt-in vector faces (generated data) and the shaper that reads them. Both are gated by
// the shaping feature, because a face with no shaper to read it has no consumer.
// Host-registered faces (`runtime-fonts`). Gated on the feature, and on `text-shaping` because a
// runtime face is only useful to a shaper or the vector rasteriser, both of which need the engine.
// A host that registers a face on a build with no vector path would hand in bytes nothing reads.
// The public entry point for a host's own font bytes. Re-exported at `text::` because that is
// where the crate's other text-surface items live, and because the alternative — reaching into
// `text::runtime_fonts::register_face` — exposes a module the caller has no other reason to name.
pub use ;
// Convenience over the installed-font snapshot: the compiled CJK face is a subset, so a host whose
// UI text goes beyond it registers one of these families instead of rediscovering the names.
// Defined in `platform::fonts` because that module already owns "look up an installed family and
// register its file", and a second implementation of that read/leak/register step would drift.
pub use crate;
// The one derivation of a line's clusters, shared by both renderers.
// Vector outline rasterisation (G-5): the coverage-producing implementation of `GlyphSource`.
//
// Gated on the shaping feature because it reads the same `ttf-parser` face data the shaper does —
// a rasteriser with no face to rasterise is dead weight, and `ttf-parser` is the shaper's own
// dependency, so this adds none.
// `VectorSource` and `OutlinePoint` are the rasteriser's types, so `text-shaping` (which is what
// compiles `raster`) is the right gate for them.
pub use ;
// The two outline entry points and their capacity constants exist only when a vector face does —
// each selects a face and outlines a glyph from it. A build with `text-shaping` but no face data
// (e.g. `mini,runtime-fonts`) compiles `raster` for its types and not these, so re-exporting them
// under `text-shaping` alone failed to resolve.
pub use ;
// Colour bitmap faces (G-6): `CBDT`/`CBLC` plus the PNG decoder that reads what they point at.
//
// The two share one gate because they are one capability: a `CBDT` index is useless without a
// decoder for its payload, and a decoder with no index has nothing to decode. It also keeps
// `miniz_oxide` out of a build with no colour face.
pub use ColorBitmapFace;
// Bidirectional reordering (UAX #9). Always compiled: it is logic, not data.
// The generated CJK table is 75 KB of static data with no consumers unless the feature is on;
// compiling it unconditionally would be dead weight and a `dead_code` warning in one move.
pub use ;
// The face lookup the backends share, exposed so a host can ask which face would draw a character
// (and therefore whether its own registered face is the one answering).
pub use face_for_char;
// The un-cached control for the coverage-cache benchmark. `#[doc(hidden)]` on the item itself;
// re-exported here so a benchmark reaches it without naming the `font_assets` module path.
pub use face_for_char_uncached;
pub use ColorBitmapSource;
// The wide-scalar table is a property of the characters, needed by the renderer's advance
// model *and* by a control's implicit-size estimate, so it is exported rather than copied.
// `estimate_cluster_advance` is exported for the same reason: it *is* the crate's advance
// model, and a second spelling of it would drift.
pub use ;
// Only the `text-shaping` build has a face to measure against, so the helper is only reachable
// there; gating it the same way keeps a face-less build from warning about an unused import.
pub use measure_text_width_for_test;
// The cluster helpers and the line-shaping entry point stay inside the crate: their consumers
// are the two backends and a control's implicit-size estimate, not public API.
pub use ;
// The greedy shaper is always present; the face-backed one only when a face is.
pub use RustybuzzShaper;
pub use cjk;