Linux default font

This commit is contained in:
Niklas Mischkulnig 2018-06-04 11:29:41 +02:00
parent a235a6b355
commit 6de328c127
1 changed files with 4 additions and 4 deletions

View File

@ -80,18 +80,18 @@ void uiDrawTextLayoutExtents(uiDrawTextLayout *tl, double *width, double *height
*height = pangoToCairo(logical.height); *height = pangoToCairo(logical.height);
} }
uiDrawTextFont *uiDrawLoadDefaultFont() void uiDrawLoadDefaultFont(uiFontDescriptor *f)
{ {
GtkWidget *widget; GtkWidget *widget;
GtkStyleContext *style; GtkStyleContext *style;
PangoFontDescription *fontdesc; PangoFontDescription *fontdesc;
PangoFont *font;
widget = g_object_ref_sink(gtk_drawing_area_new()); widget = g_object_ref_sink(gtk_drawing_area_new());
style = gtk_widget_get_style_context(widget); style = gtk_widget_get_style_context(widget);
gtk_style_context_get(style, GTK_STATE_FLAG_NORMAL, gtk_style_context_get(style, GTK_STATE_FLAG_NORMAL,
"font", &fontdesc, NULL); "font", &fontdesc, NULL);
font = pangoDescToPangoFont(fontdesc); uiprivFontDescriptorFromPangoFontDescription(fontdesc, f);
// pdesc is transfer-full and thus is a copy
pango_font_description_free(fontdesc);
g_object_unref(widget); g_object_unref(widget);
return mkTextFont(font, FALSE);
} }