win32: support DT_MODIFYSTRING in DrawText

git-svn-id: trunk@52702 -
This commit is contained in:
ondrej 2016-07-17 04:07:04 +00:00
parent 15c2bd5825
commit 366cedfb91

View File

@ -1111,7 +1111,17 @@ begin
// the length of utf8 vs Wide/Ansi the strings differ, so recalc.
W := UTF8ToUTF16(s);
len := Length(W);
if (Flags and DT_MODIFYSTRING <> 0) then
SetLength(W, len+4);
Result := Windows.DrawTextW(DC, PWideChar(W), len, @Rect, Flags);
if (Flags and DT_MODIFYSTRING <> 0) then
begin
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
else
Str^ := #0;
end;
// Theoretically, we need to augment the returned rect by the text overhang