Skip to content

Commit 7efa288

Browse files
committed
parley: Fix rendering of characters from the dingbats block
Fix default font selection to include GenericFamily::SystemUi. This typically expands to a list of ui fonts for use by user interfaces, which support these. Fixes #9608
1 parent 31677e3 commit 7efa288

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

internal/core/textlayout/sharedparley.rs

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -134,13 +134,17 @@ fn layout(text: &str, scale_factor: ScaleFactor, options: LayoutOptions) -> Layo
134134

135135
let push_to_builder = |builder: &mut parley::RangedBuilder<_>| {
136136
if let Some(ref font_request) = options.font_request {
137-
if let Some(family) = &font_request.family {
138-
builder.push_default(parley::StyleProperty::FontStack(
139-
parley::style::FontStack::Single(parley::style::FontFamily::Named(
140-
family.as_str().into(),
141-
)),
142-
));
143-
}
137+
let font_stack = if let Some(family) = &font_request.family {
138+
parley::style::FontStack::List(std::borrow::Cow::Borrowed(&[
139+
parley::style::FontFamily::Named(family.as_str().into()),
140+
parley::style::FontFamily::Generic(parley::fontique::GenericFamily::SystemUi),
141+
]))
142+
} else {
143+
parley::style::FontStack::Single(parley::style::FontFamily::Generic(
144+
parley::fontique::GenericFamily::SystemUi,
145+
))
146+
};
147+
builder.push_default(font_stack);
144148
if let Some(weight) = font_request.weight {
145149
builder.push_default(parley::StyleProperty::FontWeight(
146150
parley::style::FontWeight::new(weight as f32),

0 commit comments

Comments
 (0)