Patch from Giuliano for LCL-CustomDrawn-X11 compilation fix + fixes endless loop in the fonts search

git-svn-id: trunk@35886 -
This commit is contained in:
sekelsenmat 2012-03-11 14:23:05 +00:00
parent 0c4d7c8009
commit 00ebdc2239
4 changed files with 11 additions and 9 deletions

View File

@ -37,6 +37,6 @@
{$define CD_HasNativeSelectItemDialog}
{$endif}
{$if defined(CD_WINDOWS)}
{$define CD_UseNativeText}
//{$define CD_UseNativeText}
{$endif}

View File

@ -108,6 +108,7 @@ begin
FFontPaths:= TStringList.Create;
FFontList := THashedStringList.Create;
FFontList.CaseSensitive:= False;
TT_Init_FreeType;
{$endif}
BackendCreate;
@ -125,6 +126,7 @@ begin
BackendDestroy;
{$ifndef CD_UseNativeText}
TT_Done_FreeType;
FFontPaths.Free;
FFontList.Free;
{$endif}

View File

@ -756,7 +756,7 @@ var
Rslt: TSearchRec;
AFace: TT_Face;
ErrNum: TT_Error;
I,J: Integer;
SearchResult, J: Integer;
FontPath: String;
NameCount: Integer;
NameString: Pchar;
@ -768,11 +768,11 @@ var
DebugList: TstringList;
{$endif}
begin
I:= FindFirstUTF8(APath+'*.ttf', faAnyFile, Rslt);
SearchResult := FindFirstUTF8(APath+'*.ttf', faAnyFile, Rslt);
{$ifdef CD_Debug_TTF}
DebugList:= TStringList.Create;
{$endif}
while I >= 0 do
while SearchResult = 0 do
begin
FontPath:= APath+Rslt.Name;
ErrNum:= TT_Open_Face(FontPath, AFace);
@ -818,7 +818,7 @@ begin
DebugList.Add('------');
{$endif}
ErrNum:= TT_Close_Face(AFace);
I:= FindNextUTF8(Rslt);
SearchResult := FindNextUTF8(Rslt);
end;
FindCloseUTF8(Rslt);
{$ifdef CD_Debug_TTF}

View File

@ -690,10 +690,10 @@ begin
FontsScanForTTF(APath,AFontList);
end;
// default for recent distros
if lFontList.Values['Liberation Sans'] <> '' then LiberationFont:= True
if AFontList.Values['Liberation Sans'] <> '' then LiberationFont:= True
else LiberationFont:= False;
// default for older distros
if lFontList.Values['Luxi Sans Regular'] <> '' then LuxiFont:= True
if AFontList.Values['Luxi Sans Regular'] <> '' then LuxiFont:= True
else LuxiFont:= False;
{$ifdef CD_Debug_TTF}
@ -727,7 +727,7 @@ begin
If AFontName = '' then AFontName:= LongFontName; // neither Liberation nor Luxi, but maybe we're lucky
str := lFontList.Values[AFontName];
str := FFontList.Values[AFontName];
if str <> '' then begin
Result:= str;
exit;
@ -756,7 +756,7 @@ begin
else AFontName:= 'Luxi Sans Regular';
end;
str := lFontList.Values[AFontName];
str := FFontList.Values[AFontName];
if str <> '' then begin
Result:= str;
exit;