[pango/pango2: 26/168] Move PangoFontMetrics to its own files




commit 3c81df9b783e5ed021be3ecc74d7d143c33f3fb4
Author: Matthias Clasen <mclasen redhat com>
Date:   Sat Feb 12 10:17:51 2022 -0500

    Move PangoFontMetrics to its own files

 pango/fonts.c                      | 250 +--------------------------------
 pango/meson.build                  |   2 +
 pango/pango-context.c              |   2 +-
 pango/pango-font-metrics-private.h |  24 ++++
 pango/pango-font-metrics.c         | 274 +++++++++++++++++++++++++++++++++++++
 pango/pango-font-metrics.h         |  97 +++++++++++++
 pango/pango-font-private.h         |   3 -
 pango/pango-font.h                 |  70 +---------
 pango/pango-fontset.c              |   2 +-
 pango/pango.h                      |   1 +
 pango/pangocairo-font.c            |   1 +
 pango/pangofc-font.c               |   1 +
 12 files changed, 404 insertions(+), 323 deletions(-)
---
diff --git a/pango/fonts.c b/pango/fonts.c
index 2a226d89..584c64a4 100644
--- a/pango/fonts.c
+++ b/pango/fonts.c
@@ -28,6 +28,7 @@
 
 #include "pango-types.h"
 #include "pango-font-private.h"
+#include "pango-font-metrics-private.h"
 #include "pango-fontmap.h"
 #include "pango-impl-utils.h"
 
@@ -379,255 +380,6 @@ pango_font_get_hb_font (PangoFont *font)
   return priv->hb_font;
 }
 
-G_DEFINE_BOXED_TYPE (PangoFontMetrics, pango_font_metrics,
-                     pango_font_metrics_ref,
-                     pango_font_metrics_unref);
-
-/**
- * pango_font_metrics_new:
- *
- * Creates a new `PangoFontMetrics` structure.
- *
- * This is only for internal use by Pango backends and there is
- * no public way to set the fields of the structure.
- *
- * Return value: a newly-created `PangoFontMetrics` structure
- *   with a reference count of 1.
- */
-PangoFontMetrics *
-pango_font_metrics_new (void)
-{
-  PangoFontMetrics *metrics = g_slice_new0 (PangoFontMetrics);
-  metrics->ref_count = 1;
-
-  return metrics;
-}
-
-/**
- * pango_font_metrics_ref:
- * @metrics: (nullable): a `PangoFontMetrics` structure, may be %NULL
- *
- * Increase the reference count of a font metrics structure by one.
- *
- * Return value: (nullable): @metrics
- */
-PangoFontMetrics *
-pango_font_metrics_ref (PangoFontMetrics *metrics)
-{
-  if (metrics == NULL)
-    return NULL;
-
-  g_atomic_int_inc ((int *) &metrics->ref_count);
-
-  return metrics;
-}
-
-/**
- * pango_font_metrics_unref:
- * @metrics: (nullable): a `PangoFontMetrics` structure, may be %NULL
- *
- * Decrease the reference count of a font metrics structure by one.
- *
- * If the result is zero, frees the structure and any associated memory.
- */
-void
-pango_font_metrics_unref (PangoFontMetrics *metrics)
-{
-  if (metrics == NULL)
-    return;
-
-  g_return_if_fail (metrics->ref_count > 0 );
-
-  if (g_atomic_int_dec_and_test ((int *) &metrics->ref_count))
-    g_slice_free (PangoFontMetrics, metrics);
-}
-
-/**
- * pango_font_metrics_get_ascent:
- * @metrics: a `PangoFontMetrics` structure
- *
- * Gets the ascent from a font metrics structure.
- *
- * The ascent is the distance from the baseline to the logical top
- * of a line of text. (The logical top may be above or below the top
- * of the actual drawn ink. It is necessary to lay out the text to
- * figure where the ink will be.)
- *
- * Return value: the ascent, in Pango units.
- */
-int
-pango_font_metrics_get_ascent (PangoFontMetrics *metrics)
-{
-  g_return_val_if_fail (metrics != NULL, 0);
-
-  return metrics->ascent;
-}
-
-/**
- * pango_font_metrics_get_descent:
- * @metrics: a `PangoFontMetrics` structure
- *
- * Gets the descent from a font metrics structure.
- *
- * The descent is the distance from the baseline to the logical bottom
- * of a line of text. (The logical bottom may be above or below the
- * bottom of the actual drawn ink. It is necessary to lay out the text
- * to figure where the ink will be.)
- *
- * Return value: the descent, in Pango units.
- */
-int
-pango_font_metrics_get_descent (PangoFontMetrics *metrics)
-{
-  g_return_val_if_fail (metrics != NULL, 0);
-
-  return metrics->descent;
-}
-
-/**
- * pango_font_metrics_get_height:
- * @metrics: a `PangoFontMetrics` structure
- *
- * Gets the line height from a font metrics structure.
- *
- * The line height is the recommended distance between successive
- * baselines in wrapped text using this font.
- *
- * If the line height is not available, 0 is returned.
- *
- * Return value: the height, in Pango units
- *
- * Since: 1.44
- */
-int
-pango_font_metrics_get_height (PangoFontMetrics *metrics)
-{
-  g_return_val_if_fail (metrics != NULL, 0);
-
-  return metrics->height;
-}
-
-/**
- * pango_font_metrics_get_approximate_char_width:
- * @metrics: a `PangoFontMetrics` structure
- *
- * Gets the approximate character width for a font metrics structure.
- *
- * This is merely a representative value useful, for example, for
- * determining the initial size for a window. Actual characters in
- * text will be wider and narrower than this.
- *
- * Return value: the character width, in Pango units.
- */
-int
-pango_font_metrics_get_approximate_char_width (PangoFontMetrics *metrics)
-{
-  g_return_val_if_fail (metrics != NULL, 0);
-
-  return metrics->approximate_char_width;
-}
-
-/**
- * pango_font_metrics_get_approximate_digit_width:
- * @metrics: a `PangoFontMetrics` structure
- *
- * Gets the approximate digit width for a font metrics structure.
- *
- * This is merely a representative value useful, for example, for
- * determining the initial size for a window. Actual digits in
- * text can be wider or narrower than this, though this value
- * is generally somewhat more accurate than the result of
- * pango_font_metrics_get_approximate_char_width() for digits.
- *
- * Return value: the digit width, in Pango units.
- */
-int
-pango_font_metrics_get_approximate_digit_width (PangoFontMetrics *metrics)
-{
-  g_return_val_if_fail (metrics != NULL, 0);
-
-  return metrics->approximate_digit_width;
-}
-
-/**
- * pango_font_metrics_get_underline_position:
- * @metrics: a `PangoFontMetrics` structure
- *
- * Gets the suggested position to draw the underline.
- *
- * The value returned is the distance *above* the baseline of the top
- * of the underline. Since most fonts have underline positions beneath
- * the baseline, this value is typically negative.
- *
- * Return value: the suggested underline position, in Pango units.
- *
- * Since: 1.6
- */
-int
-pango_font_metrics_get_underline_position (PangoFontMetrics *metrics)
-{
-  g_return_val_if_fail (metrics != NULL, 0);
-
-  return metrics->underline_position;
-}
-
-/**
- * pango_font_metrics_get_underline_thickness:
- * @metrics: a `PangoFontMetrics` structure
- *
- * Gets the suggested thickness to draw for the underline.
- *
- * Return value: the suggested underline thickness, in Pango units.
- *
- * Since: 1.6
- */
-int
-pango_font_metrics_get_underline_thickness (PangoFontMetrics *metrics)
-{
-  g_return_val_if_fail (metrics != NULL, 0);
-
-  return metrics->underline_thickness;
-}
-
-/**
- * pango_font_metrics_get_strikethrough_position:
- * @metrics: a `PangoFontMetrics` structure
- *
- * Gets the suggested position to draw the strikethrough.
- *
- * The value returned is the distance *above* the
- * baseline of the top of the strikethrough.
- *
- * Return value: the suggested strikethrough position, in Pango units.
- *
- * Since: 1.6
- */
-int
-pango_font_metrics_get_strikethrough_position (PangoFontMetrics *metrics)
-{
-  g_return_val_if_fail (metrics != NULL, 0);
-
-  return metrics->strikethrough_position;
-}
-
-/**
- * pango_font_metrics_get_strikethrough_thickness:
- * @metrics: a `PangoFontMetrics` structure
- *
- * Gets the suggested thickness to draw for the strikethrough.
- *
- * Return value: the suggested strikethrough thickness, in Pango units.
- *
- * Since: 1.6
- */
-int
-pango_font_metrics_get_strikethrough_thickness (PangoFontMetrics *metrics)
-{
-  g_return_val_if_fail (metrics != NULL, 0);
-
-  return metrics->strikethrough_thickness;
-}
-
 /*
  * PangoFontFamily
  */
diff --git a/pango/meson.build b/pango/meson.build
index 2f0f0de5..5d21c39e 100644
--- a/pango/meson.build
+++ b/pango/meson.build
@@ -11,6 +11,7 @@ pango_sources = [
   'pango-coverage.c',
   'pango-emoji.c',
   'pango-font-description.c',
+  'pango-font-metrics.c',
   'pango-fontmap.c',
   'pango-fontset.c',
   'pango-fontset-simple.c',
@@ -42,6 +43,7 @@ pango_headers = [
   'pango-direction.h',
   'pango-font.h',
   'pango-font-description.h',
+  'pango-font-metrics.h',
   'pango-fontmap.h',
   'pango-fontset.h',
   'pango-fontset-simple.h',
diff --git a/pango/pango-context.c b/pango/pango-context.c
index 27bb2e00..985b8ff0 100644
--- a/pango/pango-context.c
+++ b/pango/pango-context.c
@@ -27,7 +27,7 @@
 #include "pango-context-private.h"
 #include "pango-impl-utils.h"
 
-#include "pango-font-private.h"
+#include "pango-font-metrics-private.h"
 #include "pango-item-private.h"
 #include "pango-fontset.h"
 #include "pango-fontmap-private.h"
diff --git a/pango/pango-font-metrics-private.h b/pango/pango-font-metrics-private.h
new file mode 100644
index 00000000..6401a969
--- /dev/null
+++ b/pango/pango-font-metrics-private.h
@@ -0,0 +1,24 @@
+/*
+ * Copyright 2022 Red Hat, Inc.
+ *
+ * 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 <pango/pango-font-metrics.h>
+
+PangoFontMetrics *pango_font_metrics_new (void);
diff --git a/pango/pango-font-metrics.c b/pango/pango-font-metrics.c
new file mode 100644
index 00000000..bf8e28b3
--- /dev/null
+++ b/pango/pango-font-metrics.c
@@ -0,0 +1,274 @@
+/* Pango
+ * pango-font-metrics.c:
+ *
+ * Copyright (C) 1999 Red Hat Software
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#include "config.h"
+
+#include "pango-font-metrics-private.h"
+
+
+G_DEFINE_BOXED_TYPE (PangoFontMetrics, pango_font_metrics,
+                     pango_font_metrics_ref,
+                     pango_font_metrics_unref);
+
+/**
+ * pango_font_metrics_new:
+ *
+ * Creates a new `PangoFontMetrics` structure.
+ *
+ * This is only for internal use by Pango backends and there is
+ * no public way to set the fields of the structure.
+ *
+ * Return value: a newly-created `PangoFontMetrics` structure
+ *   with a reference count of 1.
+ */
+PangoFontMetrics *
+pango_font_metrics_new (void)
+{
+  PangoFontMetrics *metrics = g_slice_new0 (PangoFontMetrics);
+  metrics->ref_count = 1;
+
+  return metrics;
+}
+
+/**
+ * pango_font_metrics_ref:
+ * @metrics: (nullable): a `PangoFontMetrics` structure, may be %NULL
+ *
+ * Increase the reference count of a font metrics structure by one.
+ *
+ * Return value: (nullable): @metrics
+ */
+PangoFontMetrics *
+pango_font_metrics_ref (PangoFontMetrics *metrics)
+{
+  if (metrics == NULL)
+    return NULL;
+
+  g_atomic_int_inc ((int *) &metrics->ref_count);
+
+  return metrics;
+}
+
+/**
+ * pango_font_metrics_unref:
+ * @metrics: (nullable): a `PangoFontMetrics` structure, may be %NULL
+ *
+ * Decrease the reference count of a font metrics structure by one.
+ *
+ * If the result is zero, frees the structure and any associated memory.
+ */
+void
+pango_font_metrics_unref (PangoFontMetrics *metrics)
+{
+  if (metrics == NULL)
+    return;
+
+  g_return_if_fail (metrics->ref_count > 0 );
+
+  if (g_atomic_int_dec_and_test ((int *) &metrics->ref_count))
+    g_slice_free (PangoFontMetrics, metrics);
+}
+
+/**
+ * pango_font_metrics_get_ascent:
+ * @metrics: a `PangoFontMetrics` structure
+ *
+ * Gets the ascent from a font metrics structure.
+ *
+ * The ascent is the distance from the baseline to the logical top
+ * of a line of text. (The logical top may be above or below the top
+ * of the actual drawn ink. It is necessary to lay out the text to
+ * figure where the ink will be.)
+ *
+ * Return value: the ascent, in Pango units.
+ */
+int
+pango_font_metrics_get_ascent (PangoFontMetrics *metrics)
+{
+  g_return_val_if_fail (metrics != NULL, 0);
+
+  return metrics->ascent;
+}
+
+/**
+ * pango_font_metrics_get_descent:
+ * @metrics: a `PangoFontMetrics` structure
+ *
+ * Gets the descent from a font metrics structure.
+ *
+ * The descent is the distance from the baseline to the logical bottom
+ * of a line of text. (The logical bottom may be above or below the
+ * bottom of the actual drawn ink. It is necessary to lay out the text
+ * to figure where the ink will be.)
+ *
+ * Return value: the descent, in Pango units.
+ */
+int
+pango_font_metrics_get_descent (PangoFontMetrics *metrics)
+{
+  g_return_val_if_fail (metrics != NULL, 0);
+
+  return metrics->descent;
+}
+
+/**
+ * pango_font_metrics_get_height:
+ * @metrics: a `PangoFontMetrics` structure
+ *
+ * Gets the line height from a font metrics structure.
+ *
+ * The line height is the recommended distance between successive
+ * baselines in wrapped text using this font.
+ *
+ * If the line height is not available, 0 is returned.
+ *
+ * Return value: the height, in Pango units
+ *
+ * Since: 1.44
+ */
+int
+pango_font_metrics_get_height (PangoFontMetrics *metrics)
+{
+  g_return_val_if_fail (metrics != NULL, 0);
+
+  return metrics->height;
+}
+
+/**
+ * pango_font_metrics_get_approximate_char_width:
+ * @metrics: a `PangoFontMetrics` structure
+ *
+ * Gets the approximate character width for a font metrics structure.
+ *
+ * This is merely a representative value useful, for example, for
+ * determining the initial size for a window. Actual characters in
+ * text will be wider and narrower than this.
+ *
+ * Return value: the character width, in Pango units.
+ */
+int
+pango_font_metrics_get_approximate_char_width (PangoFontMetrics *metrics)
+{
+  g_return_val_if_fail (metrics != NULL, 0);
+
+  return metrics->approximate_char_width;
+}
+
+/**
+ * pango_font_metrics_get_approximate_digit_width:
+ * @metrics: a `PangoFontMetrics` structure
+ *
+ * Gets the approximate digit width for a font metrics structure.
+ *
+ * This is merely a representative value useful, for example, for
+ * determining the initial size for a window. Actual digits in
+ * text can be wider or narrower than this, though this value
+ * is generally somewhat more accurate than the result of
+ * pango_font_metrics_get_approximate_char_width() for digits.
+ *
+ * Return value: the digit width, in Pango units.
+ */
+int
+pango_font_metrics_get_approximate_digit_width (PangoFontMetrics *metrics)
+{
+  g_return_val_if_fail (metrics != NULL, 0);
+
+  return metrics->approximate_digit_width;
+}
+
+/**
+ * pango_font_metrics_get_underline_position:
+ * @metrics: a `PangoFontMetrics` structure
+ *
+ * Gets the suggested position to draw the underline.
+ *
+ * The value returned is the distance *above* the baseline of the top
+ * of the underline. Since most fonts have underline positions beneath
+ * the baseline, this value is typically negative.
+ *
+ * Return value: the suggested underline position, in Pango units.
+ *
+ * Since: 1.6
+ */
+int
+pango_font_metrics_get_underline_position (PangoFontMetrics *metrics)
+{
+  g_return_val_if_fail (metrics != NULL, 0);
+
+  return metrics->underline_position;
+}
+
+/**
+ * pango_font_metrics_get_underline_thickness:
+ * @metrics: a `PangoFontMetrics` structure
+ *
+ * Gets the suggested thickness to draw for the underline.
+ *
+ * Return value: the suggested underline thickness, in Pango units.
+ *
+ * Since: 1.6
+ */
+int
+pango_font_metrics_get_underline_thickness (PangoFontMetrics *metrics)
+{
+  g_return_val_if_fail (metrics != NULL, 0);
+
+  return metrics->underline_thickness;
+}
+
+/**
+ * pango_font_metrics_get_strikethrough_position:
+ * @metrics: a `PangoFontMetrics` structure
+ *
+ * Gets the suggested position to draw the strikethrough.
+ *
+ * The value returned is the distance *above* the
+ * baseline of the top of the strikethrough.
+ *
+ * Return value: the suggested strikethrough position, in Pango units.
+ *
+ * Since: 1.6
+ */
+int
+pango_font_metrics_get_strikethrough_position (PangoFontMetrics *metrics)
+{
+  g_return_val_if_fail (metrics != NULL, 0);
+
+  return metrics->strikethrough_position;
+}
+
+/**
+ * pango_font_metrics_get_strikethrough_thickness:
+ * @metrics: a `PangoFontMetrics` structure
+ *
+ * Gets the suggested thickness to draw for the strikethrough.
+ *
+ * Return value: the suggested strikethrough thickness, in Pango units.
+ *
+ * Since: 1.6
+ */
+int
+pango_font_metrics_get_strikethrough_thickness (PangoFontMetrics *metrics)
+{
+  g_return_val_if_fail (metrics != NULL, 0);
+
+  return metrics->strikethrough_thickness;
+}
diff --git a/pango/pango-font-metrics.h b/pango/pango-font-metrics.h
new file mode 100644
index 00000000..8f23e6f2
--- /dev/null
+++ b/pango/pango-font-metrics.h
@@ -0,0 +1,97 @@
+/* Pango
+ * pango-font-metrics.h: Font handling
+ *
+ * Copyright (C) 2000 Red Hat Software
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#pragma once
+
+#include <pango/pango-types.h>
+#include <pango/pango-font-description.h>
+
+#include <glib-object.h>
+#include <hb.h>
+
+G_BEGIN_DECLS
+
+/**
+ * PangoFontMetrics:
+ *
+ * A `PangoFontMetrics` structure holds the overall metric information
+ * for a font.
+ *
+ * The information in a `PangoFontMetrics` structure may be restricted
+ * to a script. The fields of this structure are private to implementations
+ * of a font backend. See the documentation of the corresponding getters
+ * for documentation of their meaning.
+ *
+ * For an overview of the most important metrics, see:
+ *
+ * <picture>
+ *   <source srcset="fontmetrics-dark.png" media="(prefers-color-scheme: dark)">
+ *   <img alt="Font metrics" src="fontmetrics-light.png">
+ * </picture>
+
+ */
+typedef struct _PangoFontMetrics PangoFontMetrics;
+
+#define PANGO_TYPE_FONT_METRICS  (pango_font_metrics_get_type ())
+
+struct _PangoFontMetrics
+{
+  /* <private> */
+  guint ref_count;
+
+  int ascent;
+  int descent;
+  int height;
+  int approximate_char_width;
+  int approximate_digit_width;
+  int underline_position;
+  int underline_thickness;
+  int strikethrough_position;
+  int strikethrough_thickness;
+};
+
+PANGO_AVAILABLE_IN_ALL
+GType             pango_font_metrics_get_type                    (void) G_GNUC_CONST;
+PANGO_AVAILABLE_IN_ALL
+PangoFontMetrics *pango_font_metrics_ref                         (PangoFontMetrics *metrics);
+PANGO_AVAILABLE_IN_ALL
+void              pango_font_metrics_unref                       (PangoFontMetrics *metrics);
+PANGO_AVAILABLE_IN_ALL
+int               pango_font_metrics_get_ascent                  (PangoFontMetrics *metrics) G_GNUC_PURE;
+PANGO_AVAILABLE_IN_ALL
+int               pango_font_metrics_get_descent                 (PangoFontMetrics *metrics) G_GNUC_PURE;
+PANGO_AVAILABLE_IN_1_44
+int               pango_font_metrics_get_height                  (PangoFontMetrics *metrics) G_GNUC_PURE;
+PANGO_AVAILABLE_IN_ALL
+int               pango_font_metrics_get_approximate_char_width  (PangoFontMetrics *metrics) G_GNUC_PURE;
+PANGO_AVAILABLE_IN_ALL
+int               pango_font_metrics_get_approximate_digit_width (PangoFontMetrics *metrics) G_GNUC_PURE;
+PANGO_AVAILABLE_IN_1_6
+int               pango_font_metrics_get_underline_position      (PangoFontMetrics *metrics) G_GNUC_PURE;
+PANGO_AVAILABLE_IN_1_6
+int               pango_font_metrics_get_underline_thickness     (PangoFontMetrics *metrics) G_GNUC_PURE;
+PANGO_AVAILABLE_IN_1_6
+int               pango_font_metrics_get_strikethrough_position  (PangoFontMetrics *metrics) G_GNUC_PURE;
+PANGO_AVAILABLE_IN_1_6
+int               pango_font_metrics_get_strikethrough_thickness (PangoFontMetrics *metrics) G_GNUC_PURE;
+
+
+G_END_DECLS
diff --git a/pango/pango-font-private.h b/pango/pango-font-private.h
index ce056be5..7f4f74b6 100644
--- a/pango/pango-font-private.h
+++ b/pango/pango-font-private.h
@@ -131,9 +131,6 @@ struct _PangoFontClass
 #define PANGO_FONT_GET_CLASS(obj)    (G_TYPE_INSTANCE_GET_CLASS ((obj), PANGO_TYPE_FONT, PangoFontClass))
 
 
-PANGO_AVAILABLE_IN_ALL
-PangoFontMetrics *pango_font_metrics_new (void);
-
 typedef struct {
   PangoLanguage ** (* get_languages) (PangoFont *font);
 
diff --git a/pango/pango-font.h b/pango/pango-font.h
index 3776b2d0..859005a1 100644
--- a/pango/pango-font.h
+++ b/pango/pango-font.h
@@ -25,81 +25,13 @@
 #include <pango/pango-coverage.h>
 #include <pango/pango-types.h>
 #include <pango/pango-font-description.h>
+#include <pango/pango-font-metrics.h>
 
 #include <glib-object.h>
 #include <hb.h>
 
 G_BEGIN_DECLS
 
-/**
- * PangoFontMetrics:
- *
- * A `PangoFontMetrics` structure holds the overall metric information
- * for a font.
- *
- * The information in a `PangoFontMetrics` structure may be restricted
- * to a script. The fields of this structure are private to implementations
- * of a font backend. See the documentation of the corresponding getters
- * for documentation of their meaning.
- *
- * For an overview of the most important metrics, see:
- *
- * <picture>
- *   <source srcset="fontmetrics-dark.png" media="(prefers-color-scheme: dark)">
- *   <img alt="Font metrics" src="fontmetrics-light.png">
- * </picture>
-
- */
-typedef struct _PangoFontMetrics PangoFontMetrics;
-
-/*
- * PangoFontMetrics
- */
-
-#define PANGO_TYPE_FONT_METRICS  (pango_font_metrics_get_type ())
-
-struct _PangoFontMetrics
-{
-  /* <private> */
-  guint ref_count;
-
-  int ascent;
-  int descent;
-  int height;
-  int approximate_char_width;
-  int approximate_digit_width;
-  int underline_position;
-  int underline_thickness;
-  int strikethrough_position;
-  int strikethrough_thickness;
-};
-
-PANGO_AVAILABLE_IN_ALL
-GType             pango_font_metrics_get_type                    (void) G_GNUC_CONST;
-PANGO_AVAILABLE_IN_ALL
-PangoFontMetrics *pango_font_metrics_ref                         (PangoFontMetrics *metrics);
-PANGO_AVAILABLE_IN_ALL
-void              pango_font_metrics_unref                       (PangoFontMetrics *metrics);
-PANGO_AVAILABLE_IN_ALL
-int               pango_font_metrics_get_ascent                  (PangoFontMetrics *metrics) G_GNUC_PURE;
-PANGO_AVAILABLE_IN_ALL
-int               pango_font_metrics_get_descent                 (PangoFontMetrics *metrics) G_GNUC_PURE;
-PANGO_AVAILABLE_IN_1_44
-int               pango_font_metrics_get_height                  (PangoFontMetrics *metrics) G_GNUC_PURE;
-PANGO_AVAILABLE_IN_ALL
-int               pango_font_metrics_get_approximate_char_width  (PangoFontMetrics *metrics) G_GNUC_PURE;
-PANGO_AVAILABLE_IN_ALL
-int               pango_font_metrics_get_approximate_digit_width (PangoFontMetrics *metrics) G_GNUC_PURE;
-PANGO_AVAILABLE_IN_1_6
-int               pango_font_metrics_get_underline_position      (PangoFontMetrics *metrics) G_GNUC_PURE;
-PANGO_AVAILABLE_IN_1_6
-int               pango_font_metrics_get_underline_thickness     (PangoFontMetrics *metrics) G_GNUC_PURE;
-PANGO_AVAILABLE_IN_1_6
-int               pango_font_metrics_get_strikethrough_position  (PangoFontMetrics *metrics) G_GNUC_PURE;
-PANGO_AVAILABLE_IN_1_6
-int               pango_font_metrics_get_strikethrough_thickness (PangoFontMetrics *metrics) G_GNUC_PURE;
-
-
 /*
  * PangoFontFamily
  */
diff --git a/pango/pango-fontset.c b/pango/pango-fontset.c
index fc9e05b8..7281d149 100644
--- a/pango/pango-fontset.c
+++ b/pango/pango-fontset.c
@@ -26,7 +26,7 @@
  */
 
 #include "pango-types.h"
-#include "pango-font-private.h"
+#include "pango-font-metrics-private.h"
 #include "pango-fontset.h"
 #include "pango-impl-utils.h"
 
diff --git a/pango/pango.h b/pango/pango.h
index 8f16bbc1..3bb3ebff 100644
--- a/pango/pango.h
+++ b/pango/pango.h
@@ -32,6 +32,7 @@
 #include <pango/pango-features.h>
 #include <pango/pango-font.h>
 #include <pango/pango-font-description.h>
+#include <pango/pango-font-metrics.h>
 #include <pango/pango-fontmap.h>
 #include <pango/pango-fontset.h>
 #include <pango/pango-fontset-simple.h>
diff --git a/pango/pangocairo-font.c b/pango/pangocairo-font.c
index 598065c0..519a69aa 100644
--- a/pango/pangocairo-font.c
+++ b/pango/pangocairo-font.c
@@ -27,6 +27,7 @@
 #include "pangocairo.h"
 #include "pangocairo-private.h"
 #include "pango-font-private.h"
+#include "pango-font-metrics-private.h"
 #include "pango-impl-utils.h"
 
 #define PANGO_CAIRO_FONT_PRIVATE(font)         \
diff --git a/pango/pangofc-font.c b/pango/pangofc-font.c
index 9f54cd7a..9dc5e98d 100644
--- a/pango/pangofc-font.c
+++ b/pango/pangofc-font.c
@@ -22,6 +22,7 @@
 #include "config.h"
 
 #include "pango-font-private.h"
+#include "pango-font-metrics-private.h"
 #include "pangofc-font-private.h"
 #include "pangofc-fontmap.h"
 #include "pangofc-private.h"


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