[pango] Add an analysis flag to mark the ellipsis run



commit 95ccc8910223d7d092f4cc30c93b4a5f9dcd301a
Author: Matthias Clasen <mclasen redhat com>
Date:   Sat Aug 30 14:09:19 2014 -0400

    Add an analysis flag to mark the ellipsis run
    
    Without this, it is hard to determine if you are 'inside the
    ellipsis'. We need to know this in GTK+, e.g. to skip link
    processing.
    
    I decided not to turn the flags into an enum at the time to
    avoid possible language binding problems.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=735719

 pango/ellipsize.c  |    2 ++
 pango/pango-item.h |   13 +++++++++++--
 2 files changed, 13 insertions(+), 2 deletions(-)
---
diff --git a/pango/ellipsize.c b/pango/ellipsize.c
index 1c8aa24..ade33ec 100644
--- a/pango/ellipsize.c
+++ b/pango/ellipsize.c
@@ -645,6 +645,8 @@ fixup_ellipsis_run (EllipsizeState *state)
     level = MIN (level, state->run_info[i].run->item->analysis.level);
 
   item->analysis.level = level;
+
+  item->analysis.flags |= PANGO_ANALYSIS_FLAG_IS_ELLIPSIS;
 }
 
 /* Computes the new list of runs for the line
diff --git a/pango/pango-item.h b/pango/pango-item.h
index b8e8ab6..4f84dc9 100644
--- a/pango/pango-item.h
+++ b/pango/pango-item.h
@@ -29,7 +29,6 @@ G_BEGIN_DECLS
 typedef struct _PangoAnalysis PangoAnalysis;
 typedef struct _PangoItem PangoItem;
 
-/* TODO: if more flags are needed, turn this into a real PangoAnalysisFlags enum */
 /**
  * PANGO_ANALYSIS_FLAG_CENTERED_BASELINE:
  *
@@ -41,6 +40,16 @@ typedef struct _PangoItem PangoItem;
 #define PANGO_ANALYSIS_FLAG_CENTERED_BASELINE (1 << 0)
 
 /**
+ * PANGO_ANALYSIS_FLAG_IS_ELLIPSIS:
+ *
+ * This flag is used to mark runs that hold ellipsized text,
+ * in an ellipsized layout.
+ *
+ * Since: 1.36.7
+ */
+#define PANGO_ANALYSIS_FLAG_IS_ELLIPSIS (1 << 1)
+
+/**
  * PangoAnalysis:
  * @shape_engine: the engine for doing rendering-system-dependent processing.
  * @lang_engine: the engine for doing rendering-system-independent processing.
@@ -74,7 +83,7 @@ struct _PangoAnalysis
 /**
  * PangoItem:
  *
- * The #PangoItem structure stores information abouta segment of text.
+ * The #PangoItem structure stores information about a segment of text.
  */
 struct _PangoItem
 {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]