Gtk2,Qt: fixed returning value of GetTextExtentPoint() when string is empty.

git-svn-id: trunk@36108 -
This commit is contained in:
zeljko 2012-03-17 11:19:29 +00:00
parent ff6253e4ac
commit 32c73d9d34
2 changed files with 8 additions and 3 deletions

View File

@ -5947,7 +5947,7 @@ var
begin
Result := IsValidDC(DC);
if not Result then Exit;
if Count <= 0 then
if (Count <= 0) or (StrPas(Str) = '') then
begin
FillChar(Size, SizeOf(Size), 0);
Exit;

View File

@ -4076,10 +4076,15 @@ begin
WriteLn('[WinAPI GetTextExtentPoint]');
{$endif}
Result := False;
Result := IsValidDC(DC);
if not IsValidDC(DC) then Exit;
if not Result then
exit;
Size.cx := 0;
Size.cy := 0;
if (StrPas(Str) = '') or (Count <= 0) then
exit;
WideStr := GetUtf8String(Str);
Size.cx := QtDC.Metrics.width(@WideStr, Count);
Size.cy := QtDC.Metrics.height;