gtk2 intf: fixed GetTextExtentIgnoringAmpersands checking for line end

git-svn-id: trunk@11724 -
This commit is contained in:
mattias 2007-08-03 10:07:18 +00:00
parent 8fdda10624
commit e81f58a39e

View File

@ -9259,10 +9259,12 @@ end;
That means, ampersands are not counted. That means, ampersands are not counted.
-------------------------------------------------------------------------------} -------------------------------------------------------------------------------}
{$Ifdef GTK2} {$Ifdef GTK2}
Procedure GetTextExtentIgnoringAmpersands(FontDesc : PPangoFontDescription; Str : PChar; Procedure GetTextExtentIgnoringAmpersands(FontDesc : PPangoFontDescription;
Str : PChar;
LineLength : Longint; lbearing, rbearing, width, ascent, descent : Pgint); LineLength : Longint; lbearing, rbearing, width, ascent, descent : Pgint);
{$Else} {$Else}
Procedure GetTextExtentIgnoringAmpersands(FontDesc : PGDKFont; Str : PChar; Procedure GetTextExtentIgnoringAmpersands(FontDesc : PGDKFont;
Str : PChar;
LineLength : Longint; lbearing, rbearing, width, ascent, descent : Pgint); LineLength : Longint; lbearing, rbearing, width, ascent, descent : Pgint);
{$EndIf} {$EndIf}
var var
@ -9273,8 +9275,8 @@ begin
// first check if Str contains an ampersand: // first check if Str contains an ampersand:
if (Str<>nil) then begin if (Str<>nil) then begin
i:=0; i:=0;
while (not (Str[i] in [#0,'&'])) do inc(i); while (Str[i]<>'&') and (i<LineLength) do inc(i);
if Str[i]='&' then begin if i<LineLength then begin
NewStr := RemoveAmpersands(Str, LineLength); NewStr := RemoveAmpersands(Str, LineLength);
LineLength:=StrLen(NewStr); LineLength:=StrLen(NewStr);
end; end;