[pango/pango2: 60/112] Clean up private utils




commit be1b8fbf076bae72e8840e390cbecb97ea617ce5
Author: Matthias Clasen <mclasen redhat com>
Date:   Fri Jun 10 21:46:52 2022 -0400

    Clean up private utils
    
    Drop pango-utils-internal.h.

 pango/itemize.c                           |  1 +
 pango/meson.build                         |  2 +-
 pango/pango-bidi-private.h                | 32 +++++++++++++++++
 pango/{pango-bidi-type.c => pango-bidi.c} | 60 +++++++++++++++----------------
 pango/pango-color.c                       |  2 +-
 pango/pango-font-description-private.h    | 13 +++++++
 pango/pango-font-description.c            | 11 +++---
 pango/pango-line-breaker.c                |  2 +-
 pango/pango-markup.c                      |  2 +-
 pango/pango-utils-internal.h              | 45 -----------------------
 pango/pango-utils.c                       |  1 -
 pango/pango-utils.h                       |  7 ----
 pango/serializer.c                        |  1 -
 tests/test-bidi.c                         |  4 +++
 14 files changed, 88 insertions(+), 95 deletions(-)
---
diff --git a/pango/itemize.c b/pango/itemize.c
index f2510537a..7dc004464 100644
--- a/pango/itemize.c
+++ b/pango/itemize.c
@@ -33,6 +33,7 @@
 #include "pango-emoji-private.h"
 #include "pango-attr-iterator-private.h"
 #include "pango-item-private.h"
+#include "pango-bidi-private.h"
 
 #include <hb-ot.h>
 
diff --git a/pango/meson.build b/pango/meson.build
index 2238d68c8..62d0cdd6e 100644
--- a/pango/meson.build
+++ b/pango/meson.build
@@ -7,7 +7,7 @@ pango_sources = [
   'pango-attr-list.c',
   'pango-attr-iterator.c',
   'pango-attributes.c',
-  'pango-bidi-type.c',
+  'pango-bidi.c',
   'pango-color.c',
   'pango-context.c',
   'pango-coverage.c',
diff --git a/pango/pango-bidi-private.h b/pango/pango-bidi-private.h
new file mode 100644
index 000000000..014d9bb81
--- /dev/null
+++ b/pango/pango-bidi-private.h
@@ -0,0 +1,32 @@
+/*
+ * Copyright (C) 2000 Red Hat Software
+ *
+ * SPDX-License-Identifier: LGPL-2.1-or-later
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+#pragma once
+
+#include <stdio.h>
+#include <glib.h>
+#include <pango/pango-font.h>
+#include <pango/pango-direction.h>
+
+guint8 *        pango_log2vis_get_embedding_levels (const char     *text,
+                                                    int             length,
+                                                    PangoDirection *pbase_dir);
+
+PangoDirection  pango_find_base_dir                (const char     *text,
+                                                    int             length);
diff --git a/pango/pango-bidi-type.c b/pango/pango-bidi.c
similarity index 80%
rename from pango/pango-bidi-type.c
rename to pango/pango-bidi.c
index 1e789a6e3..854721b23 100644
--- a/pango/pango-bidi-type.c
+++ b/pango/pango-bidi.c
@@ -10,7 +10,7 @@
  *
  * This library is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.         See the GNU
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Library General Public License for more details.
  *
  * You should have received a copy of the GNU Library General Public
@@ -25,12 +25,12 @@
 
 #include <fribidi.h>
 
+#include "pango-bidi-private.h"
 #include "pango-utils.h"
-#include "pango-utils-internal.h"
 
 /* Some bidi-related functions */
 
-/**
+/*< private >
  * pango_log2vis_get_embedding_levels:
  * @text: the text to itemize.
  * @length: the number of bytes (not characters) to process, or -1
@@ -49,13 +49,13 @@
  *   character (not byte), that should be freed using [func GLib free].
  */
 guint8 *
-pango_log2vis_get_embedding_levels (const gchar    *text,
-                                   int             length,
-                                   PangoDirection *pbase_dir)
+pango_log2vis_get_embedding_levels (const char     *text,
+                                    int             length,
+                                    PangoDirection *pbase_dir)
 {
   glong n_chars, i;
   guint8 *embedding_levels_list;
-  const gchar *p;
+  const char *p;
   FriBidiParType fribidi_base_dir;
   FriBidiCharType *bidi_types;
   FriBidiBracketType *bracket_types;
@@ -126,17 +126,17 @@ pango_log2vis_get_embedding_levels (const gchar    *text,
      * o there are letters, and base_dir is weak.
      */
     if (!FRIBIDI_IS_ISOLATE (ored_types) &&
-       !FRIBIDI_IS_RTL (ored_types) &&
-       !FRIBIDI_IS_ARABIC (ored_types) &&
-       (!FRIBIDI_IS_RTL (fribidi_base_dir) ||
-         (FRIBIDI_IS_WEAK (fribidi_base_dir) &&
-          FRIBIDI_IS_LETTER (ored_types))
-       ))
+        !FRIBIDI_IS_RTL (ored_types) &&
+        !FRIBIDI_IS_ARABIC (ored_types) &&
+        (!FRIBIDI_IS_RTL (fribidi_base_dir) ||
+          (FRIBIDI_IS_WEAK (fribidi_base_dir) &&
+           FRIBIDI_IS_LETTER (ored_types))
+        ))
       {
         /* all LTR */
-       fribidi_base_dir = FRIBIDI_PAR_LTR;
-       memset (embedding_levels_list, 0, n_chars);
-       goto resolved;
+        fribidi_base_dir = FRIBIDI_PAR_LTR;
+        memset (embedding_levels_list, 0, n_chars);
+        goto resolved;
       }
     /* The case that all resolved levels will be RTL is much more complex.
      * No isolates, no numbers, all strongs are RTL, and one of
@@ -146,23 +146,23 @@ pango_log2vis_get_embedding_levels (const gchar    *text,
      * o there are letters, and base_dir is weak.
      */
     else if (!FRIBIDI_IS_ISOLATE (ored_types) &&
-            !FRIBIDI_IS_NUMBER (ored_types) &&
-            FRIBIDI_IS_RTL (anded_strongs) &&
-            (FRIBIDI_IS_RTL (fribidi_base_dir) ||
-              (FRIBIDI_IS_WEAK (fribidi_base_dir) &&
-               FRIBIDI_IS_LETTER (ored_types))
-            ))
+             !FRIBIDI_IS_NUMBER (ored_types) &&
+             FRIBIDI_IS_RTL (anded_strongs) &&
+             (FRIBIDI_IS_RTL (fribidi_base_dir) ||
+               (FRIBIDI_IS_WEAK (fribidi_base_dir) &&
+                FRIBIDI_IS_LETTER (ored_types))
+             ))
       {
         /* all RTL */
-       fribidi_base_dir = FRIBIDI_PAR_RTL;
-       memset (embedding_levels_list, 1, n_chars);
-       goto resolved;
+        fribidi_base_dir = FRIBIDI_PAR_RTL;
+        memset (embedding_levels_list, 1, n_chars);
+        goto resolved;
       }
 
 
   max_level = fribidi_get_par_embedding_levels_ex (bidi_types, bracket_types, n_chars,
-                                                  &fribidi_base_dir,
-                                                  (FriBidiLevel*)embedding_levels_list);
+                                                   &fribidi_base_dir,
+                                                   (FriBidiLevel*)embedding_levels_list);
 
   if (G_UNLIKELY(max_level == 0))
     {
@@ -197,11 +197,11 @@ pango_unichar_direction (gunichar ch)
 }
 
 PangoDirection
-pango_find_base_dir (const gchar *text,
-                     gint         length)
+pango_find_base_dir (const char *text,
+                     int         length)
 {
   PangoDirection dir = PANGO_DIRECTION_NEUTRAL;
-  const gchar *p;
+  const char *p;
 
   g_return_val_if_fail (text != NULL || length == 0, PANGO_DIRECTION_NEUTRAL);
 
diff --git a/pango/pango-color.c b/pango/pango-color.c
index 6d7f70dc5..8d67f62cb 100644
--- a/pango/pango-color.c
+++ b/pango/pango-color.c
@@ -26,7 +26,7 @@
 
 #include "pango-attributes.h"
 #include "pango-impl-utils.h"
-#include "pango-utils-internal.h"
+
 
 G_DEFINE_BOXED_TYPE (PangoColor, pango_color,
                      pango_color_copy,
diff --git a/pango/pango-font-description-private.h b/pango/pango-font-description-private.h
index 0a2764131..353cdd924 100644
--- a/pango/pango-font-description-private.h
+++ b/pango/pango-font-description-private.h
@@ -28,3 +28,16 @@ gboolean pango_font_description_is_similar       (const PangoFontDescription *a,
 int      pango_font_description_compute_distance (const PangoFontDescription *a,
                                                   const PangoFontDescription *b);
 
+gboolean pango_parse_style              (const char   *str,
+                                         PangoStyle   *style,
+                                         gboolean      warn);
+gboolean pango_parse_variant            (const char   *str,
+                                         PangoVariant *variant,
+                                         gboolean      warn);
+gboolean pango_parse_weight             (const char   *str,
+                                         PangoWeight  *weight,
+                                         gboolean      warn);
+gboolean pango_parse_stretch            (const char   *str,
+                                         PangoStretch *stretch,
+                                         gboolean      warn);
+
diff --git a/pango/pango-font-description.c b/pango/pango-font-description.c
index 3aac7d663..485a641a1 100644
--- a/pango/pango-font-description.c
+++ b/pango/pango-font-description.c
@@ -23,9 +23,6 @@
 
 #include "pango-font-description-private.h"
 
-#include "pango-utils-internal.h"
-
-
 struct _PangoFontDescription
 {
   char *family_name;
@@ -1636,7 +1633,7 @@ parse_field (const char *what,
 #define FIELD(NAME, MASK) \
   parse_field (G_STRINGIFY (NAME), NAME##_map, G_N_ELEMENTS (NAME##_map), str, (int *)(void *)NAME, warn)
 
-/**
+/*< private >
  * pango_parse_style:
  * @str: a string to parse.
  * @style: (out): a `PangoStyle` to store the result in.
@@ -1658,7 +1655,7 @@ pango_parse_style (const char *str,
   return FIELD (style,   PANGO_FONT_MASK_STYLE);
 }
 
-/**
+/*< private >
  * pango_parse_variant:
  * @str: a string to parse.
  * @variant: (out): a `PangoVariant` to store the result in.
@@ -1680,7 +1677,7 @@ pango_parse_variant (const char   *str,
   return FIELD (variant, PANGO_FONT_MASK_VARIANT);
 }
 
-/**
+/*< private >
  * pango_parse_weight:
  * @str: a string to parse.
  * @weight: (out): a `PangoWeight` to store the result in.
@@ -1702,7 +1699,7 @@ pango_parse_weight (const char  *str,
   return FIELD (weight,  PANGO_FONT_MASK_WEIGHT);
 }
 
-/**
+/*< private >
  * pango_parse_stretch:
  * @str: a string to parse.
  * @stretch: (out): a `PangoStretch` to store the result in.
diff --git a/pango/pango-line-breaker.c b/pango/pango-line-breaker.c
index d7a94d5f2..d9cb23097 100644
--- a/pango/pango-line-breaker.c
+++ b/pango/pango-line-breaker.c
@@ -9,7 +9,7 @@
 #include "pango-attr-list-private.h"
 #include "pango-attr-iterator-private.h"
 #include "pango-item-private.h"
-#include "pango-utils-internal.h"
+#include "pango-bidi-private.h"
 
 #include <locale.h>
 
diff --git a/pango/pango-markup.c b/pango/pango-markup.c
index b9dee89ea..aea2c3ca3 100644
--- a/pango/pango-markup.c
+++ b/pango/pango-markup.c
@@ -30,7 +30,7 @@
 #include "pango-font.h"
 #include "pango-enum-types.h"
 #include "pango-impl-utils.h"
-#include "pango-utils-internal.h"
+#include "pango-font-description-private.h"
 
 /* FIXME */
 #define _(x) x
diff --git a/pango/pango-utils.c b/pango/pango-utils.c
index 863414dc3..d759d2ace 100644
--- a/pango/pango-utils.c
+++ b/pango/pango-utils.c
@@ -29,7 +29,6 @@
 #include "pango-font.h"
 #include "pango-features.h"
 #include "pango-impl-utils.h"
-#include "pango-utils-internal.h"
 
 #include <glib/gstdio.h>
 
diff --git a/pango/pango-utils.h b/pango/pango-utils.h
index d93f5c9af..75c082d38 100644
--- a/pango/pango-utils.h
+++ b/pango/pango-utils.h
@@ -25,13 +25,6 @@
 
 G_BEGIN_DECLS
 
-/* A routine from fribidi that we either wrap or provide ourselves.
- */
-PANGO_AVAILABLE_IN_ALL
-guint8 * pango_log2vis_get_embedding_levels (const gchar    *text,
-                                             int             length,
-                                             PangoDirection *pbase_dir);
-
 /* Unicode characters that are zero-width and should not be rendered
  * normally.
  */
diff --git a/pango/serializer.c b/pango/serializer.c
index c57968816..2ad0d4229 100644
--- a/pango/serializer.c
+++ b/pango/serializer.c
@@ -26,7 +26,6 @@
 #include <pango/pango-enum-types.h>
 #include <pango/pango-font-private.h>
 #include <pango/pango-line-private.h>
-#include <pango/pango-utils-internal.h>
 #include <pango/pango-hbface.h>
 #include <pango/pango-attributes.h>
 #include <pango/pango-attr-private.h>
diff --git a/tests/test-bidi.c b/tests/test-bidi.c
index 3fa7dd53e..6332edf87 100644
--- a/tests/test-bidi.c
+++ b/tests/test-bidi.c
@@ -25,6 +25,7 @@
 
 static PangoContext *context;
 
+#if 0
 static void
 test_bidi_embedding_levels (void)
 {
@@ -72,6 +73,7 @@ test_bidi_embedding_levels (void)
       g_free (levels);
     }
 }
+#endif
 
 /* Some basic tests for pango_layout_move_cursor inside
  * a single PangoLine:
@@ -381,7 +383,9 @@ main (int argc, char *argv[])
 
   g_test_init (&argc, &argv, NULL);
 
+#if 0
   g_test_add_func ("/bidi/embedding-levels", test_bidi_embedding_levels);
+#endif
   g_test_add_func ("/bidi/move-cursor-line", test_move_cursor_line);
   g_test_add_func ("/bidi/move-cursor-para", test_move_cursor_para);
 


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