diff options
author | Matthias Clasen <mclasen@redhat.com> | 2022-04-08 16:33:56 -0400 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2022-04-08 16:37:38 -0400 |
commit | c90d22ca5887612cbbf8a050bb4a1a25727b4230 (patch) | |
tree | 56ffccc9b75dc200774b4a22874e0496d21ce22b | |
parent | d152b1bae9153476cf057f816ae3ce96b7b538a8 (diff) | |
download | pango-c90d22ca5887612cbbf8a050bb4a1a25727b4230.tar.gz |
layout: Try harder to survive without fonts
No great typography can be expected without fonts,
but we should try not to crash, since this situation
can apparently happen on Windows.
Fixes: #680
-rw-r--r-- | pango/pango-layout.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/pango/pango-layout.c b/pango/pango-layout.c index eb674b50..6d9bb12a 100644 --- a/pango/pango-layout.c +++ b/pango/pango-layout.c @@ -6624,7 +6624,7 @@ collect_baseline_shift (ParaBreakState *state, int subscript_y_offset = 0; - if (prev) + if (prev && prev->analysis.font) { hb_font_t *hb_font = pango_font_get_hb_font (prev->analysis.font); hb_ot_metrics_get_position (hb_font, HB_OT_METRICS_TAG_SUPERSCRIPT_EM_Y_OFFSET, &superscript_y_offset); @@ -6716,7 +6716,12 @@ apply_baseline_shift (PangoLayoutLine *line, hb_tag_t lang_tags[HB_OT_MAX_TAGS_PER_LANGUAGE]; unsigned int script_count = HB_OT_MAX_TAGS_PER_SCRIPT; unsigned int lang_count = HB_OT_MAX_TAGS_PER_LANGUAGE; +#endif + + if (item-analysis.font == NULL) + continue; +#if HB_VERSION_ATLEAST(4,0,0) hb_font = pango_font_get_hb_font (item->analysis.font); script = (hb_script_t) g_unicode_script_to_iso15924 (item->analysis.script); |