Initial support for new Pango attributes

This is still missing the GtkTextTag hookup,
but it fixes the build.
This commit is contained in:
Matthias Clasen 2021-09-01 10:32:45 -04:00
parent 172d97de05
commit ad3dad1965
3 changed files with 31 additions and 0 deletions

View File

@ -283,6 +283,14 @@ insert_tags_for_attributes (GtkTextBuffer *buffer,
VOID_ATTR (sentence);
break;
case PANGO_ATTR_BASELINE_SHIFT:
INT_ATTR (baseline_shift);
break;
case PANGO_ATTR_FONT_SCALE:
INT_ATTR (font_scale);
break;
case PANGO_ATTR_SHAPE:
case PANGO_ATTR_ABSOLUTE_SIZE:
case PANGO_ATTR_GRAVITY:

View File

@ -267,6 +267,21 @@ attribute_from_text (GtkBuilder *builder,
case PANGO_ATTR_SENTENCE:
attribute = pango_attr_sentence_new ();
break;
case PANGO_ATTR_BASELINE_SHIFT:
if (gtk_builder_value_from_string_type (builder, PANGO_TYPE_BASELINE_SHIFT, value, &val, NULL))
attribute = pango_attr_baseline_shift_new (g_value_get_enum (&val));
else if (gtk_builder_value_from_string_type (builder, G_TYPE_INT, value, &val, NULL))
attribute = pango_attr_baseline_shift_new (g_value_get_enum (&val));
else
g_set_error (error,
GTK_BUILDER_ERROR,
GTK_BUILDER_ERROR_INVALID_VALUE,
"Could not parse '%s' as baseline shift value", value);
break;
case PANGO_ATTR_FONT_SCALE:
if (gtk_builder_value_from_string_type (builder, PANGO_TYPE_FONT_SCALE, value, &val, error))
attribute = pango_attr_font_scale_new (g_value_get_enum (&val));
break;
case PANGO_ATTR_INVALID:
default:
break;

View File

@ -4736,6 +4736,14 @@ insert_tags_for_attributes (GtkTextBuffer *buffer,
VOID_ATTR (sentence);
break;
case PANGO_ATTR_BASELINE_SHIFT:
INT_ATTR (baseline_shift);
break;
case PANGO_ATTR_FONT_SCALE:
INT_ATTR (font_scale);
break;
case PANGO_ATTR_SHAPE:
case PANGO_ATTR_ABSOLUTE_SIZE:
case PANGO_ATTR_GRAVITY: