From 984ffd40338704db4ef1ce5333e0ed1ec9cd5a71 Mon Sep 17 00:00:00 2001 From: Colomban Wendling Date: Tue, 1 Jan 2013 18:20:35 +1100 Subject: Properly update the Pango contexts for the target surface This fixes drawing on a surface that has different settings (like scaling) than the display surface, by performing the measurements on a layout properly set up for the target surface. In practice, this fixes e.g. printing on a scaled surface. --- gtk/PlatGTK.cxx | 4 ++++ 1 file changed, 4 insertions(+) --- gtk/PlatGTK.cxx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/gtk/PlatGTK.cxx b/gtk/PlatGTK.cxx index 3aec7a6ab..beef9749d 100644 --- a/gtk/PlatGTK.cxx +++ b/gtk/PlatGTK.cxx @@ -553,6 +553,8 @@ void SurfaceImpl::Init(SurfaceID sid, WindowID wid) { PLATFORM_ASSERT(wid); context = cairo_reference(reinterpret_cast(sid)); pcontext = gtk_widget_create_pango_context(PWidget(wid)); + // update the Pango context in case sid isn't the widget's surface + pango_cairo_update_context(context, pcontext); layout = pango_layout_new(pcontext); cairo_set_line_width(context, 1); createdGC = true; @@ -566,6 +568,8 @@ void SurfaceImpl::InitPixMap(int width, int height, Surface *surface_, WindowID PLATFORM_ASSERT(wid); context = cairo_reference(surfImpl->context); pcontext = gtk_widget_create_pango_context(PWidget(wid)); + // update the Pango context in case surface_ isn't the widget's surface + pango_cairo_update_context(context, pcontext); PLATFORM_ASSERT(pcontext); layout = pango_layout_new(pcontext); PLATFORM_ASSERT(layout); -- cgit v1.2.3