mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-05-15 14:16:07 -06:00
This might bring some incompatibilities in the code that expects wchar to be 16 bit, which escpecially involves dealing with Win32 (and to lesser extend MacOS) APIs, so if your application is doing that, please check all instances of WCHAR (UniChar on MacOS) or even wchar especially type casts. To support host APIs, char16 is introduced (but there is no 16-bit String varian). Use ToSystemCharsetW, FromSystemCharsetW to convert texts to Win32 API. - Support of drawing non-BMP characters in GUI - Vastly improved character font replacement code (when drawing characters missing with requested font, replacement font is used) - Last instances of Win32 ANSI calls (those ending with A) are removed - UTF handling routines are refactored and their's naming is unified - RTF is now being able to handle non-BMP characters (RTF is used as clipboard format for RichText) Other minor changes: - fixed TryRealloc issue - improved MemoryCheck - Removed MemoryAlloc48/MemoryFree48 - In theide Background parsing should less often cause delays in the main thread
38 lines
1 KiB
C++
38 lines
1 KiB
C++
#include "CtrlCore.h"
|
|
|
|
#ifdef GUI_WIN
|
|
|
|
namespace Upp {
|
|
|
|
#define LLOG(x)
|
|
|
|
HFONT GetWin32Font(Font fnt, int angle);
|
|
extern StaticMutex sFontLock;
|
|
|
|
void SystemDraw::DrawTextOp(int x, int y, int angle, const wchar *text, Font font, Color ink,
|
|
int n, const int *dx) {
|
|
Std(font);
|
|
GuiLock __;
|
|
COLORREF cr = GetColor(ink);
|
|
if(cr != lastTextColor) {
|
|
LLOG("Setting text color: " << ink);
|
|
::SetTextColor(handle, lastTextColor = cr);
|
|
}
|
|
Mutex::Lock ___(sFontLock); // need this because of GetWin32Font
|
|
HGDIOBJ orgfont = ::SelectObject(handle, GetWin32Font(font, angle));
|
|
int ascent = font.Info().GetAscent();
|
|
Vector<char16> text16 = ToUtf16(text, n);
|
|
if(angle) {
|
|
double sina, cosa;
|
|
Draw::SinCos(angle, sina, cosa);
|
|
Size offset;
|
|
::ExtTextOutW(handle, x + fround(ascent * sina), y + fround(ascent * cosa), 0, NULL, text16.begin(), text16.GetCount(), dx);
|
|
}
|
|
else
|
|
::ExtTextOutW(handle, x, y + ascent, 0, NULL, text16.begin(), text16.GetCount(), dx);
|
|
::SelectObject(handle, orgfont);
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|