[pango] Fix fallout from bidi deprecation



commit 9fc788a6a6bde68cfeef7dbc4d55969638d82a4a
Author: Matthias Clasen <mclasen redhat com>
Date:   Tue Dec 11 18:52:01 2018 -0500

    Fix fallout from bidi deprecation
    
    PangoDirection is still used in some public apis,
    so just keep it around.
    
    Closes: #339

 pango/meson.build       |  1 +
 pango/pango-bidi-type.c |  3 ++
 pango/pango-bidi-type.h | 42 ++--------------------------
 pango/pango-context.h   |  1 +
 pango/pango-direction.h | 73 +++++++++++++++++++++++++++++++++++++++++++++++++
 pango/pango-layout.c    |  5 ++++
 pango/pango-utils.c     |  5 ++++
 pango/pango.h           |  1 +
 8 files changed, 91 insertions(+), 40 deletions(-)
---
diff --git a/pango/meson.build b/pango/meson.build
index 3424b096..099aed89 100644
--- a/pango/meson.build
+++ b/pango/meson.build
@@ -35,6 +35,7 @@ pango_headers = [
   'pango-break.h',
   'pango-context.h',
   'pango-coverage.h',
+  'pango-direction.h',
   'pango-engine.h',
   'pango-font.h',
   'pango-fontmap.h',
diff --git a/pango/pango-bidi-type.c b/pango/pango-bidi-type.c
index a49e06d9..3e46b66c 100644
--- a/pango/pango-bidi-type.c
+++ b/pango/pango-bidi-type.c
@@ -43,6 +43,8 @@
 
 #include <fribidi.h>
 
+#undef PANGO_DISABLE_DEPRECATED
+
 #include "pango-bidi-type.h"
 #include "pango-utils.h"
 
@@ -305,6 +307,7 @@ pango_unichar_direction (gunichar ch)
     return PANGO_DIRECTION_LTR;
 }
 
+
 /**
  * pango_get_mirror_char:
  * @ch: a Unicode character
diff --git a/pango/pango-bidi-type.h b/pango/pango-bidi-type.h
index 897e25e3..aa1896c1 100644
--- a/pango/pango-bidi-type.h
+++ b/pango/pango-bidi-type.h
@@ -25,6 +25,8 @@
 #include <glib.h>
 
 #include <pango/pango-version-macros.h>
+#include <pango/pango-direction.h>
+
 G_BEGIN_DECLS
 
 #ifndef PANGO_DISABLE_DEPRECATED
@@ -87,46 +89,6 @@ typedef enum {
 PANGO_DEPRECATED_IN_1_44
 PangoBidiType pango_bidi_type_for_unichar (gunichar ch) G_GNUC_CONST;
 
-/**
- * PangoDirection:
- * @PANGO_DIRECTION_LTR: A strong left-to-right direction
- * @PANGO_DIRECTION_RTL: A strong right-to-left direction
- * @PANGO_DIRECTION_TTB_LTR: Deprecated value; treated the
- *   same as %PANGO_DIRECTION_RTL.
- * @PANGO_DIRECTION_TTB_RTL: Deprecated value; treated the
- *   same as %PANGO_DIRECTION_LTR
- * @PANGO_DIRECTION_WEAK_LTR: A weak left-to-right direction
- * @PANGO_DIRECTION_WEAK_RTL: A weak right-to-left direction
- * @PANGO_DIRECTION_NEUTRAL: No direction specified
- *
- * The #PangoDirection type represents a direction in the
- * Unicode bidirectional algorithm; not every value in this
- * enumeration makes sense for every usage of #PangoDirection;
- * for example, the return value of pango_unichar_direction()
- * and pango_find_base_dir() cannot be %PANGO_DIRECTION_WEAK_LTR
- * or %PANGO_DIRECTION_WEAK_RTL, since every character is either
- * neutral or has a strong direction; on the other hand
- * %PANGO_DIRECTION_NEUTRAL doesn't make sense to pass
- * to pango_itemize_with_base_dir().
- *
- * The %PANGO_DIRECTION_TTB_LTR, %PANGO_DIRECTION_TTB_RTL
- * values come from an earlier interpretation of this
- * enumeration as the writing direction of a block of
- * text and are no longer used; See #PangoGravity for how
- * vertical text is handled in Pango.
- *
- * Deprecated: 1.44: Use fribidi for this information
- **/
-typedef enum {
-  PANGO_DIRECTION_LTR,
-  PANGO_DIRECTION_RTL,
-  PANGO_DIRECTION_TTB_LTR,
-  PANGO_DIRECTION_TTB_RTL,
-  PANGO_DIRECTION_WEAK_LTR,
-  PANGO_DIRECTION_WEAK_RTL,
-  PANGO_DIRECTION_NEUTRAL
-} PangoDirection;
-
 PANGO_DEPRECATED_IN_1_44
 PangoDirection pango_unichar_direction      (gunichar     ch) G_GNUC_CONST;
 PANGO_DEPRECATED_IN_1_44
diff --git a/pango/pango-context.h b/pango/pango-context.h
index 439d0995..af934491 100644
--- a/pango/pango-context.h
+++ b/pango/pango-context.h
@@ -25,6 +25,7 @@
 #include <pango/pango-font.h>
 #include <pango/pango-fontmap.h>
 #include <pango/pango-attributes.h>
+#include <pango/pango-direction.h>
 
 G_BEGIN_DECLS
 
diff --git a/pango/pango-direction.h b/pango/pango-direction.h
new file mode 100644
index 00000000..6cbd5aa7
--- /dev/null
+++ b/pango/pango-direction.h
@@ -0,0 +1,73 @@
+/* Pango
+ * pango-direction.h: Unicode text direction
+ *
+ * Copyright (C) 2018 Matthias Clasen
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.         See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __PANGO_DIRECTION_H__
+#define __PANGO_DIRECTION_H__
+
+#include <glib.h>
+
+G_BEGIN_DECLS
+
+/**
+ * PangoDirection:
+ * @PANGO_DIRECTION_LTR: A strong left-to-right direction
+ * @PANGO_DIRECTION_RTL: A strong right-to-left direction
+ * @PANGO_DIRECTION_TTB_LTR: Deprecated value; treated the
+ *   same as %PANGO_DIRECTION_RTL.
+ * @PANGO_DIRECTION_TTB_RTL: Deprecated value; treated the
+ *   same as %PANGO_DIRECTION_LTR
+ * @PANGO_DIRECTION_WEAK_LTR: A weak left-to-right direction
+ * @PANGO_DIRECTION_WEAK_RTL: A weak right-to-left direction
+ * @PANGO_DIRECTION_NEUTRAL: No direction specified
+ *
+ * The #PangoDirection type represents a direction in the
+ * Unicode bidirectional algorithm; not every value in this
+ * enumeration makes sense for every usage of #PangoDirection;
+ * for example, the return value of pango_unichar_direction()
+ * and pango_find_base_dir() cannot be %PANGO_DIRECTION_WEAK_LTR
+ * or %PANGO_DIRECTION_WEAK_RTL, since every character is either
+ * neutral or has a strong direction; on the other hand
+ * %PANGO_DIRECTION_NEUTRAL doesn't make sense to pass
+ * to pango_itemize_with_base_dir().
+ *
+ * The %PANGO_DIRECTION_TTB_LTR, %PANGO_DIRECTION_TTB_RTL
+ * values come from an earlier interpretation of this
+ * enumeration as the writing direction of a block of
+ * text and are no longer used; See #PangoGravity for how
+ * vertical text is handled in Pango.
+ *
+ * If you are interested in text direction, you should
+ * really use fribidi directly. PangoDirection is only
+ * retained because it is used in some public apis.
+ **/
+typedef enum {
+  PANGO_DIRECTION_LTR,
+  PANGO_DIRECTION_RTL,
+  PANGO_DIRECTION_TTB_LTR,
+  PANGO_DIRECTION_TTB_RTL,
+  PANGO_DIRECTION_WEAK_LTR,
+  PANGO_DIRECTION_WEAK_RTL,
+  PANGO_DIRECTION_NEUTRAL
+} PangoDirection;
+
+G_END_DECLS
+
+#endif /* __PANGO_DIRECTION_H__ */
diff --git a/pango/pango-layout.c b/pango/pango-layout.c
index 4e12abf2..397c9499 100644
--- a/pango/pango-layout.c
+++ b/pango/pango-layout.c
@@ -3851,6 +3851,9 @@ apply_no_shape_attributes (PangoLayout   *layout,
     }
 }
 
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
+
 static void
 pango_layout_check_lines (PangoLayout *layout)
 {
@@ -4015,6 +4018,8 @@ pango_layout_check_lines (PangoLayout *layout)
   layout->lines = g_slist_reverse (layout->lines);
 }
 
+#pragma GCC diagnostic pop
+
 /**
  * pango_layout_line_ref:
  * @line: (nullable): a #PangoLayoutLine, may be %NULL
diff --git a/pango/pango-utils.c b/pango/pango-utils.c
index 313471fe..04bbd7cf 100644
--- a/pango/pango-utils.c
+++ b/pango/pango-utils.c
@@ -793,6 +793,9 @@ pango_lookup_aliases (const char   *fontname,
   *n_families = 0;
 }
 
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
+
 /**
  * pango_find_base_dir:
  * @text:   the text to process
@@ -831,6 +834,8 @@ pango_find_base_dir (const gchar *text,
   return dir;
 }
 
+#pragma GCC diagnostic pop
+
 /**
  * pango_is_zero_width:
  * @ch: a Unicode character
diff --git a/pango/pango.h b/pango/pango.h
index bf688323..7a00f925 100644
--- a/pango/pango.h
+++ b/pango/pango.h
@@ -27,6 +27,7 @@
 #include <pango/pango-break.h>
 #include <pango/pango-context.h>
 #include <pango/pango-coverage.h>
+#include <pango/pango-direction.h>
 #include <pango/pango-engine.h>
 #include <pango/pango-enum-types.h>
 #include <pango/pango-features.h>


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