Painter: Fixed problem with strlen in Text

This commit is contained in:
Mirek Fidler 2022-12-17 08:48:24 +01:00
parent 588529a752
commit 81d79f3ed3
2 changed files with 3 additions and 2 deletions

View file

@ -267,8 +267,8 @@ Painter& Painter::Text(double x, double y, const String& s, Font fnt, const doub
Painter& Painter::Text(const Pointf& p, const char *text, Font fnt, int n, const double *dx)
{
WString s = ToUtf32(text, n);
return Text(p, s, fnt, n < 0 ? s.GetCount() : n, dx);
WString s = ToUtf32(text, n < 0 ? strlen(text) : n);
return Text(p, s, fnt, s.GetCount(), dx);
}
Painter& Painter::Text(double x, double y, const char *text, Font fnt, int n, const double *dx)

View file

@ -9,6 +9,7 @@ struct MyApp : TopWindow {
DrawPainter iw(w, GetSize());
iw.Clear(SWhite());
iw.DrawText(Zx(100), Zx(100), "Hello world!", (Font)~dl);
iw.Text(Zx(100), Zx(200), "Hello world again!", (Font)~dl).Fill(Black());
}
MyApp() {