diff options
author | Neil <nyamatongwe@gmail.com> | 2021-04-04 17:32:58 +1000 |
---|---|---|
committer | Neil <nyamatongwe@gmail.com> | 2021-04-04 17:32:58 +1000 |
commit | 8bd3b65c924e56cbd414a71e85b3bafd0c8b17e2 (patch) | |
tree | bf0fe6f5f9b333da2891078937a6d298c3d43309 | |
parent | 1485ec0b5f3fb3df5b4b4effba94ab1c621a8f2b (diff) | |
download | scintilla-mirror-8bd3b65c924e56cbd414a71e85b3bafd0c8b17e2.tar.gz |
Respond to changes in font antialiasing and hinting options on GTK 2.
-rwxr-xr-x | gtk/PlatGTK.cxx | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/gtk/PlatGTK.cxx b/gtk/PlatGTK.cxx index c71d1dff4..b400d4b52 100755 --- a/gtk/PlatGTK.cxx +++ b/gtk/PlatGTK.cxx @@ -137,6 +137,7 @@ namespace Scintilla { class SurfaceImpl : public Surface { SurfaceMode mode; EncodingType et= EncodingType::singleByte; + WindowID widSave = nullptr; cairo_t *context = nullptr; cairo_surface_t *psurf = nullptr; bool inited = false; @@ -150,7 +151,7 @@ class SurfaceImpl : public Surface { void CairoRectangle(PRectangle rc) noexcept; public: SurfaceImpl() noexcept; - SurfaceImpl(cairo_t *context_, int width, int height, SurfaceMode mode_) noexcept; + SurfaceImpl(cairo_t *context_, int width, int height, SurfaceMode mode_, WindowID wid) noexcept; // Deleted so SurfaceImpl objects can not be copied. SurfaceImpl(const SurfaceImpl&) = delete; SurfaceImpl(SurfaceImpl&&) = delete; @@ -299,14 +300,14 @@ void SurfaceImpl::CairoRectangle(PRectangle rc) noexcept { SurfaceImpl::SurfaceImpl() noexcept { } -SurfaceImpl::SurfaceImpl(cairo_t *context_, int width, int height, SurfaceMode mode_) noexcept { +SurfaceImpl::SurfaceImpl(cairo_t *context_, int width, int height, SurfaceMode mode_, WindowID wid) noexcept { if (height > 0 && width > 0) { cairo_surface_t *psurfContext = cairo_get_target(context_); psurf = cairo_surface_create_similar( psurfContext, CAIRO_CONTENT_COLOR_ALPHA, width, height); context = cairo_create(psurf); - pcontext = pango_cairo_create_context(context); + pcontext = gtk_widget_create_pango_context(PWidget(wid)); PLATFORM_ASSERT(pcontext); layout = pango_layout_new(pcontext); PLATFORM_ASSERT(layout); @@ -371,6 +372,7 @@ bool SurfaceImpl::Initialised() { } void SurfaceImpl::Init(WindowID wid) { + widSave = wid; Release(); PLATFORM_ASSERT(wid); // if we are only created from a window ID, we can't perform drawing @@ -385,6 +387,7 @@ void SurfaceImpl::Init(WindowID wid) { } void SurfaceImpl::Init(SurfaceID sid, WindowID wid) { + widSave = wid; PLATFORM_ASSERT(sid); Release(); PLATFORM_ASSERT(wid); @@ -399,7 +402,8 @@ void SurfaceImpl::Init(SurfaceID sid, WindowID wid) { } std::unique_ptr<Surface> SurfaceImpl::AllocatePixMap(int width, int height) { - return std::make_unique<SurfaceImpl>(context, width, height, mode); + // widSave must be alive now so safe for creating a PangoContext + return std::make_unique<SurfaceImpl>(context, width, height, mode, widSave); } void SurfaceImpl::SetMode(SurfaceMode mode_) { |