Skip to content

Commit 5450ce8

Browse files
committed
parley: Fix missing glyphs on macOS with FemtoVG renderer
Regression introduced with 7efa288, where the fonts reported by GenericFamily::SystemUi can't be rendered. This is I think a bug with FemtoVG that deserves a separate investigation, but for now: Fix the regression.
1 parent de4f1d2 commit 5450ce8

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

internal/core/textlayout/sharedparley.rs

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -138,15 +138,27 @@ fn layout(text: &str, scale_factor: ScaleFactor, options: LayoutOptions) -> Layo
138138
builder.push_default(parley::style::FontStack::List(std::borrow::Cow::Borrowed(
139139
&[
140140
parley::style::FontFamily::Named(family.as_str().into()),
141+
// FemtoVG renderer needs SansSerif first, as it has difficulties rendering from SystemUi on macOS
142+
parley::style::FontFamily::Generic(
143+
parley::fontique::GenericFamily::SansSerif,
144+
),
141145
parley::style::FontFamily::Generic(
142146
parley::fontique::GenericFamily::SystemUi,
143147
),
144148
],
145149
)));
146150
} else {
147-
builder.push_default(parley::style::FontStack::Single(
148-
parley::style::FontFamily::Generic(parley::fontique::GenericFamily::SystemUi),
149-
));
151+
builder.push_default(parley::style::FontStack::List(std::borrow::Cow::Borrowed(
152+
&[
153+
// FemtoVG renderer needs SansSerif first, as it has difficulties rendering from SystemUi on macOS
154+
parley::style::FontFamily::Generic(
155+
parley::fontique::GenericFamily::SansSerif,
156+
),
157+
parley::style::FontFamily::Generic(
158+
parley::fontique::GenericFamily::SystemUi,
159+
),
160+
],
161+
)));
150162
}
151163
if let Some(weight) = font_request.weight {
152164
builder.push_default(parley::StyleProperty::FontWeight(

0 commit comments

Comments
 (0)