win32: DrawText: fix output string length for DT_MODIFYSTRING

git-svn-id: trunk@52709 -
This commit is contained in:
ondrej 2016-07-18 08:41:46 +00:00
parent c66e4799fa
commit f12bbaea40

View File

@ -1116,6 +1116,7 @@ begin
Result := Windows.DrawTextW(DC, PWideChar(W), len, @Rect, Flags);
if (Flags and DT_MODIFYSTRING <> 0) then
begin
W := WideString(PWideChar(W)); // trim to first #0
s := UTF16ToUTF8(W);
if s<>'' then
Move(s[1], Str^, Length(s)+1) // the programmer has to make sure there's enough space in Str