From 6a597dc85342abf8c88a5b4f1ba99d50589f64ef Mon Sep 17 00:00:00 2001 From: Tavmjong Bah Date: Thu, 31 Jan 2013 19:35:26 +0100 Subject: Text toolbar will display style options for the first font in a font-family list. Also, fix mem leak. (bzr r12082) --- src/libnrtype/FontFactory.cpp | 2 ++ src/widgets/text-toolbar.cpp | 7 +++++++ 2 files changed, 9 insertions(+) (limited to 'src') diff --git a/src/libnrtype/FontFactory.cpp b/src/libnrtype/FontFactory.cpp index 2cf4b8673..fdb02aa0f 100644 --- a/src/libnrtype/FontFactory.cpp +++ b/src/libnrtype/FontFactory.cpp @@ -831,6 +831,8 @@ font_instance* font_factory::FaceFromUIStrings(char const *uiFamily, char const Glib::ustring uiString = Glib::ustring(tokens[0]) + Glib::ustring(uiStyle); + g_strfreev( tokens ); + UIStringToPangoStringMap::iterator uiToPangoIter = fontStringMap.find(uiString); if (uiToPangoIter != fontStringMap.end ()) { diff --git a/src/widgets/text-toolbar.cpp b/src/widgets/text-toolbar.cpp index 6c22c81e3..1f60c6214 100644 --- a/src/widgets/text-toolbar.cpp +++ b/src/widgets/text-toolbar.cpp @@ -178,6 +178,11 @@ static void sp_text_fontstyle_populate(GObject *tbl, font_instance *font=NULL) return; } + // If font list, take only first font in list + gchar** tokens = g_strsplit( current_font, ",", 0 ); + g_strstrip( tokens[0] ); + current_font = tokens[0]; + // Get an iter to the selected font from the model data // We cant get it from the combo, cause it might not have been created yet gboolean found = false; @@ -197,6 +202,8 @@ static void sp_text_fontstyle_populate(GObject *tbl, font_instance *font=NULL) valid = gtk_tree_model_iter_next( model, &iter ); } + g_strfreev( tokens ); + if (!found) { return; } -- cgit v1.2.3