[pango/pango2] Add some diagnostic code
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pango/pango2] Add some diagnostic code
- Date: Mon, 27 Jun 2022 12:39:54 +0000 (UTC)
commit 6358cad2c8da01a10222ae67d1f4fe2c1ab528f2
Author: Matthias Clasen <mclasen redhat com>
Date: Mon Jun 27 08:39:27 2022 -0400
Add some diagnostic code
Check if the hb_face_t objects we create have
font data.
pango2/pangocoretext-fontmap.c | 6 ++++++
pango2/pangodwrite-fontmap.cpp | 6 ++++++
2 files changed, 12 insertions(+)
---
diff --git a/pango2/pangocoretext-fontmap.c b/pango2/pangocoretext-fontmap.c
index 6b75b7263..b45433c8d 100644
--- a/pango2/pangocoretext-fontmap.c
+++ b/pango2/pangocoretext-fontmap.c
@@ -337,6 +337,7 @@ face_from_ct_font_descriptor (CTFontDescriptorRef desc)
hb_face_t *hb_face;
char *name;
Pango2FontDescription *description;
+ hb_blob_t *blob;
ctfont = CTFontCreateWithFontDescriptor (desc, 0.0, NULL);
cgfont = CTFontCopyGraphicsFont (ctfont, NULL);
@@ -346,6 +347,11 @@ face_from_ct_font_descriptor (CTFontDescriptorRef desc)
CFRelease (cgfont);
CFRelease (ctfont);
+ blob = hb_face_reference_blob (hb_face);
+ if (blob == hb_blob_get_empty ())
+ g_warning ("Failed to get font data for ctfont");
+ hb_blob_destroy (blob);
+
name = ct_font_descriptor_get_style_name (desc);
description = font_description_from_ct_font_descriptor (desc);
pango2_font_description_unset_fields (description, PANGO2_FONT_MASK_VARIANT |
diff --git a/pango2/pangodwrite-fontmap.cpp b/pango2/pangodwrite-fontmap.cpp
index ebf44cff3..a9bb29508 100644
--- a/pango2/pangodwrite-fontmap.cpp
+++ b/pango2/pangodwrite-fontmap.cpp
@@ -251,6 +251,12 @@ util_create_pango2_hb_face (IDWriteFontFamily *family,
Pango2FontDescription *description = util_get_pango2_font_description (font, family_name);
hb_face_t *hb_face = hb_directwrite_face_create (face);
char *name = g_strconcat (family_name, " ", variant_name, NULL);
+ hb_blob_t *blob;
+
+ blob = hb_face_reference_blob (hb_face);
+ if (blob == hb_blob_get_empty ())
+ g_warning ("Failed to get font data for ctfont");
+ hb_blob_destroy (blob);
hb_face_make_immutable (hb_face);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]