summaryrefslogtreecommitdiff
path: root/gtk/gtkwidget.c
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2021-09-01 15:17:53 -0400
committerMatthias Clasen <mclasen@redhat.com>2021-09-01 15:52:07 -0400
commitb26a370ce4b5865582b634a70794816d740ac2c8 (patch)
treed4206e8d3d639f70e6bf9e638a7f23c3061e103c /gtk/gtkwidget.c
parent4dc0e67ac741b65b559d262f44980225c0c0beec (diff)
downloadgtk+-hint-metrics-setting.tar.gz
Add a gtk-hint-font-metrics settinghint-metrics-setting
This lets people switch back to font rendering that is closer to what GTK 3 does. It is not perfect - subpixel antialiasing is not going to work. But it give us an Escape hatch while we shake out the bugs in our linear layout. Related: #3787
Diffstat (limited to 'gtk/gtkwidget.c')
-rw-r--r--gtk/gtkwidget.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index 2a8e288232..6ef2add082 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -6441,8 +6441,16 @@ update_pango_context (GtkWidget *widget,
pango_context_set_font_description (context, font_desc);
pango_font_description_free (font_desc);
- if (cairo_version () >= CAIRO_VERSION_ENCODE (1, 17, 4))
- pango_context_set_round_glyph_positions (context, FALSE);
+ settings = gtk_widget_get_settings (widget);
+
+ if (settings &&
+ cairo_version () >= CAIRO_VERSION_ENCODE (1, 17, 4))
+ {
+ gboolean hint_font_metrics;
+
+ g_object_get (settings, "gtk-hint-font-metrics", &hint_font_metrics, NULL);
+ pango_context_set_round_glyph_positions (context, hint_font_metrics);
+ }
pango_context_set_base_dir (context,
_gtk_widget_get_direction (widget) == GTK_TEXT_DIR_LTR ?
@@ -6450,7 +6458,6 @@ update_pango_context (GtkWidget *widget,
pango_cairo_context_set_resolution (context, _gtk_css_number_value_get (style->core->dpi, 100));
- settings = gtk_widget_get_settings (widget);
font_options = (cairo_font_options_t*)g_object_get_qdata (G_OBJECT (widget), quark_font_options);
if (settings && font_options)
{