From 42799425f8c02442df8b1af1a024a3fe8fa6e93f Mon Sep 17 00:00:00 2001 From: nyamatongwe Date: Tue, 4 Apr 2000 09:17:32 +0000 Subject: Split a Document based Accessor (DocumentAccessor) off from the old accessor which is now called WindowAccessor. Accessor.h defines a common interface which is the type consumed by the lexers. --- win32/PlatWin.cxx | 47 +++++++++++++++++++++++++++++++++++++++++++++++ win32/makefile | 9 +++++---- win32/makefile_bor | 15 +++++++++------ win32/makefile_vc | 16 ++++++++++------ 4 files changed, 71 insertions(+), 16 deletions(-) (limited to 'win32') diff --git a/win32/PlatWin.cxx b/win32/PlatWin.cxx index f5a4f98e2..17ca7cc03 100644 --- a/win32/PlatWin.cxx +++ b/win32/PlatWin.cxx @@ -323,12 +323,20 @@ void Surface::Copy(PRectangle rc, Point from, Surface &surfaceSource) { surfaceSource.hdc, from.x, from.y, SRCCOPY); } +#define ASCII_ONLY 1 + void Surface::DrawText(PRectangle rc, Font &font_, int ybase, const char *s, int len, Colour fore, Colour back) { SetFont(font_); ::SetTextColor(hdc, fore.AsLong()); ::SetBkColor(hdc, back.AsLong()); RECT rcw = RectFromPRectangle(rc); +#ifdef ASCII_ONLY ::ExtTextOut(hdc, rc.left, ybase, ETO_OPAQUE, &rcw, s, len, NULL); +#else + wchar_t tbuf[20000]; + int tlen = MultiByteToWideChar(CP_UTF8, 0, s, len, tbuf, sizeof(tbuf)); + ::ExtTextOutW(hdc, rc.left, ybase, ETO_OPAQUE, &rcw, tbuf, tlen, NULL); +#endif } void Surface::DrawTextClipped(PRectangle rc, Font &font_, int ybase, const char *s, int len, Colour fore, Colour back) { @@ -336,13 +344,25 @@ void Surface::DrawTextClipped(PRectangle rc, Font &font_, int ybase, const char ::SetTextColor(hdc, fore.AsLong()); ::SetBkColor(hdc, back.AsLong()); RECT rcw = RectFromPRectangle(rc); +#ifdef ASCII_ONLY ::ExtTextOut(hdc, rc.left, ybase, ETO_OPAQUE | ETO_CLIPPED, &rcw, s, len, NULL); +#else + wchar_t tbuf[20000]; + int tlen = MultiByteToWideChar(CP_UTF8, 0, s, len, tbuf, sizeof(tbuf)); + ::ExtTextOutW(hdc, rc.left, ybase, ETO_OPAQUE | ETO_CLIPPED, &rcw, tbuf, tlen, NULL); +#endif } int Surface::WidthText(Font &font_, const char *s, int len) { SetFont(font_); SIZE sz; +#ifdef ASCII_ONLY ::GetTextExtentPoint32(hdc, s, len, &sz); +#else + wchar_t tbuf[20000]; + int tlen = MultiByteToWideChar(CP_UTF8, 0, s, len, tbuf, sizeof(tbuf)); + ::GetTextExtentPoint32W(hdc, tbuf, tlen, &sz); +#endif return sz.cx; } @@ -350,7 +370,34 @@ void Surface::MeasureWidths(Font &font_, const char *s, int len, int *positions) SetFont(font_); SIZE sz; int fit = 0; +#ifdef ASCII_ONLY ::GetTextExtentExPoint(hdc, s, len, 30000, &fit, positions, &sz); +#else + wchar_t tbuf[20000]; + int poses[20000]; + int tlen = MultiByteToWideChar(CP_UTF8, 0, s, len, tbuf, sizeof(tbuf)); + ::GetTextExtentExPointW(hdc, tbuf, tlen, 30000, &fit, poses, &sz); + int ui=0; + const unsigned char *us = reinterpret_cast(s); + int i=0; + while (i