diff options
author | Owen Taylor <otaylor@redhat.com> | 2005-08-24 03:29:06 +0000 |
---|---|---|
committer | Matthias Clasen <matthiasc@src.gnome.org> | 2005-08-24 03:29:06 +0000 |
commit | 2b1bea02f28cdef4a98e26b97594eb9ea798a95d (patch) | |
tree | d0f724924b08fbd3aa94680e7b4c1a25bd9468c2 /gdk/gdkpango.c | |
parent | 39169b6fd61bfc2c3d99c7c9154f4b5e2d8ade85 (diff) | |
download | gtk+-2b1bea02f28cdef4a98e26b97594eb9ea798a95d.tar.gz |
Fix for #314004, reported by Michael Reinsch:
2005-08-23 Owen Taylor <otaylor@redhat.com>
Fix for #314004, reported by Michael Reinsch:
* gdk/gdk.symbols:
* gdk/gdkscreen.[ch]: Add gdk_screen_get/set_font_options_libgtk_only()
Add gdk_screen_get/set_resolution_libgtk_only()
* gdk/gdkpango.c (gdk_pango_context_get_for_screen): Set
the options for the screen on the newly created context.
* gtk/gtksettings.c (settings_update_font_options/dpi) gtkwidget.c:
Move font options and dpi code from gtkwidget.c to gtksettings.c, set
the font options on the screen.
* gtk/gtkwidget.c (gtk_widget_update_pango_context): Just get
the font options from the screen and set them on the context.
Diffstat (limited to 'gdk/gdkpango.c')
-rw-r--r-- | gdk/gdkpango.c | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/gdk/gdkpango.c b/gdk/gdkpango.c index 52dcfebd41..d1649e1ef9 100644 --- a/gdk/gdkpango.c +++ b/gdk/gdkpango.c @@ -1333,6 +1333,12 @@ gdk_pango_layout_get_clip_region (PangoLayout *layout, * instead of this function, to get the appropriate context for * the widget you intend to render text onto. * + * The newly created context will have the default font options (see + * #cairo_font_options_t) for the default screen; if these options + * change it will not be updated. Using gtk_widget_get_pango_context() + * is more convenient if you want to keep a context around and track + * changes to the screen's font rendering settings. + * * Return value: a new #PangoContext for the default display **/ PangoContext * @@ -1353,6 +1359,12 @@ gdk_pango_context_get (void) * instead of this function, to get the appropriate context for * the widget you intend to render text onto. * + * The newly created context will have the default font options + * (see #cairo_font_options_t) for the screen; if these options + * change it will not be updated. Using gtk_widget_get_pango_context() + * is more convenient if you want to keep a context around and track + * changes to the screen's font rendering settings. + * * Return value: a new #PangoContext for @screen * * Since: 2.2 @@ -1361,12 +1373,23 @@ PangoContext * gdk_pango_context_get_for_screen (GdkScreen *screen) { PangoFontMap *fontmap; + PangoContext *context; + const cairo_font_options_t *options; + double dpi; g_return_val_if_fail (GDK_IS_SCREEN (screen), NULL); fontmap = pango_cairo_font_map_get_default (); - return pango_cairo_font_map_create_context (PANGO_CAIRO_FONT_MAP (fontmap)); + context = pango_cairo_font_map_create_context (PANGO_CAIRO_FONT_MAP (fontmap)); + + options = gdk_screen_get_font_options_libgtk_only (screen); + pango_cairo_context_set_font_options (context, options); + + dpi = gdk_screen_get_resolution_libgtk_only (screen); + pango_cairo_context_set_resolution (context, dpi); + + return context; } #define __GDK_PANGO_C__ |