diff options
author | Matthias Clasen <mclasen@redhat.com> | 2022-07-09 16:37:24 -0400 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2022-07-09 16:37:24 -0400 |
commit | 07526cfa7a0508e2f3c27e713185520985fabe70 (patch) | |
tree | 33a4978b8fa56746508534414262ee7566b208b2 | |
parent | 0be2ba62ee19363bbd3a6c22df3d65b806351a9a (diff) | |
download | pango-07526cfa7a0508e2f3c27e713185520985fabe70.tar.gz |
fontmap: Fixes for fallback
We were mishandling getting items from the fallback,
and we were not sending all required change notification
when setting fallback.
-rw-r--r-- | pango2/pango-fontmap.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/pango2/pango-fontmap.c b/pango2/pango-fontmap.c index 5ae9b69b..fe45713d 100644 --- a/pango2/pango-fontmap.c +++ b/pango2/pango-fontmap.c @@ -126,7 +126,7 @@ pango2_font_map_get_item (GListModel *list, if (position < self->families->len) return g_object_ref (g_ptr_array_index (self->families, position)); else if (self->fallback) - return g_list_model_get_item (G_LIST_MODEL (self->fallback), position); + return g_list_model_get_item (G_LIST_MODEL (self->fallback), position - self->families->len); return NULL; } @@ -1138,14 +1138,23 @@ void pango2_font_map_set_fallback (Pango2FontMap *self, Pango2FontMap *fallback) { + guint removed, added; + g_return_if_fail (PANGO2_IS_FONT_MAP (self)); g_return_if_fail (fallback == NULL || PANGO2_IS_FONT_MAP (fallback)); + removed = g_list_model_get_n_items (G_LIST_MODEL (self)); + if (!g_set_object (&self->fallback, fallback)) return; + added = g_list_model_get_n_items (G_LIST_MODEL (self)); + clear_caches (self); + + g_list_model_items_changed (G_LIST_MODEL (self), 0, removed, added); g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_FALLBACK]); + g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_N_ITEMS]); } /** |