[pango/pango2: 150/168] Add a way to merge fontsets
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pango/pango2: 150/168] Add a way to merge fontsets
- Date: Mon, 20 Jun 2022 16:28:45 +0000 (UTC)
commit cebb3b52f9ac305e0aba554529961a429e0d54ae
Author: Matthias Clasen <mclasen redhat com>
Date: Sat Jun 18 13:09:27 2022 -0700
Add a way to merge fontsets
This will be used in future commits.
pango/pango-fontset-cached-private.h | 16 ++++++----------
pango/pango-fontset-cached.c | 15 +++++++++++++++
2 files changed, 21 insertions(+), 10 deletions(-)
---
diff --git a/pango/pango-fontset-cached-private.h b/pango/pango-fontset-cached-private.h
index 4b7a37f7..2f3c7ac3 100644
--- a/pango/pango-fontset-cached-private.h
+++ b/pango/pango-fontset-cached-private.h
@@ -28,8 +28,9 @@
#include <cairo.h>
#endif
-typedef struct _PangoFontsetCached PangoFontsetCached;
-typedef struct _PangoFontsetCachedClass PangoFontsetCachedClass;
+#define PANGO_TYPE_FONTSET_CACHED (pango_fontset_cached_get_type ())
+
+G_DECLARE_FINAL_TYPE (PangoFontsetCached, pango_fontset_cached, PANGO, FONTSET_CACHED, PangoFontset)
struct _PangoFontsetCached
{
@@ -48,14 +49,6 @@ struct _PangoFontsetCached
#endif
};
-struct _PangoFontsetCachedClass
-{
- PangoFontsetClass parent_class;
-};
-
-
-GType pango_fontset_cached_get_type (void) G_GNUC_CONST;
-
PangoFontsetCached * pango_fontset_cached_new (const PangoFontDescription *description,
PangoLanguage *language,
float dpi,
@@ -67,3 +60,6 @@ void pango_fontset_cached_add_family (PangoFontsetCached
PangoGenericFamily *family);
int pango_fontset_cached_size (PangoFontsetCached *self);
PangoFont * pango_fontset_cached_get_first_font (PangoFontsetCached *self);
+
+void pango_fontset_cached_append (PangoFontsetCached *self,
+ PangoFontsetCached *other);
diff --git a/pango/pango-fontset-cached.c b/pango/pango-fontset-cached.c
index bdcb04de..adbc4409 100644
--- a/pango/pango-fontset-cached.c
+++ b/pango/pango-fontset-cached.c
@@ -325,4 +325,19 @@ pango_fontset_cached_size (PangoFontsetCached *self)
return self->items->len;
}
+void
+pango_fontset_cached_append (PangoFontsetCached *self,
+ PangoFontsetCached *other)
+{
+ for (int i = 0; i < other->items->len; i++)
+ {
+ gpointer item = g_ptr_array_index (other->items, i);
+
+ if (PANGO_IS_FONT (item))
+ pango_fontset_cached_add_face (self, pango_font_get_face (PANGO_FONT (item)));
+ else if (PANGO_IS_GENERIC_FAMILY (item))
+ pango_fontset_cached_add_family (self, PANGO_GENERIC_FAMILY (item));
+ }
+}
+
/* vim:set foldmethod=marker expandtab: */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]