[pangox-compat] Fix find_shaper for module-less pango



commit edb9e0904d04d1da02bba7b78601a2aba05aaa47
Author: Behdad Esfahbod <behdad behdad org>
Date:   Thu Apr 30 12:20:29 2015 -0400

    Fix find_shaper for module-less pango
    
    Not sure if this packge works with module-less pango, but should be much
    closer after this change.  There's the fallback stuff that relies on
    pango_map_get_engine() still, so that needs to be fixed.

 pangox.c |   26 +++++---------------------
 1 files changed, 5 insertions(+), 21 deletions(-)
---
diff --git a/pangox.c b/pangox.c
index 1a98fa5..0a66cc9 100644
--- a/pangox.c
+++ b/pangox.c
@@ -1344,21 +1344,6 @@ pango_x_font_describe (PangoFont *font)
     return NULL;
 }
 
-PangoMap *
-pango_x_get_shaper_map (PangoLanguage *language)
-{
-  static guint engine_type_id = 0;
-  static guint render_type_id = 0;
-
-  if (engine_type_id == 0)
-    {
-      engine_type_id = g_quark_from_static_string (PANGO_ENGINE_TYPE_SHAPE);
-      render_type_id = g_quark_from_static_string (PANGO_RENDER_TYPE_X);
-    }
-
-  return pango_find_map (language, engine_type_id, render_type_id);
-}
-
 static PangoCoverage *
 pango_x_font_get_coverage (PangoFont     *font,
                           PangoLanguage *language)
@@ -1373,12 +1358,11 @@ pango_x_font_find_shaper (PangoFont     *font G_GNUC_UNUSED,
                          PangoLanguage *language,
                          guint32        ch)
 {
-  PangoMap *shape_map = NULL;
-  PangoScript script;
-
-  shape_map = pango_x_get_shaper_map (language);
-  script = pango_script_for_unichar (ch);
-  return (PangoEngineShape *)pango_map_get_engine (shape_map, script);
+  static PangoEngineShape *shaper;
+  if (g_once_init_enter (&shaper))
+    g_once_init_leave (&shaper,
+                      _pango_basic_x_script_engine_create("BasicScriptEngineXCompat"));
+  return shaper;
 }
 
 /* Utility functions */


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