LCL, fix GTK1 finding default font, based on patch from Fabrizio Fellini, issue #13230

git-svn-id: trunk@19013 -
This commit is contained in:
jesus 2009-03-17 20:22:26 +00:00
parent 284cbf6430
commit 0eeca5946c

View File

@ -8228,7 +8228,8 @@ var
{$IFDEF GTK2} {$IFDEF GTK2}
PangoFontDesc: PPangoFontDescription; PangoFontDesc: PPangoFontDescription;
{$ELSE} {$ELSE}
p: pchar; p,t: pchar;
AFont: PGdkFont;
{$ENDIF} {$ENDIF}
begin begin
Result:=''; Result:='';
@ -8246,12 +8247,27 @@ begin
if (Result='') and (fontset_name<>nil) then if (Result='') and (fontset_name<>nil) then
begin begin
// fontset_name it's usually a comma separated list of font names // fontset_name it's usually a comma separated list of font names
// try to get the first one. // try to get the first valid font.
p:=strscan(fontset_name, ','); p := fontset_name;
if p=nil then while p<>nil do begin
result:=fontset_name t := strscan(p, ',');
else if t=nil then
result:=copy(fontset_name,1, p-fontset_name); result := p
else begin
result := copy(p, 1, t-p);
while (t<>nil) and (t^ in [',',' ',#9,#10,#13]) do
inc(t);
end;
AFont := gdk_font_load(pchar(result));
if AFont<>nil then begin
gdk_font_unref(AFont);
{$IFDEF VerboseFonts}
debugln('DefaultFont found in fontset: ',result);
{$ENDIF}
break;
end;
p := t;
end;
end; end;
end; end;
{$ENDIF} {$ENDIF}