[gtk/font-explorer-crash] gtk-demo: Avoid invalid OpenType feature tags
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/font-explorer-crash] gtk-demo: Avoid invalid OpenType feature tags
- Date: Mon, 3 Aug 2020 01:14:01 +0000 (UTC)
commit af07cfea5ff74fb99829f3f02b09d620b0976eca
Author: Matthias Clasen <mclasen redhat com>
Date: Sun Aug 2 21:11:30 2020 -0400
gtk-demo: Avoid invalid OpenType feature tags
ss00 doesn't exist, and we use xxxx as placeholder
for 'default' choices in alternatives. Add a warning
in case we run across invalid OpenType feature tags
in fonts.
Fixes: #2962
demos/gtk-demo/font_features.c | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
---
diff --git a/demos/gtk-demo/font_features.c b/demos/gtk-demo/font_features.c
index 6174b27f9b..ffa266258f 100644
--- a/demos/gtk-demo/font_features.c
+++ b/demos/gtk-demo/font_features.c
@@ -130,6 +130,10 @@ static const char *
get_feature_display_name (unsigned int tag)
{
int i;
+ static char buf[5] = { 0, };
+
+ if (tag == MAKE_TAG ('x', 'x', 'x', 'x'))
+ return _("Default");
for (i = 0; i < G_N_ELEMENTS (open_type_layout_features); i++)
{
@@ -137,7 +141,10 @@ get_feature_display_name (unsigned int tag)
return g_dpgettext2 (NULL, "OpenType layout", open_type_layout_features[i].name);
}
- return NULL;
+ hb_tag_to_string (tag, buf);
+ g_warning ("unknown OpenType layout feature tag: %s", buf);
+
+ return buf;
}
static void update_display (void);
@@ -1285,8 +1292,7 @@ do_font_features (GtkWidget *do_widget)
"palt",
"twid",
"qwid", NULL });
- add_check_group (feature_list, _("Alternative Stylistic Sets"), (const char *[]){ "ss00",
- "ss01",
+ add_check_group (feature_list, _("Alternative Stylistic Sets"), (const char *[]){ "ss01",
"ss02",
"ss03",
"ss04",
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]