From bf5e21b8fd1165ad0969897d49ee6b8dd6fbd30f Mon Sep 17 00:00:00 2001 From: Geoff Lankow Date: Thu, 31 May 2018 12:42:20 +1200 Subject: In font list, don't change selection if current font is already selected; other minor fixes --- src/libnrtype/font-lister.cpp | 10 ++++++++++ src/libnrtype/font-lister.h | 2 ++ 2 files changed, 12 insertions(+) (limited to 'src/libnrtype') diff --git a/src/libnrtype/font-lister.cpp b/src/libnrtype/font-lister.cpp index 47a260714..e8b3b97cb 100644 --- a/src/libnrtype/font-lister.cpp +++ b/src/libnrtype/font-lister.cpp @@ -918,6 +918,16 @@ Gtk::TreePath FontLister::get_path_for_font(Glib::ustring family) return font_list_store->get_path(get_row_for_font(family)); } +bool FontLister::is_path_for_font(Gtk::TreePath path, Glib::ustring family) +{ + Gtk::TreeModel::iterator iter = font_list_store->get_iter(path); + if (iter) { + return familyNamesAreEqual(family, (*iter)[FontList.family]); + } + + return false; +} + Gtk::TreeModel::Row FontLister::get_row_for_style(Glib::ustring style) { diff --git a/src/libnrtype/font-lister.h b/src/libnrtype/font-lister.h index c505b3b18..358340c76 100644 --- a/src/libnrtype/font-lister.h +++ b/src/libnrtype/font-lister.h @@ -261,6 +261,8 @@ public: Gtk::TreePath get_path_for_font(Glib::ustring family); + bool is_path_for_font(Gtk::TreePath path, Glib::ustring family); + Gtk::TreeModel::Row get_row_for_style() { return get_row_for_style (current_style); } Gtk::TreeModel::Row get_row_for_style(Glib::ustring style); -- cgit v1.2.3