Draw: Fixed charset conversion in DrawText

This commit is contained in:
Mirek Fidler 2021-12-13 23:05:14 +01:00
parent d16b2ab18a
commit 9518d09962
3 changed files with 36 additions and 1 deletions

9
upptst/azbuka/azbuka.upp Normal file
View file

@ -0,0 +1,9 @@
uses
CtrlLib;
file
main.cpp;
mainconfig
"" = "GUI";

24
upptst/azbuka/main.cpp Normal file
View file

@ -0,0 +1,24 @@
#include <CtrlLib/CtrlLib.h>
using namespace Upp;
struct MyApp : TopWindow {
void Paint(Draw& w) {
ImagePainter ip(GetSize());
ip.DrawRect(GetSize(), White());
String s = "Абвгдежз"; // some cyrillic text
ip.DrawText(10, 10, s); // OK
String s2 = ToCharset(CHARSET_WIN1251, s);
ip.DrawText(10, 50, s2, CHARSET_WIN1251); // draws rectangles instead of letters
Image im = ip;
w.DrawImage(0, 0, im);
}
};
GUI_APP_MAIN
{
MyApp().Run();
}