Skip to content

Commit 8814841

Browse files
committed
Work around crash on macOS when rendering certain emojis
Set a default font manager to avoid that the unconditional dereferencing inside Skia crashes on a null pointer. Upstream PR: google/skia#162 Fixes #4696
1 parent 345da48 commit 8814841

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

internal/renderers/skia/textlayout.rs

+2
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ use i_slint_core::graphics::FontRequest;
99
use i_slint_core::items::{TextHorizontalAlignment, TextVerticalAlignment};
1010
use i_slint_core::lengths::{LogicalLength, ScaleFactor};
1111
use i_slint_core::{items, Color};
12+
use skia_safe::FontMgr;
1213

1314
use super::itemrenderer::to_skia_color;
1415
use super::{PhysicalLength, PhysicalPoint, PhysicalRect, PhysicalSize};
@@ -33,6 +34,7 @@ thread_local! {
3334
let font_mgr = skia_safe::FontMgr::new();
3435
let type_face_font_provider = skia_safe::textlayout::TypefaceFontProvider::new();
3536
let mut font_collection = skia_safe::textlayout::FontCollection::new();
37+
font_collection.set_default_font_manager(FontMgr::new(), None);
3638
// FontCollection first looks up in the dynamic font manager and then the asset font manager. If the
3739
// family is empty, the default font manager will match against the system default. We want that behavior,
3840
// and only if the family is not present in the system, then we want to fall back to the assert font manager

0 commit comments

Comments
 (0)