text_typeset/font_service.rs
1//! Shared font service: the part of text-typeset that can be shared
2//! across many widgets viewing many documents.
3//!
4//! A [`TextFontService`] owns four things:
5//!
6//! - a font registry (parsed faces, family lookup, fallback chain),
7//! - a GPU-bound glyph atlas (RGBA texture with bucketed allocations),
8//! - a glyph cache keyed on `(face, glyph_id, physical_size_px)`,
9//! - a `swash` scale context (reusable rasterizer workspace).
10//!
11//! None of these describe **what** a specific widget is showing — they
12//! describe **how** glyphs are rasterized and cached. Two widgets
13//! viewing the same or different documents in the same window should
14//! share one `TextFontService` so that:
15//!
16//! 1. every glyph for a given `(face, size)` lives in one atlas
17//! and is uploaded to the GPU exactly once per frame;
18//! 2. every shaped glyph rasterization happens at most once,
19//! amortized over every widget that ever renders it;
20//! 3. font registration and fallback resolution are consistent
21//! across the whole UI.
22//!
23//! Per-widget state — viewport, zoom, scroll offset, flow layout,
24//! cursor, colors — lives on a separate [`DocumentFlow`] that borrows
25//! the service at layout and render time.
26//!
27//! [`DocumentFlow`]: crate::DocumentFlow
28//!
29//! # HiDPI invalidation
30//!
31//! [`set_scale_factor`](TextFontService::set_scale_factor) is the one
32//! mutation that invalidates existing work: cached glyphs were
33//! rasterized at the old physical ppem and are wrong at the new one,
34//! and flow layouts stored shaped advances that depended on the
35//! previous ppem rounding. The service clears its own glyph cache
36//! and atlas on the spot, but it cannot reach into per-widget
37//! [`DocumentFlow`] instances. Instead it bumps a monotonic
38//! `scale_generation` counter every time the scale factor changes.
39//! Each `DocumentFlow` remembers the generation it was last laid out
40//! at. Call [`crate::DocumentFlow::layout_dirty_for_scale`] from the
41//! framework side to ask "does this flow need a relayout?" and re-run
42//! `layout_full` when the answer is yes.
43
44use crate::atlas::allocator::GlyphAtlas;
45use crate::atlas::cache::GlyphCache;
46use crate::font::registry::FontRegistry;
47use crate::font::resolve::resolve_font;
48use crate::shaping::shaper::font_metrics_px;
49use crate::types::{FontFaceId, TextFormat};
50
51/// Outcome of a call to [`TextFontService::atlas_snapshot`].
52///
53/// Bundles the four signals a framework adapter needs to upload
54/// (or skip uploading) the glyph atlas texture to the GPU:
55///
56/// - whether the atlas has pending pixel changes since the last
57/// snapshot,
58/// - its current pixel dimensions,
59/// - a borrow of the raw RGBA pixel buffer, and
60/// - whether any cached glyphs were evicted during this snapshot —
61/// a signal that callers with paint caches holding old atlas
62/// UVs must treat as an invalidation even if the atlas itself
63/// reports clean afterwards (evicted slots may be reused by
64/// future allocations, so any cached UV pointing into them is
65/// stale).
66///
67/// Exposed as a struct rather than a tuple so every caller names
68/// fields explicitly and can't swap positions silently.
69#[derive(Debug)]
70#[non_exhaustive]
71pub struct AtlasSnapshot<'a> {
72 /// True if the atlas texture has pending pixel changes
73 /// since it was last marked clean. The snapshot call clears
74 /// this flag, so the caller must either upload `pixels` now
75 /// or accept a one-frame delay.
76 pub dirty: bool,
77 /// Current atlas texture width in pixels.
78 pub width: u32,
79 /// Current atlas texture height in pixels.
80 pub height: u32,
81 /// Raw RGBA8 pixel buffer backing the atlas texture.
82 pub pixels: &'a [u8],
83 /// True if eviction freed at least one glyph slot during
84 /// this snapshot. Callers that cache glyph positions (e.g.
85 /// framework paint caches indexed by layout key) must
86 /// invalidate when this is true — evicted slots may be
87 /// reused by future allocations and old UVs would then
88 /// point to the wrong glyph.
89 pub glyphs_evicted: bool,
90}
91
92/// Shared font resources for a text-typeset session.
93///
94/// Owns the font registry, the glyph atlas, the glyph cache, and the
95/// `swash` scale context. Construct one per process (or one per window
96/// if you really need isolated atlases) and share it by `Rc<RefCell<_>>`
97/// across every [`DocumentFlow`] that renders into the same atlas.
98///
99/// [`DocumentFlow`]: crate::DocumentFlow
100pub struct TextFontService {
101 pub(crate) font_registry: FontRegistry,
102 pub(crate) atlas: GlyphAtlas,
103 pub(crate) glyph_cache: GlyphCache,
104 pub(crate) scale_context: swash::scale::ScaleContext,
105 pub(crate) scale_factor: f32,
106 /// Bumps every time [`set_scale_factor`](Self::set_scale_factor)
107 /// actually changes the value. `DocumentFlow` snapshots this on
108 /// layout and exposes a dirty check for callers.
109 pub(crate) scale_generation: u64,
110 /// Monotonic counter bumped every time the atlas loses entries
111 /// (LRU eviction or full reset on scale-factor change). Per-widget
112 /// `DocumentFlow`s stamp this on every full `render()` and refuse
113 /// to reuse their cached glyph quads (cursor-only / block-only
114 /// paint paths) when the service's current epoch differs — at
115 /// that point any baked-in atlas pixel coordinates in those
116 /// cached quads may reference slots now owned by unrelated
117 /// glyphs.
118 pub(crate) eviction_epoch: u64,
119}
120
121impl TextFontService {
122 /// Create a service whose font registry is pre-populated with the
123 /// operating system's fonts, so arbitrary documents (CJK, emoji,
124 /// scripts the host didn't bundle) still render via glyph fallback.
125 ///
126 /// Still call [`set_default_font`](Self::set_default_font) (and
127 /// usually [`register_font`](Self::register_font) for the primary
128 /// UI font) before any [`DocumentFlow`] lays out content.
129 ///
130 /// Enumerating OS fonts is a one-time startup cost; their bytes load
131 /// lazily on first use. Use
132 /// [`new_without_system_fonts`](Self::new_without_system_fonts) to
133 /// skip the scan and keep a fully host-controlled font set.
134 ///
135 /// [`DocumentFlow`]: crate::DocumentFlow
136 pub fn new() -> Self {
137 Self::with_registry(FontRegistry::new())
138 }
139
140 /// Like [`new`](Self::new) but with no OS font enumeration: only
141 /// fonts added via `register_font*` are available. Use this when the
142 /// host ships a controlled font set and wants neither the startup
143 /// scan nor implicit system fonts.
144 pub fn new_without_system_fonts() -> Self {
145 Self::with_registry(FontRegistry::new_without_system_fonts())
146 }
147
148 fn with_registry(font_registry: FontRegistry) -> Self {
149 Self {
150 font_registry,
151 atlas: GlyphAtlas::new(),
152 glyph_cache: GlyphCache::new(),
153 scale_context: swash::scale::ScaleContext::new(),
154 scale_factor: 1.0,
155 scale_generation: 0,
156 eviction_epoch: 0,
157 }
158 }
159
160 // ── Font registration ───────────────────────────────────────
161
162 /// Register a font face from raw TTF/OTF/WOFF bytes.
163 ///
164 /// Parses the font's name table to extract family, weight, and
165 /// style, then indexes it via `fontdb` for CSS-spec font matching.
166 /// Returns the first face ID — font collections (`.ttc`) may
167 /// contain multiple faces.
168 ///
169 /// # Panics
170 ///
171 /// Panics if the font data contains no parseable faces.
172 pub fn register_font(&mut self, data: &[u8]) -> FontFaceId {
173 let ids = self.font_registry.register_font(data);
174 ids.into_iter()
175 .next()
176 .expect("font data contained no faces")
177 }
178
179 /// Register a font from a pre-built shared byte container,
180 /// avoiding the copy that [`register_font`](Self::register_font)
181 /// would perform.
182 ///
183 /// Pass an `Arc<Mmap>` (or any `Arc<dyn AsRef<[u8]> + Sync + Send>`)
184 /// when the caller already holds the data in a shareable form —
185 /// useful for large system fonts (color emoji) where copying to an
186 /// owned `Vec<u8>` would double the resident memory cost.
187 ///
188 /// # Panics
189 ///
190 /// Panics if the font data contains no parseable faces.
191 pub fn register_font_shared(&mut self, data: crate::font::SharedFontData) -> FontFaceId {
192 let ids = self.font_registry.register_font_shared(data);
193 ids.into_iter()
194 .next()
195 .expect("font data contained no faces")
196 }
197
198 /// Register a font with explicit metadata, overriding the font's
199 /// name table. Use when the font's internal metadata is unreliable
200 /// or when aliasing a font to a different family name.
201 ///
202 /// # Panics
203 ///
204 /// Panics if the font data contains no parseable faces.
205 pub fn register_font_as(
206 &mut self,
207 data: &[u8],
208 family: &str,
209 weight: u16,
210 italic: bool,
211 ) -> FontFaceId {
212 let ids = self
213 .font_registry
214 .register_font_as(data, family, weight, italic);
215 ids.into_iter()
216 .next()
217 .expect("font data contained no faces")
218 }
219
220 /// Like [`register_font_as`](Self::register_font_as) but takes a
221 /// pre-built shared byte container, avoiding the copy.
222 ///
223 /// # Panics
224 ///
225 /// Panics if the font data contains no parseable faces.
226 pub fn register_font_shared_as(
227 &mut self,
228 data: crate::font::SharedFontData,
229 family: &str,
230 weight: u16,
231 italic: bool,
232 ) -> FontFaceId {
233 let ids = self
234 .font_registry
235 .register_font_shared_as(data, family, weight, italic);
236 ids.into_iter()
237 .next()
238 .expect("font data contained no faces")
239 }
240
241 /// Set which face to use as the document default, plus its base
242 /// size in logical pixels. This is the fallback font when a
243 /// fragment's `TextFormat` doesn't specify a family or when the
244 /// requested family isn't found.
245 pub fn set_default_font(&mut self, face: FontFaceId, size_px: f32) {
246 self.font_registry.set_default_font(face, size_px);
247 }
248
249 /// Set the language, as a BCP 47 tag (`"ja"`, `"zh-TW"`), that Chinese
250 /// characters a fallback font draws are drawn for when their text does
251 /// not say: a host passes its UI locale. The same character is drawn
252 /// differently in Japanese, Simplified Chinese, Traditional Chinese and
253 /// Korean, so glyph fallback picks a face for one of them. The language
254 /// of the character's block, then the kana or hangul nearest to it in its
255 /// paragraph, win over this one; with none of the three, Simplified
256 /// Chinese. A tag that names no CJK language, or `None`, sets none.
257 ///
258 /// A change marks every flow laid out against this service as stale, as
259 /// a scale factor change does: [`scale_generation`](Self::scale_generation)
260 /// moves, so [`DocumentFlow::layout_dirty_for_scale`] answers true until
261 /// the flow is laid out again. Setting the language it already has
262 /// changes nothing.
263 ///
264 /// [`DocumentFlow::layout_dirty_for_scale`]: crate::DocumentFlow::layout_dirty_for_scale
265 pub fn set_default_language(&mut self, language: Option<&str>) {
266 if self.font_registry.set_default_language(language) {
267 // Shaped runs chose their fallback faces by the old language.
268 self.scale_generation = self.scale_generation.wrapping_add(1);
269 }
270 }
271
272 /// Map a generic family name (e.g. `"serif"`, `"monospace"`) to a
273 /// concrete registered family. When text-document emits a fragment
274 /// whose `font_family` matches a generic, the font resolver looks
275 /// it up through this table before querying fontdb.
276 pub fn set_generic_family(&mut self, generic: &str, family: &str) {
277 self.font_registry.set_generic_family(generic, family);
278 }
279
280 /// Look up the family name of a registered face by id.
281 pub fn font_family_name(&self, face_id: FontFaceId) -> Option<String> {
282 self.font_registry.font_family_name(face_id)
283 }
284
285 /// Borrow the font registry directly — needed by callers that
286 /// want to inspect or extend it beyond the helpers exposed here.
287 pub fn font_registry(&self) -> &FontRegistry {
288 &self.font_registry
289 }
290
291 // ── Font enumeration (font picker) ──────────────────────────
292
293 /// Enumerate every installed font family, deduplicated and sorted.
294 ///
295 /// Cheap (fontdb metadata only — no font bytes loaded). Collapses
296 /// weight/style faces into one entry per family, with `monospaced`
297 /// true when any face of the family is monospaced. The item source for
298 /// a font picker.
299 pub fn families(&self) -> Vec<crate::font::FontFamilyInfo> {
300 self.font_registry.families()
301 }
302
303 /// Enumerate installed font family names, deduplicated and sorted — the
304 /// simple projection of [`families`](Self::families).
305 pub fn family_names(&self) -> Vec<String> {
306 self.font_registry.family_names()
307 }
308
309 /// True if any face of the named family is monospaced (fontdb metadata,
310 /// no bytes loaded). Case-insensitive on the family name.
311 pub fn family_is_monospaced(&self, family: &str) -> bool {
312 self.font_registry.family_is_monospaced(family)
313 }
314
315 /// Build a `Send` snapshot of every family's face byte-sources, to be
316 /// moved to a background thread and turned into a writing-system
317 /// coverage map (see [`WritingSystemIndexBuilder`]).
318 ///
319 /// Cheap on the calling thread; the expensive per-face OS/2 parsing runs
320 /// in [`WritingSystemIndexBuilder::build`] off-thread.
321 ///
322 /// [`WritingSystemIndexBuilder`]: crate::font::WritingSystemIndexBuilder
323 /// [`WritingSystemIndexBuilder::build`]: crate::font::WritingSystemIndexBuilder::build
324 pub fn writing_system_index_builder(&self) -> crate::font::WritingSystemIndexBuilder {
325 self.font_registry.writing_system_index_builder()
326 }
327
328 // ── Font metrics ────────────────────────────────────────────
329
330 /// Line height (in logical pixels) for the registry's default
331 /// font + size, computed as `ascent + descent + leading`.
332 ///
333 /// Useful for callers that need to size a widget against the
334 /// intrinsic line height *before* any content has been laid out
335 /// (an empty editor that wants to report a `min_lines`-tall
336 /// intrinsic size, for example). Returns `0.0` when no default
337 /// font is registered or the face cannot be opened.
338 ///
339 /// Does not apply any per-block `line_height_multiplier` —
340 /// multipliers live on `BlockFormat`, not on the font, and have
341 /// no meaning when there's no block to multiply against. Use
342 /// [`measure_line_height`](Self::measure_line_height) when you
343 /// already have a [`TextFormat`].
344 pub fn default_line_height(&self) -> f32 {
345 self.measure_line_height(&TextFormat::default())
346 }
347
348 /// Line height (in logical pixels) for an explicit
349 /// [`TextFormat`], computed as `ascent + descent + leading` of
350 /// the resolved font at the resolved size. Fields left as `None`
351 /// fall back to the registry's defaults — same resolution path
352 /// as live inline runs (see `font::resolve::resolve_font`).
353 ///
354 /// Returns `0.0` when the format cannot be resolved (no default
355 /// font registered, requested family missing and no fallback,
356 /// face fails to open).
357 pub fn measure_line_height(&self, format: &TextFormat) -> f32 {
358 let font_point_size = format.font_size.map(|s| s as u32);
359 let resolved = match resolve_font(
360 &self.font_registry,
361 format.font_family.as_deref(),
362 format.font_weight,
363 format.font_bold,
364 format.font_italic,
365 font_point_size,
366 self.scale_factor,
367 1.0, // explicit format size is already scaled by the caller
368 ) {
369 Some(r) => r,
370 None => return 0.0,
371 };
372 match font_metrics_px(&self.font_registry, &resolved) {
373 Some(m) => m.ascent + m.descent + m.leading,
374 None => 0.0,
375 }
376 }
377
378 // ── HiDPI scale factor ──────────────────────────────────────
379
380 /// Set the device pixel ratio for HiDPI rasterization.
381 ///
382 /// Layout stays in logical pixels; glyphs are shaped and
383 /// rasterized at `size_px * scale_factor` so text is crisp on
384 /// HiDPI displays. Orthogonal to [`DocumentFlow::set_zoom`],
385 /// which is a post-layout display transform.
386 ///
387 /// Changing this value invalidates the glyph cache and the
388 /// atlas (both are cleared here) and marks every
389 /// [`DocumentFlow`] that was laid out against this service as
390 /// stale via the `scale_generation` counter. The caller must
391 /// then re-run `layout_full` / `layout_blocks` on every flow
392 /// before the next render — existing shaped advances depended
393 /// on the old ppem rounding.
394 ///
395 /// Clamped to `0.25..=8.0`. Default is `1.0`.
396 ///
397 /// [`DocumentFlow`]: crate::DocumentFlow
398 /// [`DocumentFlow::set_zoom`]: crate::DocumentFlow::set_zoom
399 pub fn set_scale_factor(&mut self, scale_factor: f32) {
400 let sf = scale_factor.clamp(0.25, 8.0);
401 if (self.scale_factor - sf).abs() <= f32::EPSILON {
402 return;
403 }
404 self.scale_factor = sf;
405 // Glyph raster cells were produced at the old physical size
406 // and would be wrong at the new one. Drop the cache outright.
407 self.glyph_cache.entries.clear();
408 // The bucketed allocator still holds the rectangles for those
409 // evicted glyphs; start from a fresh allocator so the space
410 // is actually reclaimed rather than fragmented.
411 self.atlas = GlyphAtlas::new();
412 // Bump the generation so per-widget flows can detect the
413 // invalidation and re-run their layouts.
414 self.scale_generation = self.scale_generation.wrapping_add(1);
415 // Wholesale atlas reset — anything keyed on the old eviction
416 // epoch must refuse to reuse cached atlas coordinates.
417 self.eviction_epoch = self.eviction_epoch.wrapping_add(1);
418 }
419
420 /// The current scale factor (default `1.0`).
421 pub fn scale_factor(&self) -> f32 {
422 self.scale_factor
423 }
424
425 /// Monotonic counter bumped by every successful
426 /// [`set_scale_factor`](Self::set_scale_factor) call, and by every
427 /// [`set_default_language`](Self::set_default_language) that changes the
428 /// language.
429 ///
430 /// `DocumentFlow` snapshots this during layout so the framework
431 /// can ask whether a flow needs to be re-laid out after a HiDPI
432 /// change without having to track the transition itself.
433 pub fn scale_generation(&self) -> u64 {
434 self.scale_generation
435 }
436
437 /// Monotonic counter bumped every time the atlas drops entries —
438 /// LRU eviction triggered by [`atlas_snapshot`](Self::atlas_snapshot),
439 /// LRU eviction at the start of every full
440 /// [`render`](crate::DocumentFlow::render) (inside
441 /// `build_render_frame`), or wholesale reset by
442 /// [`set_scale_factor`](Self::set_scale_factor).
443 ///
444 /// This is the single source of truth for "retained glyph quads may
445 /// be stale": frameworks should compare it against a last-seen value
446 /// once per frame and invalidate every retained paint cache when it
447 /// moves, regardless of which path moved it.
448 ///
449 /// Per-widget [`crate::DocumentFlow`]s stamp this value on every full
450 /// [`render`](crate::DocumentFlow::render) and refuse to reuse
451 /// their cached glyph quads on subsequent
452 /// [`render_cursor_only`](crate::DocumentFlow::render_cursor_only)
453 /// or [`render_block_only`](crate::DocumentFlow::render_block_only)
454 /// calls when the epoch has advanced — at that point any baked-in
455 /// atlas pixel coordinates in those cached quads may reference
456 /// slots now owned by unrelated glyphs.
457 pub fn eviction_epoch(&self) -> u64 {
458 self.eviction_epoch
459 }
460
461 // ── Atlas ───────────────────────────────────────────────────
462
463 /// Read the glyph atlas state without triggering a render.
464 ///
465 /// Optionally advances the cache generation and runs eviction.
466 /// Returns an [`AtlasSnapshot`] the caller can pattern-match
467 /// by field. The atlas's internal dirty flag is cleared here,
468 /// so the caller must either upload `pixels` during the
469 /// returned borrow or accept a one-frame delay.
470 ///
471 /// When `snapshot.glyphs_evicted` is true, callers that cache
472 /// glyph positions (e.g. paint caches) must invalidate —
473 /// evicted atlas slots may be reused by subsequent allocations
474 /// and old UVs would now point to the wrong glyph.
475 ///
476 /// Only advance the generation on frames where actual text
477 /// work happened; skipping eviction on idle frames prevents
478 /// aging out glyphs that are still visible but not re-measured
479 /// this tick.
480 pub fn atlas_snapshot(&mut self, advance_generation: bool) -> AtlasSnapshot<'_> {
481 let mut glyphs_evicted = false;
482 if advance_generation {
483 self.glyph_cache.advance_generation();
484 let evicted = self.glyph_cache.evict_unused();
485 glyphs_evicted = !evicted.is_empty();
486 if glyphs_evicted {
487 self.eviction_epoch = self.eviction_epoch.wrapping_add(1);
488 }
489 for glyph in evicted {
490 self.atlas.deallocate(glyph.alloc_id);
491 #[cfg(debug_assertions)]
492 self.atlas.debug_poison_rect(
493 glyph.atlas_x,
494 glyph.atlas_y,
495 glyph.width,
496 glyph.height,
497 );
498 }
499 }
500
501 let dirty = self.atlas.dirty;
502 let width = self.atlas.width;
503 let height = self.atlas.height;
504 if dirty {
505 self.atlas.dirty = false;
506 }
507 AtlasSnapshot {
508 dirty,
509 width,
510 height,
511 pixels: &self.atlas.pixels[..],
512 glyphs_evicted,
513 }
514 }
515
516 /// Mark the given glyph cache keys as used in the current
517 /// generation, preventing them from being evicted. Use this when
518 /// glyph quads are cached externally (e.g. per-widget paint
519 /// caches) and the normal `rasterize_glyph_quad` → `get()` path
520 /// is skipped.
521 pub fn touch_glyphs(&mut self, keys: &[crate::atlas::cache::GlyphCacheKey]) {
522 self.glyph_cache.touch(keys);
523 }
524
525 /// Current atlas rectangle (`[x, y, w, h]`, atlas pixel coordinates)
526 /// for a cached glyph, without refreshing its LRU timestamp.
527 ///
528 /// Returns `None` when the glyph is not (or no longer) resident.
529 /// Intended for debug-build validation of externally retained glyph
530 /// quads: a quad whose baked rect no longer matches the live rect is
531 /// sampling pixels that belong to another glyph.
532 pub fn peek_glyph_rect(&self, key: &crate::atlas::cache::GlyphCacheKey) -> Option<[u32; 4]> {
533 self.glyph_cache
534 .peek(key)
535 .map(|g| [g.atlas_x, g.atlas_y, g.width, g.height])
536 }
537
538 /// Test hook: overwrite the atlas rectangle recorded for a cached
539 /// glyph. Lets corruption-detector tests simulate a glyph whose atlas
540 /// slot moved underneath a retained quad. Returns `false` when the
541 /// key is not resident.
542 #[doc(hidden)]
543 pub fn debug_set_glyph_rect(
544 &mut self,
545 key: &crate::atlas::cache::GlyphCacheKey,
546 rect: [u32; 4],
547 ) -> bool {
548 match self.glyph_cache.entries.get_mut(key) {
549 Some(glyph) => {
550 glyph.atlas_x = rect[0];
551 glyph.atlas_y = rect[1];
552 glyph.width = rect[2];
553 glyph.height = rect[3];
554 true
555 }
556 None => false,
557 }
558 }
559
560 /// True if the atlas has pending pixel changes since the last
561 /// upload. The atlas is marked clean after every `render()` that
562 /// copies pixels into its `RenderFrame`; this accessor exposes
563 /// the flag for framework paint-cache invalidation decisions.
564 pub fn atlas_dirty(&self) -> bool {
565 self.atlas.dirty
566 }
567
568 /// Current atlas texture width in pixels.
569 pub fn atlas_width(&self) -> u32 {
570 self.atlas.width
571 }
572
573 /// Current atlas texture height in pixels.
574 pub fn atlas_height(&self) -> u32 {
575 self.atlas.height
576 }
577
578 /// Raw atlas pixel buffer (RGBA8).
579 pub fn atlas_pixels(&self) -> &[u8] {
580 &self.atlas.pixels
581 }
582
583 /// Mark the atlas clean after the caller has uploaded its
584 /// contents to the GPU. Paired with `atlas_dirty` + `atlas_pixels`
585 /// for framework adapters that upload directly from the service
586 /// instead of consuming `RenderFrame::atlas_pixels`.
587 pub fn mark_atlas_clean(&mut self) {
588 self.atlas.dirty = false;
589 }
590}
591
592impl Default for TextFontService {
593 fn default() -> Self {
594 Self::new()
595 }
596}