diff options
author | Matthias Clasen <mclasen@redhat.com> | 2022-06-18 13:09:27 -0700 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2022-06-22 13:57:26 -0400 |
commit | 7edbcc0c3cf63debf1f434d1465e8fe0936bdca0 (patch) | |
tree | 990529382f0239ad27ab1bc76e672550abec92b3 | |
parent | 6d61bd91af1d0988f5392d2525b7ce76d1b0f77d (diff) | |
download | pango-7edbcc0c3cf63debf1f434d1465e8fe0936bdca0.tar.gz |
Add a way to merge fontsets
This will be used in future commits.
-rw-r--r-- | pango/pango-fontset-cached-private.h | 16 | ||||
-rw-r--r-- | 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: */ |