@@ -646,6 +646,35 @@ pluma_view_scroll_to_cursor (PlumaView *view)
646646 0.0 );
647647}
648648
649+ static void
650+ pluma_override_font (GtkWidget * widget ,
651+ const gchar * font )
652+ {
653+ gchar * css ;
654+ GtkCssProvider * provider ;
655+ gchar * tempsize ;
656+
657+ provider = gtk_css_provider_new ();
658+ tempsize = g_strdup (font );
659+
660+ g_strreverse (tempsize );
661+ g_strcanon (tempsize , "1234567890" , '\0' );
662+ g_strreverse (tempsize );
663+
664+ gchar tempfont [strlen (font )];
665+ strcpy (tempfont , font );
666+ tempfont [strlen (font ) - strlen (tempsize )] = 0 ;
667+
668+ css = g_strdup_printf ("textview { font-family: %s; font-size: %spt; }" , tempfont , tempsize );
669+ gtk_css_provider_load_from_data (provider , css , -1 , NULL );
670+ g_free (css );
671+
672+ gtk_style_context_add_provider (gtk_widget_get_style_context (widget ),
673+ GTK_STYLE_PROVIDER (provider ),
674+ GTK_STYLE_PROVIDER_PRIORITY_APPLICATION );
675+ g_object_unref (provider );
676+ }
677+
649678/* FIXME this is an issue for introspection */
650679/**
651680 * pluma_view_set_font:
@@ -684,7 +713,7 @@ pluma_view_set_font (PlumaView *view,
684713
685714 g_return_if_fail (font_desc != NULL );
686715
687- gtk_widget_override_font (GTK_WIDGET (view ), font_desc );
716+ pluma_override_font (GTK_WIDGET (view ), pango_font_description_to_string ( font_desc ) );
688717
689718 pango_font_description_free (font_desc );
690719}
0 commit comments