From eb5616987e0c064a175d5eb111338e1e6f5af54c Mon Sep 17 00:00:00 2001 From: Neil Date: Tue, 20 Apr 2021 08:27:40 +1000 Subject: Bug [#2246]. Fix encoding used for DirectWrite text display. --- doc/ScintillaHistory.html | 12 ++++++++++++ win32/PlatWin.cxx | 11 ++++++----- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/doc/ScintillaHistory.html b/doc/ScintillaHistory.html index 24b2ead5a..a63ac8fc3 100644 --- a/doc/ScintillaHistory.html +++ b/doc/ScintillaHistory.html @@ -571,6 +571,18 @@

Releases

+

+ Release 5.0.2 +

+

Release 5.0.1

diff --git a/win32/PlatWin.cxx b/win32/PlatWin.cxx index 30d72dd4b..99c92434b 100644 --- a/win32/PlatWin.cxx +++ b/win32/PlatWin.cxx @@ -1354,7 +1354,7 @@ public: std::unique_ptr Layout(const IScreenLine *screenLine) override; - void DrawTextCommon(PRectangle rc, const Font *font_, XYPOSITION ybase, std::string_view text, int codePageDraw, UINT fuOptions); + void DrawTextCommon(PRectangle rc, const Font *font_, XYPOSITION ybase, std::string_view text, int codePageOverride, UINT fuOptions); void DrawTextNoClip(PRectangle rc, const Font *font_, XYPOSITION ybase, std::string_view text, ColourAlpha fore, ColourAlpha back) override; void DrawTextClipped(PRectangle rc, const Font *font_, XYPOSITION ybase, std::string_view text, ColourAlpha fore, ColourAlpha back) override; @@ -2303,10 +2303,11 @@ std::unique_ptr SurfaceD2D::Layout(const IScreenLine *screenL return std::make_unique(screenLine); } -void SurfaceD2D::DrawTextCommon(PRectangle rc, const Font *font_, XYPOSITION ybase, std::string_view text, int codePageDraw, UINT fuOptions) { +void SurfaceD2D::DrawTextCommon(PRectangle rc, const Font *font_, XYPOSITION ybase, std::string_view text, int codePageOverride, UINT fuOptions) { SetFont(font_); // Use Unicode calls + const int codePageDraw = codePageOverride ? codePageOverride : codePageText; const TextWide tbuf(text, codePageDraw); if (pRenderTarget && pTextFormat && pBrush) { if (fuOptions & ETO_CLIPPED) { @@ -2340,7 +2341,7 @@ void SurfaceD2D::DrawTextNoClip(PRectangle rc, const Font *font_, XYPOSITION yba if (pRenderTarget) { FillRectangleAligned(rc, back); D2DPenColourAlpha(fore); - DrawTextCommon(rc, font_, ybase, text, codePageText, ETO_OPAQUE); + DrawTextCommon(rc, font_, ybase, text, 0, ETO_OPAQUE); } } @@ -2349,7 +2350,7 @@ void SurfaceD2D::DrawTextClipped(PRectangle rc, const Font *font_, XYPOSITION yb if (pRenderTarget) { FillRectangleAligned(rc, back); D2DPenColourAlpha(fore); - DrawTextCommon(rc, font_, ybase, text, codePageText, ETO_OPAQUE | ETO_CLIPPED); + DrawTextCommon(rc, font_, ybase, text, 0, ETO_OPAQUE | ETO_CLIPPED); } } @@ -2360,7 +2361,7 @@ void SurfaceD2D::DrawTextTransparent(PRectangle rc, const Font *font_, XYPOSITIO if (ch != ' ') { if (pRenderTarget) { D2DPenColourAlpha(fore); - DrawTextCommon(rc, font_, ybase, text, codePageText, 0); + DrawTextCommon(rc, font_, ybase, text, 0, 0); } return; } -- cgit v1.2.3