diff options
author | Matthias Clasen <mclasen@redhat.com> | 2022-02-07 00:38:47 -0500 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2022-02-13 14:28:05 -0600 |
commit | 16b209a5e8abdc2dfed469f043498bf954efd7e0 (patch) | |
tree | bb80f060ca726066f09bfd33ebe9c81d0693ef58 /pango/pango-layout.c | |
parent | 7d656b030db6cb9767cd862c8c115e935f0a2ad5 (diff) | |
download | pango-16b209a5e8abdc2dfed469f043498bf954efd7e0.tar.gz |
Split off and underline position attribute
Make the 'low' positioning a separate attribute.
Diffstat (limited to 'pango/pango-layout.c')
-rw-r--r-- | pango/pango-layout.c | 31 |
1 files changed, 18 insertions, 13 deletions
diff --git a/pango/pango-layout.c b/pango/pango-layout.c index e09b6309..2e8e92e7 100644 --- a/pango/pango-layout.c +++ b/pango/pango-layout.c @@ -108,8 +108,8 @@ struct _ItemProperties { guint uline_single : 1; guint uline_double : 1; - guint uline_low : 1; guint uline_error : 1; + PangoUnderlinePosition uline_position; guint strikethrough : 1; guint oline_single : 1; guint showing_space : 1; @@ -5561,8 +5561,9 @@ pango_layout_run_get_extents_and_height (PangoLayoutRun *run, pango_layout_get_item_properties (run->item, &properties); - has_underline = properties.uline_single || properties.uline_double || - properties.uline_low || properties.uline_error; + has_underline = properties.uline_single || + properties.uline_double || + properties.uline_error; has_overline = properties.oline_single; if (!run_logical && (run->item->analysis.flags & PANGO_ANALYSIS_FLAG_CENTERED_BASELINE)) @@ -5620,15 +5621,18 @@ pango_layout_run_get_extents_and_height (PangoLayoutRun *run, run_ink->height += underline_thickness; } - if (properties.uline_low) - run_ink->height += 2 * underline_thickness; if (properties.uline_single) - run_ink->height = MAX (run_ink->height, - underline_thickness - underline_position - run_ink->y); - if (properties.uline_double) + { + if (properties.uline_position == PANGO_UNDERLINE_POSITION_UNDER) + run_ink->height += 2 * underline_thickness; + else + run_ink->height = MAX (run_ink->height, + underline_thickness - underline_position - run_ink->y); + } + else if (properties.uline_double) run_ink->height = MAX (run_ink->height, 3 * underline_thickness - underline_position - run_ink->y); - if (properties.uline_error) + else if (properties.uline_error) run_ink->height = MAX (run_ink->height, 3 * underline_thickness - underline_position - run_ink->y); } @@ -6728,7 +6732,7 @@ pango_layout_get_item_properties (PangoItem *item, properties->uline_single = FALSE; properties->uline_double = FALSE; - properties->uline_low = FALSE; + properties->uline_position = PANGO_UNDERLINE_POSITION_NORMAL; properties->uline_error = FALSE; properties->oline_single = FALSE; properties->strikethrough = FALSE; @@ -6754,9 +6758,6 @@ pango_layout_get_item_properties (PangoItem *item, case PANGO_UNDERLINE_DOUBLE: properties->uline_double = TRUE; break; - case PANGO_UNDERLINE_LOW: - properties->uline_low = TRUE; - break; case PANGO_UNDERLINE_ERROR: properties->uline_error = TRUE; break; @@ -6766,6 +6767,10 @@ pango_layout_get_item_properties (PangoItem *item, } break; + case PANGO_ATTR_UNDERLINE_POSITION: + properties->uline_position = attr->int_value; + break; + case PANGO_ATTR_OVERLINE: switch (attr->int_value) { |