summaryrefslogtreecommitdiff
path: root/pango/pango-layout.c
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2019-08-22 11:45:38 +0200
committerMatthias Clasen <mclasen@redhat.com>2019-10-31 21:23:59 -0400
commit580bb08df7d7d8ac42558cee5bf4d2fc7986327b (patch)
treeedc45f3dfb94c6477fc3d872f8533b532e9f8da0 /pango/pango-layout.c
parent27ede8c45f011d5351a38019332f6f3f85c83a32 (diff)
downloadpango-580bb08df7d7d8ac42558cee5bf4d2fc7986327b.tar.gz
layout: Handle overline attributes
Diffstat (limited to 'pango/pango-layout.c')
-rw-r--r--pango/pango-layout.c27
1 files changed, 24 insertions, 3 deletions
diff --git a/pango/pango-layout.c b/pango/pango-layout.c
index d598680e..2c069269 100644
--- a/pango/pango-layout.c
+++ b/pango/pango-layout.c
@@ -98,6 +98,7 @@ struct _ItemProperties
guint uline_low : 1;
guint uline_error : 1;
guint strikethrough : 1;
+ guint oline_single : 1;
gint rise;
gint letter_spacing;
gboolean shape_set;
@@ -4917,6 +4918,7 @@ pango_layout_run_get_extents_and_height (PangoLayoutRun *run,
ItemProperties properties;
PangoFontMetrics *metrics = NULL;
gboolean has_underline;
+ gboolean has_overline;
if (G_UNLIKELY (!run_ink && !run_logical))
return;
@@ -4925,11 +4927,12 @@ pango_layout_run_get_extents_and_height (PangoLayoutRun *run,
has_underline = properties.uline_single || properties.uline_double ||
properties.uline_low || properties.uline_error;
+ has_overline = properties.oline_single;
if (!run_logical && (run->item->analysis.flags & PANGO_ANALYSIS_FLAG_CENTERED_BASELINE))
run_logical = &logical;
- if (!run_logical && (has_underline || properties.strikethrough))
+ if (!run_logical && (has_underline || has_overline || properties.strikethrough))
run_logical = &logical;
if (properties.shape_set)
@@ -4941,7 +4944,7 @@ pango_layout_run_get_extents_and_height (PangoLayoutRun *run,
pango_glyph_string_extents (run->glyphs, run->item->analysis.font,
run_ink, run_logical);
- if (run_ink && (has_underline || properties.strikethrough))
+ if (run_ink && (has_underline || has_overline || properties.strikethrough))
{
int underline_thickness;
int underline_position;
@@ -4978,7 +4981,12 @@ pango_layout_run_get_extents_and_height (PangoLayoutRun *run,
}
}
-<<<<<<< HEAD
+ if (properties.oline_single)
+ {
+ run_ink->y -= underline_thickness - underline_position;
+ run_ink->height += underline_thickness - underline_position;
+ }
+
if (properties.uline_low)
run_ink->height += 2 * underline_thickness;
if (properties.uline_single)
@@ -5855,6 +5863,7 @@ pango_layout_get_item_properties (PangoItem *item,
properties->uline_double = FALSE;
properties->uline_low = FALSE;
properties->uline_error = FALSE;
+ properties->oline_single = FALSE;
properties->strikethrough = FALSE;
properties->letter_spacing = 0;
properties->rise = 0;
@@ -5894,6 +5903,18 @@ pango_layout_get_item_properties (PangoItem *item,
}
break;
+ case PANGO_ATTR_OVERLINE:
+ switch (((PangoAttrInt *)attr)->value)
+ {
+ case PANGO_OVERLINE_SINGLE:
+ properties->oline_single = TRUE;
+ break;
+ default:
+ g_assert_not_reached ();
+ break;
+ }
+ break;
+
case PANGO_ATTR_STRIKETHROUGH:
properties->strikethrough = ((PangoAttrInt *)attr)->value;
break;