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

(cherry picked from commit 3c2fa91c75)
This commit is contained in:
Pierre Muller 2023-10-18 21:09:06 +00:00 committed by marcoonthegit
parent 3619317e41
commit 7801779afd
3 changed files with 26 additions and 9 deletions

View File

@ -35,6 +35,7 @@ begin
P.Dependencies.Add('paszlib');
P.Dependencies.add('winunits-base',AllWindowsOSes-[wince]);
P.Version:='3.2.3';
P.Dependencies.add('libfontconfig',[linux] + AllBSDOses);
T:=P.Targets.AddUnit('src/fpttfencodings.pp');
T:=P.Targets.AddUnit('src/fpparsettf.pp');
T.ResourceStrings:=true;

View File

@ -560,17 +560,18 @@ 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}
<<<<<<< HEAD
{$ifdef mswindows}
@ -600,11 +601,26 @@ procedure TFPFontCacheList.ReadStandardFonts;
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.2.3';
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');