mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-05-15 14:16:07 -06:00
Draw: Fixed charset conversion in DrawText
This commit is contained in:
parent
d16b2ab18a
commit
9518d09962
3 changed files with 36 additions and 1 deletions
|
|
@ -20,7 +20,9 @@ WString TextUnicode(const char *s, int n, byte cs, Font font)
|
|||
return WString(b);
|
||||
}
|
||||
#endif
|
||||
return ToUtf32(s, n);
|
||||
if(cs == CHARSET_UTF8)
|
||||
return ToUtf32(s, n);
|
||||
return ToUnicode(s, n, cs);
|
||||
}
|
||||
|
||||
void Draw::DrawText(int x, int y, int angle, const wchar *text, Font font,
|
||||
|
|
|
|||
9
upptst/azbuka/azbuka.upp
Normal file
9
upptst/azbuka/azbuka.upp
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
uses
|
||||
CtrlLib;
|
||||
|
||||
file
|
||||
main.cpp;
|
||||
|
||||
mainconfig
|
||||
"" = "GUI";
|
||||
|
||||
24
upptst/azbuka/main.cpp
Normal file
24
upptst/azbuka/main.cpp
Normal 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();
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue