[pango/line-underline: 57/59] layout: Handle overline attributes
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pango/line-underline: 57/59] layout: Handle overline attributes
- Date: Fri, 1 Nov 2019 01:24:36 +0000 (UTC)
commit 580bb08df7d7d8ac42558cee5bf4d2fc7986327b
Author: Matthias Clasen <mclasen redhat com>
Date: Thu Aug 22 11:45:38 2019 +0200
layout: Handle overline attributes
pango/pango-layout.c | 27 ++++++++++++++++++++++++---
1 file 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;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]