[pango/pango2: 22/68] Drop deprecated macros




commit d4572d21fc9b29ea3ae365e5f51e4742768b060c
Author: Matthias Clasen <mclasen redhat com>
Date:   Sat Jun 11 10:34:16 2022 -0400

    Drop deprecated macros
    
    PANGO_UNKNOWN_GLYPH_WIDTH and PANGO_UNKNOWN_GLYPH_HEIGHT
    are now private.

 pango/pango-font-private.h |  7 +++++++
 pango/pango-font.h         |  7 -------
 tests/test-font.c          | 17 +++++++++++++----
 3 files changed, 20 insertions(+), 11 deletions(-)
---
diff --git a/pango/pango-font-private.h b/pango/pango-font-private.h
index 0c42d5a66..93c33577e 100644
--- a/pango/pango-font-private.h
+++ b/pango/pango-font-private.h
@@ -91,3 +91,10 @@ gboolean pango_font_description_is_similar       (const PangoFontDescription *a,
 
 int      pango_font_description_compute_distance (const PangoFontDescription *a,
                                                   const PangoFontDescription *b);
+
+/* We use these values in a few places as a fallback size for an
+ * unknown glyph, if we have no better information.
+ */
+
+#define PANGO_UNKNOWN_GLYPH_WIDTH  10
+#define PANGO_UNKNOWN_GLYPH_HEIGHT 14
diff --git a/pango/pango-font.h b/pango/pango-font.h
index 9275b12f1..813b18118 100644
--- a/pango/pango-font.h
+++ b/pango/pango-font.h
@@ -118,11 +118,4 @@ PangoFont *           pango_font_deserialize       (PangoContext     *context,
 #define PANGO_GLYPH_UNKNOWN_FLAG    ((PangoGlyph)0x10000000)
 #define PANGO_GET_UNKNOWN_GLYPH(wc) ((PangoGlyph)(wc)|PANGO_GLYPH_UNKNOWN_FLAG)
 
-#ifndef __GI_SCANNER__
-#ifndef PANGO_DISABLE_DEPRECATED
-#define PANGO_UNKNOWN_GLYPH_WIDTH  10
-#define PANGO_UNKNOWN_GLYPH_HEIGHT 14
-#endif
-#endif
-
 G_END_DECLS
diff --git a/tests/test-font.c b/tests/test-font.c
index 3b45ba299..a527f3630 100644
--- a/tests/test-font.c
+++ b/tests/test-font.c
@@ -26,6 +26,7 @@
 #include <gio/gio.h>
 #include <pango/pango.h>
 #include <pango/pango-item-private.h>
+#include <pango/pango-font-private.h>
 
 static PangoContext *context;
 
@@ -472,10 +473,18 @@ test_glyph_extents (void)
   PangoRectangle ink, logical;
 
   pango_font_get_glyph_extents (NULL, 0, &ink, &logical);
-  g_assert_cmpint (ink.height, ==, (PANGO_UNKNOWN_GLYPH_HEIGHT - 2) * PANGO_SCALE);
-  g_assert_cmpint (ink.width, ==, (PANGO_UNKNOWN_GLYPH_WIDTH - 2) * PANGO_SCALE);
-  g_assert_cmpint (logical.height, ==, PANGO_UNKNOWN_GLYPH_HEIGHT * PANGO_SCALE);
-  g_assert_cmpint (logical.width, ==, PANGO_UNKNOWN_GLYPH_WIDTH * PANGO_SCALE);
+
+  /* We are promised 'sane values', so lets check that
+   * we are between 1 and 100 pixels in both dimensions.
+   */
+  g_assert_cmpint (ink.height, >=, PANGO_SCALE);
+  g_assert_cmpint (ink.height, <=, 100 * PANGO_SCALE);
+  g_assert_cmpint (ink.width, >=, PANGO_SCALE);
+  g_assert_cmpint (ink.width, <=, 100 * PANGO_SCALE);
+  g_assert_cmpint (logical.height, >=, PANGO_SCALE);
+  g_assert_cmpint (logical.height, <=, 100 * PANGO_SCALE);
+  g_assert_cmpint (logical.width, >=, PANGO_SCALE);
+  g_assert_cmpint (logical.width, <=, 100 * PANGO_SCALE);
 }
 
 static void


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