gint font_size, arrow_size;
PangoContext *context;
PangoFontMetrics *metrics;
- PangoFontDescription *font_desc;
+ const PangoFontDescription *font_desc;
GtkWidget *child;
gint minimum_width = 0, natural_width = 0;
gint child_min, child_nat;
state = gtk_widget_get_state_flags (widget);
get_widget_padding (widget, &padding);
- gtk_style_context_get (style_context, state,
- "font", &font_desc,
- NULL);
+ font_desc = gtk_style_context_get_font (style_context, state);
context = gtk_widget_get_pango_context (GTK_WIDGET (widget));
metrics = pango_context_get_metrics (context, font_desc,
font_size = PANGO_PIXELS (pango_font_metrics_get_ascent (metrics) +
pango_font_metrics_get_descent (metrics));
pango_font_metrics_unref (metrics);
- pango_font_description_free (font_desc);
arrow_size = MAX (arrow_size, font_size) * arrow_scaling;
get_font_metrics (PangoContext *context, GtkWidget *widget)
{
GtkStyleContext *style_context;
- PangoFontDescription *font;
+ const PangoFontDescription *font;
PangoFontMetrics *retval;
style_context = gtk_widget_get_style_context (widget);
- gtk_style_context_get (style_context, 0, "font", &font, NULL);
+ font = gtk_style_context_get_font (style_context, GTK_STATE_FLAG_NORMAL);
retval = pango_context_get_metrics (context,
font,
pango_context_get_language (context));
- if (font != NULL)
- pango_font_description_free (font);
-
return retval;
}
update_pango_context (GtkWidget *widget,
PangoContext *context)
{
- PangoFontDescription *font_desc;
+ const PangoFontDescription *font_desc;
GtkStyleContext *style_context;
style_context = gtk_widget_get_style_context (widget);
- gtk_style_context_get (style_context,
- gtk_widget_get_state_flags (widget),
- "font", &font_desc,
- NULL);
+ font_desc = gtk_style_context_get_font (style_context,
+ gtk_widget_get_state_flags (widget));
pango_context_set_font_description (context, font_desc);
pango_context_set_base_dir (context,
gtk_widget_get_direction (widget) == GTK_TEXT_DIR_LTR ?
PANGO_DIRECTION_LTR : PANGO_DIRECTION_RTL);
-
- pango_font_description_free (font_desc);
}
static void