[pango/kill-lang-engine: 2/2] Remove language engine remnants



commit 8e4cee2589572c7909d07bbcc6ea500b1c4b688e
Author: Matthias Clasen <mclasen redhat com>
Date:   Tue Jul 9 12:05:44 2019 -0400

    Remove language engine remnants
    
    Drop all internal use of language engines.
    The lang_engine field in PangoAnalysis is now unused.

 pango/break.c                | 40 ----------------------------------------
 pango/pango-context.c        |  9 ---------
 pango/pango-engine-private.h |  2 --
 pango/pango-layout.c         | 11 +++--------
 4 files changed, 3 insertions(+), 59 deletions(-)
---
diff --git a/pango/break.c b/pango/break.c
index c27ee7b4..4c389515 100644
--- a/pango/break.c
+++ b/pango/break.c
@@ -22,7 +22,6 @@
 #include "config.h"
 
 #include "pango-break.h"
-#include "pango-engine-private.h"
 #include "pango-script-private.h"
 #include "pango-emoji-private.h"
 #include "pango-break-table.h"
@@ -1796,7 +1795,6 @@ pango_get_log_attrs (const char    *text,
   g_return_if_fail (log_attrs != NULL);
 
   analysis.level = level;
-  analysis.lang_engine = _pango_get_language_engine ();
 
   pango_default_break (text, length, &analysis, log_attrs, attrs_len);
 
@@ -1861,41 +1859,3 @@ break_script (const char          *item_text,
 
   return TRUE;
 }
-
-
-/* Wrap language breaker in PangoEngineLang to pass it through old API,
- * from times when there were modules and engines. */
-typedef PangoEngineLang      PangoLanguageEngine;
-typedef PangoEngineLangClass PangoLanguageEngineClass;
-static GType pango_language_engine_get_type (void) G_GNUC_CONST;
-G_GNUC_BEGIN_IGNORE_DEPRECATIONS
-G_DEFINE_TYPE (PangoLanguageEngine, pango_language_engine, PANGO_TYPE_ENGINE_LANG);
-G_GNUC_END_IGNORE_DEPRECATIONS
-static void
-_pango_language_engine_break (PangoEngineLang *engine G_GNUC_UNUSED,
-                             const char      *item_text,
-                             int              item_length,
-                             PangoAnalysis   *analysis,
-                             PangoLogAttr    *attrs,
-                             int              attrs_len)
-{
-  break_script (item_text, item_length, analysis, attrs, attrs_len);
-}
-static void
-pango_language_engine_class_init (PangoEngineLangClass *class)
-{
-  class->script_break = _pango_language_engine_break;
-}
-static void
-pango_language_engine_init (PangoEngineLang *object)
-{
-}
-
-PangoEngineLang *
-_pango_get_language_engine (void)
-{
-  static PangoEngineLang *engine;
-  if (g_once_init_enter (&engine))
-    g_once_init_leave (&engine, g_object_new (pango_language_engine_get_type(), NULL));
-  return engine;
-}
diff --git a/pango/pango-context.c b/pango/pango-context.c
index 83fdc9a6..b8e78c22 100644
--- a/pango/pango-context.c
+++ b/pango/pango-context.c
@@ -758,7 +758,6 @@ struct _ItemizeState
   PangoEmojiIter emoji_iter;
 
   PangoLanguage *derived_lang;
-  PangoEngineLang *lang_engine;
 
   PangoFontset *current_fonts;
   FontCache *cache;
@@ -1061,7 +1060,6 @@ itemize_state_init (ItemizeState      *state,
   state->gravity_hint = state->context->gravity_hint;
   state->resolved_gravity = PANGO_GRAVITY_AUTO;
   state->derived_lang = NULL;
-  state->lang_engine = NULL;
   state->current_fonts = NULL;
   state->cache = NULL;
   state->base_font = NULL;
@@ -1165,7 +1163,6 @@ itemize_state_add_character (ItemizeState     *state,
        }
 
       if (!force_break &&
-         state->item->analysis.lang_engine == state->lang_engine &&
          state->item->analysis.shape_engine == shape_engine &&
          state->item->analysis.font == font)
        {
@@ -1181,7 +1178,6 @@ itemize_state_add_character (ItemizeState     *state,
   state->item->length = 0;
   state->item->num_chars = 1;
   state->item->analysis.shape_engine = shape_engine;
-  state->item->analysis.lang_engine = state->lang_engine;
 
   if (font)
     g_object_ref (font);
@@ -1404,11 +1400,6 @@ itemize_state_update_for_new_run (ItemizeState *state)
        state->changed |= DERIVED_LANG_CHANGED;
     }
 
-  if ((state->changed & DERIVED_LANG_CHANGED) || !state->lang_engine)
-    {
-      state->lang_engine = _pango_get_language_engine ();
-    }
-
   if (state->changed & (EMOJI_CHANGED))
     {
       state->changed |= FONT_CHANGED;
diff --git a/pango/pango-engine-private.h b/pango/pango-engine-private.h
index de54ee09..cd0b6103 100644
--- a/pango/pango-engine-private.h
+++ b/pango/pango-engine-private.h
@@ -42,8 +42,6 @@ PangoCoverageLevel _pango_engine_shape_covers (PangoEngineShape *engine,
 
 PangoEngineShape *_pango_get_fallback_shaper (void) /* XXX got to go when we switch to harfbuzz-only. */;
 
-PangoEngineLang *_pango_get_language_engine (void);
-
 G_END_DECLS
 
 #endif /* __PANGO_ENGINE_PRIVATE_H__ */
diff --git a/pango/pango-layout.c b/pango/pango-layout.c
index baf81bd4..43139212 100644
--- a/pango/pango-layout.c
+++ b/pango/pango-layout.c
@@ -3912,13 +3912,8 @@ get_items_log_attrs (const char   *text,
          PangoItem *next_item = items->next->data;
 
          /* FIXME: Handle language tags */
-         if (next_item->analysis.lang_engine != tmp_item.analysis.lang_engine)
-           break;
-         else
-           {
-             tmp_item.length += next_item->length;
-             tmp_item.num_chars += next_item->num_chars;
-           }
+         tmp_item.length += next_item->length;
+         tmp_item.num_chars += next_item->num_chars;
 
          items = items->next;
        }
@@ -3931,7 +3926,7 @@ get_items_log_attrs (const char   *text,
        }
 
       /* XXX This is wrong.  we should call pango_default_break on the entire
-       * layout text and then tailor_break on each lang_engine change, like
+       * layout text and then tailor_break on each language change, like
        * pango_get_log_attrs does.
        */
       pango_break (text + index, tmp_item.length, &tmp_item.analysis,


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