Extend support to all BSD systems for libfontconfig and fcl-pdf packages

This commit is contained in:
Pierre Muller 2023-10-18 21:09:06 +00:00
parent 59fe173cc7
commit 3c2fa91c75
3 changed files with 26 additions and 10 deletions

View File

@ -34,7 +34,7 @@ begin
P.Dependencies.Add('fcl-xml');
P.Dependencies.Add('paszlib');
P.Dependencies.add('winunits-base',AllWindowsOSes-[wince]);
P.Dependencies.add('libfontconfig',[linux,freebsd,darwin]);
P.Dependencies.add('libfontconfig',[linux] + AllBSDOses);
P.Version:='3.3.1';
T:=P.Targets.AddUnit('src/fpttfencodings.pp');
T:=P.Targets.AddUnit('src/fpparsettf.pp');

View File

@ -587,28 +587,44 @@ end;
procedure TFPFontCacheList.ReadStandardFonts;
{$ifdef linux}
{$define HasFontsConf}
const
cFontsConf = '/etc/fonts/fonts.conf';
{$endif}
{$ifdef freebsd}
{$define HasFontsConf}
const
cFontsConf = '/usr/local/etc/fonts/fonts.conf';
{$endif}
{ Use same default for Linux and other BSD non-Darwin systems. }
{$if (defined(linux) or (defined(bsd) and not(defined(darwin)) and not defined(HasFontsConf)))}
{$define HasFontsConf}
const
cFontsConf = '/etc/fonts/fonts.conf';
{$ifend}
{$ifdef HasFontsConf}
var
doc: TXMLDocument;
lChild: TDOMNode;
FN : PFcChar8;
lDir: string;
config: PfcConfig;
const
is_fc_loaded:integer=0;
{$endif}
begin
{$ifdef HasFontsConf} // Linux & FreeBSD
ReadXMLFile(doc, cFontsConf);
{$ifdef HasFontsConf} // Linux & BSD
if (is_fc_loaded=0) then
is_fc_loaded:=loadfontconfiglib('');
config := FcInitLoadConfigAndFonts();
if assigned(FcConfigGetFilename) then
FN:=FcConfigGetFilename(config,Nil)
else if assigned(FcConfigFilename) then
FN:=FcConfigFilename(Nil)
else
FN:=cFontsConf;
ReadXMLFile(doc, FN);
try
lChild := doc.DocumentElement.FirstChild;
while Assigned(lChild) do

View File

@ -20,7 +20,7 @@ begin
P.Version:='3.3.1';
P.SourcePath.Add('src');
P.IncludePath.Add('src');
P.OSes := [linux,freebsd, darwin]; // Darwin was tested!
P.OSes := [linux] + AllBSDOses; // Darwin was tested!
T:=P.Targets.AddUnit('libfontconfig.pp');
P.ExamplePath.Add('examples');
P.Targets.AddExampleProgram('testfc.pp');