[pango/fontset-cosmetics: 1/2] Split off PangoFontsetSimple
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pango/fontset-cosmetics: 1/2] Split off PangoFontsetSimple
- Date: Fri, 24 Dec 2021 05:00:55 +0000 (UTC)
commit 00897993dfc2166b8dc4ef26666cc6d8ed4ef3b5
Author: Matthias Clasen <mclasen redhat com>
Date: Thu Dec 23 23:42:43 2021 -0500
Split off PangoFontsetSimple
Put PangoFontsetSimple into its own files.
pango/meson.build | 1 +
pango/pango-fontset-simple.c | 236 ++++++++++++++++++++++++++++++++++++
pango/pango-fontset-simple.h | 64 ++++++++++
pango/pango-fontset.c | 282 ++++++-------------------------------------
pango/pango-fontset.h | 61 +++-------
pango/pango.h | 1 +
6 files changed, 354 insertions(+), 291 deletions(-)
---
diff --git a/pango/meson.build b/pango/meson.build
index 4e6f746e..2273f413 100644
--- a/pango/meson.build
+++ b/pango/meson.build
@@ -14,6 +14,7 @@ pango_sources = [
'pango-engine.c',
'pango-fontmap.c',
'pango-fontset.c',
+ 'pango-fontset-simple.c',
'pango-glyph-item.c',
'pango-gravity.c',
'pango-item.c',
diff --git a/pango/pango-fontset-simple.c b/pango/pango-fontset-simple.c
new file mode 100644
index 00000000..193d448e
--- /dev/null
+++ b/pango/pango-fontset-simple.c
@@ -0,0 +1,236 @@
+/* Pango
+ * pango-fontset-simple.c:
+ *
+ * Copyright (C) 2001 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"
+
+/*
+ * PangoFontset
+ */
+
+#include "pango-types.h"
+#include "pango-font-private.h"
+#include "pango-fontset-simple.h"
+#include "pango-impl-utils.h"
+
+/* {{{ PangoFontset implementation */
+
+#define PANGO_FONTSET_SIMPLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PANGO_TYPE_FONTSET_SIMPLE,
PangoFontsetSimpleClass))
+#define PANGO_IS_FONTSET_SIMPLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PANGO_TYPE_FONTSET_SIMPLE))
+#define PANGO_FONTSET_SIMPLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PANGO_TYPE_FONTSET_SIMPLE,
PangoFontsetSimpleClass))
+
+
+struct _PangoFontsetSimple
+{
+ PangoFontset parent_instance;
+
+ GPtrArray *fonts;
+ GPtrArray *coverages;
+ PangoLanguage *language;
+};
+
+struct _PangoFontsetSimpleClass
+{
+ PangoFontsetClass parent_class;
+};
+
+G_DEFINE_TYPE (PangoFontsetSimple, pango_fontset_simple, PANGO_TYPE_FONTSET);
+
+static void
+pango_fontset_simple_init (PangoFontsetSimple *fontset)
+{
+ fontset->fonts = g_ptr_array_new ();
+ fontset->coverages = g_ptr_array_new ();
+ fontset->language = NULL;
+}
+
+static void
+pango_fontset_simple_finalize (GObject *object)
+{
+ PangoFontsetSimple *fontset = PANGO_FONTSET_SIMPLE (object);
+ PangoCoverage *coverage;
+ unsigned int i;
+
+ for (i = 0; i < fontset->fonts->len; i++)
+ g_object_unref (g_ptr_array_index(fontset->fonts, i));
+
+ g_ptr_array_free (fontset->fonts, TRUE);
+
+ for (i = 0; i < fontset->coverages->len; i++)
+ {
+ coverage = g_ptr_array_index (fontset->coverages, i);
+ if (coverage)
+ pango_coverage_unref (coverage);
+ }
+
+ g_ptr_array_free (fontset->coverages, TRUE);
+
+ G_OBJECT_CLASS (pango_fontset_simple_parent_class)->finalize (object);
+}
+
+static PangoFont *
+pango_fontset_simple_get_font (PangoFontset *fontset,
+ guint wc)
+{
+ PangoFontsetSimple *simple = PANGO_FONTSET_SIMPLE (fontset);
+ PangoCoverageLevel best_level = PANGO_COVERAGE_NONE;
+ PangoCoverageLevel level;
+ PangoFont *font;
+ PangoCoverage *coverage;
+ int result = -1;
+ unsigned int i;
+
+ for (i = 0; i < simple->fonts->len; i++)
+ {
+ coverage = g_ptr_array_index (simple->coverages, i);
+
+ if (coverage == NULL)
+ {
+ font = g_ptr_array_index (simple->fonts, i);
+
+ coverage = pango_font_get_coverage (font, simple->language);
+ g_ptr_array_index (simple->coverages, i) = coverage;
+ }
+
+ level = pango_coverage_get (coverage, wc);
+
+ if (result == -1 || level > best_level)
+ {
+ result = i;
+ best_level = level;
+ if (level == PANGO_COVERAGE_EXACT)
+ break;
+ }
+ }
+
+ if (G_UNLIKELY (result == -1))
+ return NULL;
+
+ font = g_ptr_array_index(simple->fonts, result);
+ return g_object_ref (font);
+}
+
+static PangoFontMetrics *
+pango_fontset_simple_get_metrics (PangoFontset *fontset)
+{
+ PangoFontsetSimple *simple = PANGO_FONTSET_SIMPLE (fontset);
+
+ if (simple->fonts->len == 1)
+ return pango_font_get_metrics (PANGO_FONT (g_ptr_array_index(simple->fonts, 0)),
+ simple->language);
+
+ return PANGO_FONTSET_CLASS (pango_fontset_simple_parent_class)->get_metrics (fontset);
+}
+
+static PangoLanguage *
+pango_fontset_simple_get_language (PangoFontset *fontset)
+{
+ PangoFontsetSimple *simple = PANGO_FONTSET_SIMPLE (fontset);
+
+ return simple->language;
+}
+
+static void
+pango_fontset_simple_foreach (PangoFontset *fontset,
+ PangoFontsetForeachFunc func,
+ gpointer data)
+{
+ PangoFontsetSimple *simple = PANGO_FONTSET_SIMPLE (fontset);
+ unsigned int i;
+
+ for (i = 0; i < simple->fonts->len; i++)
+ {
+ if ((*func) (fontset,
+ g_ptr_array_index (simple->fonts, i),
+ data))
+ return;
+ }
+}
+
+static void
+pango_fontset_simple_class_init (PangoFontsetSimpleClass *class)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (class);
+ PangoFontsetClass *fontset_class = PANGO_FONTSET_CLASS (class);
+
+ object_class->finalize = pango_fontset_simple_finalize;
+
+ fontset_class->get_font = pango_fontset_simple_get_font;
+ fontset_class->get_metrics = pango_fontset_simple_get_metrics;
+ fontset_class->get_language = pango_fontset_simple_get_language;
+ fontset_class->foreach = pango_fontset_simple_foreach;
+}
+
+/* }}} */
+/* {{{ Public API */
+
+/**
+ * pango_fontset_simple_new:
+ * @language: a `PangoLanguage` tag
+ *
+ * Creates a new `PangoFontsetSimple` for the given language.
+ *
+ * Return value: the newly allocated `PangoFontsetSimple`
+ */
+PangoFontsetSimple *
+pango_fontset_simple_new (PangoLanguage *language)
+{
+ PangoFontsetSimple *fontset;
+
+ fontset = g_object_new (PANGO_TYPE_FONTSET_SIMPLE, NULL);
+ fontset->language = language;
+
+ return fontset;
+}
+
+/**
+ * pango_fontset_simple_append:
+ * @fontset: a `PangoFontsetSimple`.
+ * @font: (transfer full): a `PangoFont`.
+ *
+ * Adds a font to the fontset.
+ *
+ * The fontset takes ownership of @font.
+ */
+void
+pango_fontset_simple_append (PangoFontsetSimple *fontset,
+ PangoFont *font)
+{
+ g_ptr_array_add (fontset->fonts, font);
+ g_ptr_array_add (fontset->coverages, NULL);
+}
+
+/**
+ * pango_fontset_simple_size:
+ * @fontset: a `PangoFontsetSimple`.
+ *
+ * Returns the number of fonts in the fontset.
+ *
+ * Return value: the size of @fontset
+ */
+int
+pango_fontset_simple_size (PangoFontsetSimple *fontset)
+{
+ return fontset->fonts->len;
+}
+
+/* }}} */
+
+/* vim:set foldmethod=marker expandtab: */
diff --git a/pango/pango-fontset-simple.h b/pango/pango-fontset-simple.h
new file mode 100644
index 00000000..adbbf0a8
--- /dev/null
+++ b/pango/pango-fontset-simple.h
@@ -0,0 +1,64 @@
+/* Pango
+ * pango-fontset-simple.h: Font set handling
+ *
+ * Copyright (C) 2001 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.
+ */
+
+#ifndef __PANGO_FONTSET_SIMPLE_H__
+#define __PANGO_FONTSET_SIMPLE_H__
+
+#include <pango/pango-coverage.h>
+#include <pango/pango-types.h>
+#include <pango/pango-fontset.h>
+
+#include <glib-object.h>
+
+G_BEGIN_DECLS
+
+/**
+ * PangoFontsetSimple:
+ *
+ * `PangoFontsetSimple` is a implementation of the abstract
+ * `PangoFontset` base class as an array of fonts.
+ *
+ * When creating a `PangoFontsetSimple`, you have to provide
+ * the array of fonts that make up the fontset.
+ */
+#define PANGO_TYPE_FONTSET_SIMPLE (pango_fontset_simple_get_type ())
+#define PANGO_FONTSET_SIMPLE(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), PANGO_TYPE_FONTSET_SIMPLE,
PangoFontsetSimple))
+#define PANGO_IS_FONTSET_SIMPLE(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), PANGO_TYPE_FONTSET_SIMPLE))
+
+typedef struct _PangoFontsetSimple PangoFontsetSimple;
+typedef struct _PangoFontsetSimpleClass PangoFontsetSimpleClass;
+
+
+PANGO_AVAILABLE_IN_ALL
+GType pango_fontset_simple_get_type (void) G_GNUC_CONST;
+
+PANGO_AVAILABLE_IN_ALL
+PangoFontsetSimple * pango_fontset_simple_new (PangoLanguage *language);
+PANGO_AVAILABLE_IN_ALL
+void pango_fontset_simple_append (PangoFontsetSimple *fontset,
+ PangoFont *font);
+PANGO_AVAILABLE_IN_ALL
+int pango_fontset_simple_size (PangoFontsetSimple *fontset);
+
+
+G_END_DECLS
+
+#endif /* __PANGO_FONTSET_SIMPLE_H__ */
diff --git a/pango/pango-fontset.c b/pango/pango-fontset.c
index b8c15152..43dccd3a 100644
--- a/pango/pango-fontset.c
+++ b/pango/pango-fontset.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
@@ -30,7 +30,7 @@
#include "pango-fontset-private.h"
#include "pango-impl-utils.h"
-static PangoFontMetrics *pango_fontset_real_get_metrics (PangoFontset *fontset);
+static PangoFontMetrics *pango_fontset_real_get_metrics (PangoFontset *fontset);
G_DEFINE_ABSTRACT_TYPE (PangoFontset, pango_fontset, G_TYPE_OBJECT);
@@ -52,14 +52,14 @@ pango_fontset_class_init (PangoFontsetClass *class)
* @fontset: a `PangoFontset`
* @wc: a Unicode character
*
- * Returns the font in the fontset that contains the best glyph for a
- * Unicode character.
+ * Returns the font in the fontset that contains the best
+ * glyph for a Unicode character.
*
* Return value: (transfer full): a `PangoFont`
*/
PangoFont *
pango_fontset_get_font (PangoFontset *fontset,
- guint wc)
+ guint wc)
{
g_return_val_if_fail (PANGO_IS_FONTSET (fontset), NULL);
@@ -98,8 +98,8 @@ pango_fontset_get_metrics (PangoFontset *fontset)
*/
void
pango_fontset_foreach (PangoFontset *fontset,
- PangoFontsetForeachFunc func,
- gpointer data)
+ PangoFontsetForeachFunc func,
+ gpointer data)
{
g_return_if_fail (PANGO_IS_FONTSET (fontset));
g_return_if_fail (func != NULL);
@@ -109,8 +109,8 @@ pango_fontset_foreach (PangoFontset *fontset,
static gboolean
get_first_metrics_foreach (PangoFontset *fontset,
- PangoFont *font,
- gpointer data)
+ PangoFont *font,
+ gpointer data)
{
PangoFontMetrics *fontset_metrics = data;
PangoLanguage *language = PANGO_FONTSET_GET_CLASS (fontset)->get_language (fontset);
@@ -127,7 +127,7 @@ get_first_metrics_foreach (PangoFontset *fontset,
pango_font_metrics_unref (font_metrics);
- return TRUE; /* Stops iteration */
+ return TRUE; /* Stops iteration */
}
static PangoFontMetrics *
@@ -157,32 +157,32 @@ pango_fontset_real_get_metrics (PangoFontset *fontset)
gunichar wc = g_utf8_get_char (p);
font = pango_fontset_get_font (fontset, wc);
if (font)
- {
- if (g_hash_table_lookup (fonts_seen, font) == NULL)
- {
- raw_metrics = pango_font_get_metrics (font, language);
- g_hash_table_insert (fonts_seen, font, font);
-
- if (count == 0)
- {
- metrics->ascent = raw_metrics->ascent;
- metrics->descent = raw_metrics->descent;
- metrics->approximate_char_width = raw_metrics->approximate_char_width;
- metrics->approximate_digit_width = raw_metrics->approximate_digit_width;
- }
- else
- {
- metrics->ascent = MAX (metrics->ascent, raw_metrics->ascent);
- metrics->descent = MAX (metrics->descent, raw_metrics->descent);
- metrics->approximate_char_width += raw_metrics->approximate_char_width;
- metrics->approximate_digit_width += raw_metrics->approximate_digit_width;
- }
- count++;
- pango_font_metrics_unref (raw_metrics);
- }
- else
- g_object_unref (font);
- }
+ {
+ if (g_hash_table_lookup (fonts_seen, font) == NULL)
+ {
+ raw_metrics = pango_font_get_metrics (font, language);
+ g_hash_table_insert (fonts_seen, font, font);
+
+ if (count == 0)
+ {
+ metrics->ascent = raw_metrics->ascent;
+ metrics->descent = raw_metrics->descent;
+ metrics->approximate_char_width = raw_metrics->approximate_char_width;
+ metrics->approximate_digit_width = raw_metrics->approximate_digit_width;
+ }
+ else
+ {
+ metrics->ascent = MAX (metrics->ascent, raw_metrics->ascent);
+ metrics->descent = MAX (metrics->descent, raw_metrics->descent);
+ metrics->approximate_char_width += raw_metrics->approximate_char_width;
+ metrics->approximate_digit_width += raw_metrics->approximate_digit_width;
+ }
+ count++;
+ pango_font_metrics_unref (raw_metrics);
+ }
+ else
+ g_object_unref (font);
+ }
p = g_utf8_next_char (p);
}
@@ -197,213 +197,3 @@ pango_fontset_real_get_metrics (PangoFontset *fontset)
return metrics;
}
-
-
-/*
- * PangoFontsetSimple
- */
-
-#define PANGO_FONTSET_SIMPLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PANGO_TYPE_FONTSET_SIMPLE,
PangoFontsetSimpleClass))
-#define PANGO_IS_FONTSET_SIMPLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PANGO_TYPE_FONTSET_SIMPLE))
-#define PANGO_FONTSET_SIMPLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PANGO_TYPE_FONTSET_SIMPLE,
PangoFontsetSimpleClass))
-
-static void pango_fontset_simple_finalize (GObject *object);
-static PangoFontMetrics *pango_fontset_simple_get_metrics (PangoFontset *fontset);
-static PangoLanguage * pango_fontset_simple_get_language (PangoFontset *fontset);
-static PangoFont * pango_fontset_simple_get_font (PangoFontset *fontset,
- guint wc);
-static void pango_fontset_simple_foreach (PangoFontset *fontset,
- PangoFontsetForeachFunc func,
- gpointer data);
-
-struct _PangoFontsetSimple
-{
- PangoFontset parent_instance;
-
- GPtrArray *fonts;
- GPtrArray *coverages;
- PangoLanguage *language;
-};
-
-struct _PangoFontsetSimpleClass
-{
- PangoFontsetClass parent_class;
-};
-
-/**
- * pango_fontset_simple_new:
- * @language: a `PangoLanguage` tag
- *
- * Creates a new `PangoFontsetSimple` for the given language.
- *
- * Return value: the newly allocated `PangoFontsetSimple`
- */
-PangoFontsetSimple *
-pango_fontset_simple_new (PangoLanguage *language)
-{
- PangoFontsetSimple *fontset;
-
- fontset = g_object_new (PANGO_TYPE_FONTSET_SIMPLE, NULL);
- fontset->language = language;
-
- return fontset;
-}
-
-
-G_DEFINE_TYPE (PangoFontsetSimple, pango_fontset_simple, PANGO_TYPE_FONTSET);
-
-static void
-pango_fontset_simple_class_init (PangoFontsetSimpleClass *class)
-{
- GObjectClass *object_class = G_OBJECT_CLASS (class);
- PangoFontsetClass *fontset_class = PANGO_FONTSET_CLASS (class);
-
- object_class->finalize = pango_fontset_simple_finalize;
-
- fontset_class->get_font = pango_fontset_simple_get_font;
- fontset_class->get_metrics = pango_fontset_simple_get_metrics;
- fontset_class->get_language = pango_fontset_simple_get_language;
- fontset_class->foreach = pango_fontset_simple_foreach;
-}
-
-static void
-pango_fontset_simple_init (PangoFontsetSimple *fontset)
-{
- fontset->fonts = g_ptr_array_new ();
- fontset->coverages = g_ptr_array_new ();
- fontset->language = NULL;
-}
-
-static void
-pango_fontset_simple_finalize (GObject *object)
-{
- PangoFontsetSimple *fontset = PANGO_FONTSET_SIMPLE (object);
- PangoCoverage *coverage;
- unsigned int i;
-
- for (i = 0; i < fontset->fonts->len; i++)
- g_object_unref (g_ptr_array_index(fontset->fonts, i));
-
- g_ptr_array_free (fontset->fonts, TRUE);
-
- for (i = 0; i < fontset->coverages->len; i++)
- {
- coverage = g_ptr_array_index (fontset->coverages, i);
- if (coverage)
- pango_coverage_unref (coverage);
- }
-
- g_ptr_array_free (fontset->coverages, TRUE);
-
- G_OBJECT_CLASS (pango_fontset_simple_parent_class)->finalize (object);
-}
-
-/**
- * pango_fontset_simple_append:
- * @fontset: a `PangoFontsetSimple`.
- * @font: (transfer full): a `PangoFont`.
- *
- * Adds a font to the fontset.
- *
- * The fontset takes ownership of @font.
- */
-void
-pango_fontset_simple_append (PangoFontsetSimple *fontset,
- PangoFont *font)
-{
- g_ptr_array_add (fontset->fonts, font);
- g_ptr_array_add (fontset->coverages, NULL);
-}
-
-/**
- * pango_fontset_simple_size:
- * @fontset: a `PangoFontsetSimple`.
- *
- * Returns the number of fonts in the fontset.
- *
- * Return value: the size of @fontset
- */
-int
-pango_fontset_simple_size (PangoFontsetSimple *fontset)
-{
- return fontset->fonts->len;
-}
-
-static PangoLanguage *
-pango_fontset_simple_get_language (PangoFontset *fontset)
-{
- PangoFontsetSimple *simple = PANGO_FONTSET_SIMPLE (fontset);
-
- return simple->language;
-}
-
-static PangoFontMetrics *
-pango_fontset_simple_get_metrics (PangoFontset *fontset)
-{
- PangoFontsetSimple *simple = PANGO_FONTSET_SIMPLE (fontset);
-
- if (simple->fonts->len == 1)
- return pango_font_get_metrics (PANGO_FONT (g_ptr_array_index(simple->fonts, 0)),
- simple->language);
-
- return PANGO_FONTSET_CLASS (pango_fontset_simple_parent_class)->get_metrics (fontset);
-}
-
-static PangoFont *
-pango_fontset_simple_get_font (PangoFontset *fontset,
- guint wc)
-{
- PangoFontsetSimple *simple = PANGO_FONTSET_SIMPLE (fontset);
- PangoCoverageLevel best_level = PANGO_COVERAGE_NONE;
- PangoCoverageLevel level;
- PangoFont *font;
- PangoCoverage *coverage;
- int result = -1;
- unsigned int i;
-
- for (i = 0; i < simple->fonts->len; i++)
- {
- coverage = g_ptr_array_index (simple->coverages, i);
-
- if (coverage == NULL)
- {
- font = g_ptr_array_index (simple->fonts, i);
-
- coverage = pango_font_get_coverage (font, simple->language);
- g_ptr_array_index (simple->coverages, i) = coverage;
- }
-
- level = pango_coverage_get (coverage, wc);
-
- if (result == -1 || level > best_level)
- {
- result = i;
- best_level = level;
- if (level == PANGO_COVERAGE_EXACT)
- break;
- }
- }
-
- if (G_UNLIKELY (result == -1))
- return NULL;
-
- font = g_ptr_array_index(simple->fonts, result);
- return g_object_ref (font);
-}
-
-static void
-pango_fontset_simple_foreach (PangoFontset *fontset,
- PangoFontsetForeachFunc func,
- gpointer data)
-{
- PangoFontsetSimple *simple = PANGO_FONTSET_SIMPLE (fontset);
- unsigned int i;
-
- for (i = 0; i < simple->fonts->len; i++)
- {
- if ((*func) (fontset,
- g_ptr_array_index (simple->fonts, i),
- data))
- return;
- }
-}
diff --git a/pango/pango-fontset.h b/pango/pango-fontset.h
index 33ca87eb..0a222153 100644
--- a/pango/pango-fontset.h
+++ b/pango/pango-fontset.h
@@ -53,23 +53,24 @@ typedef struct _PangoFontsetClass PangoFontsetClass;
* @font: a font from @fontset
* @user_data: callback data
*
- * Callback used by pango_fontset_foreach() when enumerating
- * fonts in a fontset.
+ * Callback used when enumerating fonts in a fontset.
+ *
+ * See [method@Pango.Fontset.foreach].
*
* Returns: if %TRUE, stop iteration and return immediately.
*
* Since: 1.4
- **/
+ */
typedef gboolean (*PangoFontsetForeachFunc) (PangoFontset *fontset,
- PangoFont *font,
- gpointer user_data);
+ PangoFont *font,
+ gpointer user_data);
/**
* PangoFontset:
*
* A `PangoFontset` represents a set of `PangoFont` to use when rendering text.
*
- * A `PAngoFontset` is the result of resolving a `PangoFontDescription`
+ * A `PangoFontset` is the result of resolving a `PangoFontDescription`
* against a particular `PangoContext`. It has operations for finding the
* component font for a particular Unicode character, and for finding a
* composite set of metrics for the entire fontset.
@@ -83,12 +84,12 @@ struct _PangoFontset
* PangoFontsetClass:
* @parent_class: parent `GObjectClass`
* @get_font: a function to get the font in the fontset that contains the
- * best glyph for the given Unicode character; see pango_fontset_get_font().
+ * best glyph for the given Unicode character; see [method@Pango.Fontset.get_font]
* @get_metrics: a function to get overall metric information for the fonts
- * in the fontset; see pango_fontset_get_metrics().
+ * in the fontset; see [method@Pango.Fontset.get_metrics]
* @get_language: a function to get the language of the fontset.
* @foreach: a function to loop over the fonts in the fontset. See
- * pango_fontset_foreach().
+ * [method@Pango.Fontset.foreach]
*
* The `PangoFontsetClass` structure holds the virtual functions for
* a particular `PangoFontset` implementation.
@@ -117,45 +118,15 @@ struct _PangoFontsetClass
void (*_pango_reserved4) (void);
};
-/**
- * PangoFontsetSimple:
- *
- * `PangoFontsetSimple` is a implementation of the abstract
- * `PangoFontset` base class as an array of fonts.
- *
- * When creating a `PangoFontsetSimple`, you have to provide
- * the array of fonts that make up the fontset.
- */
-#define PANGO_TYPE_FONTSET_SIMPLE (pango_fontset_simple_get_type ())
-#define PANGO_FONTSET_SIMPLE(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), PANGO_TYPE_FONTSET_SIMPLE,
PangoFontsetSimple))
-#define PANGO_IS_FONTSET_SIMPLE(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), PANGO_TYPE_FONTSET_SIMPLE))
-
-typedef struct _PangoFontsetSimple PangoFontsetSimple;
-typedef struct _PangoFontsetSimpleClass PangoFontsetSimpleClass;
-
-
PANGO_AVAILABLE_IN_ALL
-GType pango_fontset_simple_get_type (void) G_GNUC_CONST;
-
-PANGO_AVAILABLE_IN_ALL
-PangoFontsetSimple * pango_fontset_simple_new (PangoLanguage *language);
-PANGO_AVAILABLE_IN_ALL
-void pango_fontset_simple_append (PangoFontsetSimple *fontset,
- PangoFont *font);
-PANGO_AVAILABLE_IN_ALL
-int pango_fontset_simple_size (PangoFontsetSimple *fontset);
-
-
+PangoFont * pango_fontset_get_font (PangoFontset *fontset,
+ guint wc);
PANGO_AVAILABLE_IN_ALL
-PangoFont * pango_fontset_get_font (PangoFontset *fontset,
- guint wc);
-PANGO_AVAILABLE_IN_ALL
-PangoFontMetrics *pango_fontset_get_metrics (PangoFontset *fontset);
+PangoFontMetrics * pango_fontset_get_metrics (PangoFontset *fontset);
PANGO_AVAILABLE_IN_1_4
-void pango_fontset_foreach (PangoFontset *fontset,
- PangoFontsetForeachFunc func,
- gpointer data);
-
+void pango_fontset_foreach (PangoFontset *fontset,
+ PangoFontsetForeachFunc func,
+ gpointer data);
G_END_DECLS
diff --git a/pango/pango.h b/pango/pango.h
index 8dc86b13..eca66265 100644
--- a/pango/pango.h
+++ b/pango/pango.h
@@ -35,6 +35,7 @@
#include <pango/pango-font.h>
#include <pango/pango-fontmap.h>
#include <pango/pango-fontset.h>
+#include <pango/pango-fontset-simple.h>
#include <pango/pango-glyph.h>
#include <pango/pango-glyph-item.h>
#include <pango/pango-gravity.h>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]