From 8c973bd8372d7ba8fd42afd85c09bb536a9130c5 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Thu, 31 Jan 2019 14:03:49 -0500 Subject: [PATCH] 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 #include +#include + /** * 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__ */