[pango/matthiasc/for-main: 2/2] Drop the hb-glib dependency again




commit 79454ac56cef1baf49acc7c556cf059d3cbbfad3
Author: Matthias Clasen <mclasen redhat com>
Date:   Wed Mar 9 14:57:42 2022 -0500

    Drop the hb-glib dependency again
    
    It is not really needed.
    
    Fixes: #674

 pango/pango-layout.c      |  3 +--
 utils/viewer-pangocairo.c | 14 +++++++++-----
 2 files changed, 10 insertions(+), 7 deletions(-)
---
diff --git a/pango/pango-layout.c b/pango/pango-layout.c
index 6e4bb357..e45fb69f 100644
--- a/pango/pango-layout.c
+++ b/pango/pango-layout.c
@@ -85,7 +85,6 @@
 #include <locale.h>
 
 #include <hb-ot.h>
-#include <hb-glib.h>
 
 #include "pango-layout-private.h"
 #include "pango-attributes-private.h"
@@ -6720,7 +6719,7 @@ apply_baseline_shift (PangoLayoutLine *line,
 
       hb_font = pango_font_get_hb_font (item->analysis.font);
 
-      script = hb_glib_script_to_script (item->analysis.script);
+      script = (hb_script_t) g_unicode_script_to_iso15924 (item->analysis.script);
       language = hb_language_from_string (pango_language_to_string (item->analysis.language), -1);
       hb_ot_tags_from_script_and_language (script, language,
                                            &script_count, script_tags,
diff --git a/utils/viewer-pangocairo.c b/utils/viewer-pangocairo.c
index 537174aa..ae5813bb 100644
--- a/utils/viewer-pangocairo.c
+++ b/utils/viewer-pangocairo.c
@@ -27,7 +27,6 @@
 #include <pango/pangocairo.h>
 
 #include <hb-ot.h>
-#include <hb-glib.h>
 
 static int opt_annotate = 0;
 
@@ -350,7 +349,7 @@ render_callback (PangoLayout *layout,
 
               if (baseline_tag == 0)
                 {
-                  hb_script_t script = hb_glib_script_to_script (run->item->analysis.script);
+                  hb_script_t script = (hb_script_t) g_unicode_script_to_iso15924 
(run->item->analysis.script);
 
                   if (run->item->analysis.flags & PANGO_ANALYSIS_FLAG_CENTERED_BASELINE)
                     baseline_tag = HB_OT_LAYOUT_BASELINE_TAG_IDEO_EMBOX_CENTRAL;
@@ -366,13 +365,15 @@ render_callback (PangoLayout *layout,
                 dir = HB_DIRECTION_TTB;
               else
                 dir = HB_DIRECTION_LTR;
-              script = hb_glib_script_to_script (run->item->analysis.script);
+              script = (hb_script_t) g_unicode_script_to_iso15924 (run->item->analysis.script);
               lang = HB_TAG_NONE;
 
               for (int i = 0; i < G_N_ELEMENTS (baselines); i++)
                 {
                   char buf[5] = { 0, };
 
+                  hb_tag_to_string (baselines[i], buf);
+
                   cairo_save (cr);
 
                   if (baselines[i] == baseline_tag)
@@ -386,7 +387,10 @@ render_callback (PangoLayout *layout,
                                                  script,
                                                  lang,
                                                  &coord))
-                    cairo_set_dash (cr, NULL, 0, 0);
+                    {
+                      g_print ("baseline %s, value %d\n", buf, coord);
+                      cairo_set_dash (cr, NULL, 0, 0);
+                    }
                   else
                     {
                       double dashes[] = { 4 * lw, 4 * lw };
@@ -398,6 +402,7 @@ render_callback (PangoLayout *layout,
                                                                lang,
                                                                &coord);
 
+                      g_print ("baseline %s, fallback value %d\n", buf, coord);
                       cairo_set_dash (cr, dashes, 2, 0);
                       cairo_set_line_cap (cr, CAIRO_LINE_CAP_SQUARE);
                     }
@@ -410,7 +415,6 @@ render_callback (PangoLayout *layout,
                   cairo_move_to (cr,
                                  (double)rect.x / PANGO_SCALE - 5,
                                  (double)(y - coord) / PANGO_SCALE - 5);
-                  hb_tag_to_string (baselines[i], buf);
                   cairo_show_text (cr, buf);
 
                   cairo_restore (cr);


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