summaryrefslogtreecommitdiffstats
path: root/src/widgets/font-selector.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/widgets/font-selector.cpp')
-rw-r--r--src/widgets/font-selector.cpp21
1 files changed, 20 insertions, 1 deletions
diff --git a/src/widgets/font-selector.cpp b/src/widgets/font-selector.cpp
index b17dcf470..013ad9e94 100644
--- a/src/widgets/font-selector.cpp
+++ b/src/widgets/font-selector.cpp
@@ -162,8 +162,21 @@ static void sp_font_selector_init(SPFontSelector *fsel)
GtkCellRenderer *cell = gtk_cell_renderer_text_new ();
gtk_tree_view_column_pack_start (column, cell, FALSE);
gtk_tree_view_column_set_attributes (column, cell, "text", 0, NULL);
+ gtk_tree_view_column_set_cell_data_func (column, cell,
+ GtkTreeCellDataFunc (font_lister_cell_data_func),
+ NULL, NULL );
gtk_tree_view_append_column (GTK_TREE_VIEW(fsel->family_treeview), column);
gtk_tree_view_set_headers_visible (GTK_TREE_VIEW(fsel->family_treeview), FALSE);
+ gtk_tree_view_set_row_separator_func( GTK_TREE_VIEW(fsel->family_treeview),
+ GtkTreeViewRowSeparatorFunc ((gpointer)font_lister_separator_func),
+ NULL, NULL );
+
+ /* Muck with style, see text-toolbar.cpp */
+ gtk_widget_set_name( GTK_WIDGET(fsel->family_treeview), "font_selector_family" );
+ gtk_rc_parse_string (
+ "widget \"*font_selector_family\" style \"fontfamily-separator-style\"");
+
+
Glib::RefPtr<Gtk::ListStore> store = fontlister->get_font_list();
gtk_tree_view_set_model (GTK_TREE_VIEW(fsel->family_treeview), GTK_TREE_MODEL (Glib::unwrap (store)));
gtk_container_add(GTK_CONTAINER(sw), fsel->family_treeview);
@@ -442,6 +455,10 @@ GtkWidget *sp_font_selector_new()
*/
unsigned int sp_font_selector_get_best_style (font_instance *font, GList *list)
{
+ if ( !font || !list) {
+ return 0;
+ }
+
font_instance *tempFont = NULL;
unsigned int currentStyleNumber = 0;
unsigned int bestStyleNumber = 0;
@@ -462,7 +479,9 @@ unsigned int sp_font_selector_get_best_style (font_instance *font, GList *list)
tempFont = NULL;
}
- pango_font_description_unset_fields(bestMatchForFont, PANGO_FONT_MASK_SIZE);
+ if( bestMatchForFont != NULL ) {
+ pango_font_description_unset_fields(bestMatchForFont, PANGO_FONT_MASK_SIZE);
+ }
list = list->next;