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
//! vue-native fork: font families made of several faces, each of which draws
//! only the characters of its own `unicode-range`.
//!
//! A web font is often shipped as one CSS family cut into subsets (Fontsource
//! and Google Fonts: `latin`, `latin-ext`, `cyrillic`, …), one file and one
//! `@font-face` rule each. A browser draws every character with the face of
//! the family whose `unicode-range` covers it (CSS Fonts 4 §4.5 and §5.3), and
//! a character no face covers with the next family in the list. The platform
//! text system matches faces by family name, weight and style only, so each
//! face is registered under a family of its own and the family the page names
//! is a [`FamilyComposer`]: which faces a run of that family is drawn with, for
//! the run's weight and style, and which characters each one draws. The
//! platform splits the run by character before shaping.
use Arc;
use crate::;
/// One face of a composed family: the family it is registered under (a family
/// of its own, holding that one font file) and the characters it draws.
/// The faces a composed family draws text of a weight and style with, in the
/// order they are tried for a character: the first that covers it draws it.
/// Empty when the family has no face for that text (yet).
pub type FamilyComposer = ;
/// Is `c` a character that belongs to the cluster before it, so that it is
/// drawn with the same face as that character rather than chosen on its own?
/// Combining marks, joiners and variation selectors: a browser keeps a
/// grapheme in one font when it can.
/// Splits `text` into the pieces each face of `faces` draws: `(byte length,
/// index into faces)`, `None` for a piece no face covers. Adjacent characters
/// with the same answer are one piece; a [`continues_cluster`] character
/// stays with the piece before it.
// Tested in gpui_windows (`direct_write::composed_tests`), whose tests run in
// vue-native's workspace; this crate's need dev-dependencies it does not have.