react-x11 2.26.2 → 2.26.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/cocoa/fonts.js +23 -5
package/package.json
CHANGED
package/src/cocoa/fonts.js
CHANGED
|
@@ -76,13 +76,30 @@ function woffToSfnt(woff) {
|
|
|
76
76
|
return out;
|
|
77
77
|
}
|
|
78
78
|
|
|
79
|
+
/**
|
|
80
|
+
* The system font's two names from before CSS gave it one: `-apple-system`
|
|
81
|
+
* is WebKit's and Gecko's, `BlinkMacSystemFont` is Blink's, and a stack
|
|
82
|
+
* written for the web leads with both — GitHub's is `-apple-system,
|
|
83
|
+
* BlinkMacSystemFont, "Segoe UI", "Noto Sans", Helvetica, Arial,
|
|
84
|
+
* sans-serif`. CSS Fonts 4 standardised them as `system-ui`, the name the
|
|
85
|
+
* bridge knows. As families of their own neither exists, so the list moved
|
|
86
|
+
* on to the first one that does and a page written for SF was set in
|
|
87
|
+
* Helvetica. They name this platform's face and mean nothing on another,
|
|
88
|
+
* which is why they are resolved here and not in the X11 engine.
|
|
89
|
+
*/
|
|
90
|
+
const SYSTEM_UI_ALIASES = new Set(['-apple-system', 'blinkmacsystemfont']);
|
|
91
|
+
|
|
79
92
|
/** family list string -> array: 'Inter, "SF Pro", sans-serif' */
|
|
80
93
|
function familyList(family) {
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
94
|
+
const names = Array.isArray(family)
|
|
95
|
+
? family
|
|
96
|
+
: String(family ?? 'sans-serif')
|
|
97
|
+
.split(',')
|
|
98
|
+
.map((f) => f.trim().replace(/^["']|["']$/g, ''))
|
|
99
|
+
.filter(Boolean);
|
|
100
|
+
return names.map((name) =>
|
|
101
|
+
SYSTEM_UI_ALIASES.has(String(name).toLowerCase()) ? 'system-ui' : name,
|
|
102
|
+
);
|
|
86
103
|
}
|
|
87
104
|
|
|
88
105
|
function numericWeight(weight) {
|
|
@@ -519,6 +536,7 @@ const GENERIC_FAMILIES = new Set([
|
|
|
519
536
|
'system-ui',
|
|
520
537
|
'ui-sans-serif',
|
|
521
538
|
'ui-monospace',
|
|
539
|
+
...SYSTEM_UI_ALIASES,
|
|
522
540
|
]);
|
|
523
541
|
|
|
524
542
|
/** The size a face is probed at when the question has no size in it. */
|