[pango/visible-things: 3/13] layout: Add pango_layout_set_shape_flags
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pango/visible-things: 3/13] layout: Add pango_layout_set_shape_flags
- Date: Sun, 7 Jul 2019 18:30:25 +0000 (UTC)
commit ebe086d3b8233c1e5b35b43f4c88729a5a4640cb
Author: Matthias Clasen <mclasen redhat com>
Date: Sun Jul 7 13:39:20 2019 -0400
layout: Add pango_layout_set_shape_flags
This will let apps opt into shaping options
from the high-level api.
pango/pango-layout-private.h | 1 +
pango/pango-layout.c | 23 +++++++++++++++++++++--
pango/pango-layout.h | 6 ++++++
3 files changed, 28 insertions(+), 2 deletions(-)
---
diff --git a/pango/pango-layout-private.h b/pango/pango-layout-private.h
index 38e2e196..440585be 100644
--- a/pango/pango-layout-private.h
+++ b/pango/pango-layout-private.h
@@ -65,6 +65,7 @@ struct _PangoLayout
guint is_wrapped : 1; /* Whether the layout has any wrapped lines */
guint ellipsize : 2; /* PangoEllipsizeMode */
guint is_ellipsized : 1; /* Whether the layout has any ellipsized lines */
+ PangoShapeFlags shape_flags; /* Flags influencing shaping */
int unknown_glyphs_count; /* number of unknown glyphs */
/* some caching */
diff --git a/pango/pango-layout.c b/pango/pango-layout.c
index c956f97c..74d3dedb 100644
--- a/pango/pango-layout.c
+++ b/pango/pango-layout.c
@@ -650,6 +650,26 @@ pango_layout_get_line_spacing (PangoLayout *layout)
return layout->line_spacing;
}
+void
+pango_layout_set_shape_flags (PangoLayout *layout,
+ PangoShapeFlags flags)
+{
+ g_return_if_fail (layout != NULL);
+
+ if (layout->shape_flags != flags)
+ {
+ layout->shape_flags = flags;
+ layout_changed (layout);
+ }
+}
+
+PangoShapeFlags
+pango_layout_get_shape_flags (PangoLayout *layout)
+{
+ g_return_val_if_fail (layout != NULL, FALSE);
+ return layout->shape_flags;
+}
+
/**
* pango_layout_set_attributes:
* @layout: a #PangoLayout
@@ -3310,7 +3330,6 @@ shape_run (PangoLayoutLine *line,
{
PangoLayout *layout = line->layout;
PangoGlyphString *glyphs = pango_glyph_string_new ();
- PangoShapeFlags flags = PANGO_SHAPE_FLAGS_NONE;
if (layout->text[item->offset] == '\t')
shape_tab (line, glyphs);
@@ -3323,7 +3342,7 @@ shape_run (PangoLayoutLine *line,
else
pango_shape_with_options (layout->text + item->offset, item->length,
layout->text, layout->length,
- &item->analysis, flags, glyphs);
+ &item->analysis, layout->shape_flags, glyphs);
if (state->properties.letter_spacing)
{
diff --git a/pango/pango-layout.h b/pango/pango-layout.h
index 96155715..cd610b8c 100644
--- a/pango/pango-layout.h
+++ b/pango/pango-layout.h
@@ -211,6 +211,12 @@ void pango_layout_set_line_spacing (PangoLayout *la
float spread);
PANGO_AVAILABLE_IN_1_44
float pango_layout_get_line_spacing (PangoLayout *layout);
+PANGO_AVAILABLE_IN_1_44
+void pango_layout_set_shape_flags (PangoLayout *layout,
+ PangoShapeFlags flags);
+PANGO_AVAILABLE_IN_1_44
+PangoShapeFlags pango_layout_get_shape_flags (PangoLayout *layout);
+
PANGO_AVAILABLE_IN_ALL
void pango_layout_set_justify (PangoLayout *layout,
gboolean justify);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]