[gtk/wip/jimmac/adwaita-3-32] gdk: Add a copy of pango_unichar_direction



commit 8c973bd8372d7ba8fd42afd85c09bb536a9130c5
Author: Matthias Clasen <mclasen redhat com>
Date:   Thu Jan 31 14:03:49 2019 -0500

    gdk: Add a copy of pango_unichar_direction
    
    This api has been deprecated in pango.

 gdk/gdk.c          | 19 +++++++++++++++++++
 gdk/gdkinternals.h |  2 ++
 2 files changed, 21 insertions(+)
---
diff --git a/gdk/gdk.c b/gdk/gdk.c
index 26950a87e3..7d8727bf17 100644
--- a/gdk/gdk.c
+++ b/gdk/gdk.c
@@ -41,6 +41,8 @@
 #include <string.h>
 #include <stdlib.h>
 
+#include <fribidi.h>
+
 
 /**
  * SECTION:general
@@ -1113,3 +1115,20 @@ gdk_disable_multidevice (void)
 
   _gdk_disable_multidevice = TRUE;
 }
+
+PangoDirection
+gdk_unichar_direction (gunichar ch)
+{
+  FriBidiCharType fribidi_ch_type;
+
+  G_STATIC_ASSERT (sizeof (FriBidiChar) == sizeof (gunichar));
+
+  fribidi_ch_type = fribidi_get_bidi_type (ch);
+
+  if (!FRIBIDI_IS_STRONG (fribidi_ch_type))
+    return PANGO_DIRECTION_NEUTRAL;
+  else if (FRIBIDI_IS_RTL (fribidi_ch_type))
+    return PANGO_DIRECTION_RTL;
+  else
+    return PANGO_DIRECTION_LTR;
+}
diff --git a/gdk/gdkinternals.h b/gdk/gdkinternals.h
index 47d340b5eb..2244c2f2de 100644
--- a/gdk/gdkinternals.h
+++ b/gdk/gdkinternals.h
@@ -558,6 +558,8 @@ cairo_surface_t * _gdk_offscreen_window_create_surface (GdkWindow *window,
                                                         gint       width,
                                                         gint       height);
 
+PangoDirection gdk_unichar_direction (gunichar ch);
+
 G_END_DECLS
 
 #endif /* __GDK_INTERNALS_H__ */


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