Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2013-06

System Font Dir for Font Manager Search Path

3 messages · 2 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Edilson Vieira

Hi all,

Could someone, please, help me on thi issue:

My question is How do I get the system font directory on Windows and Linux?

I need the program running on both windows (win32) and linux (gtk).

So, how do I set the Font Manager search path property?

Code fragment example:

>>>>>>>>>>>>>>>>>>>>
procedure TestFPImgFont;
var
  AFont: TFreeTypeFont;
begin
  AFont:=nil;
  try
    // initialize free type font manager
    ftfont.InitEngine;
    FontMgr.SearchPath:='c:\windows\fonts'; // here I need it not to be
hard coded
    AFont:=TFreeTypeFont.Create;
    ... etc.
>>>>>>>>>>>>>>>>>>>>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20130625/b59e032d/attachment.html>

Reply by email

Graeme Geldenhuys
to Edilson Vieira
Edilson Vieira wrote
My question is How do I get the system font directory on Windows and Linux?

I has the same problem when I wrote a font cache system for AggPas in fpGUI.

Under Windows it is easy. There is a registry entry you can query.

Under Linux and FreeBSD it is not so easy. FreeBSD is slightly easier than Linux, because they are more standarised (no 1000's of distros doing there own thing) in where things must be installed.

eg: Here are _some_ font paths on FreeBSD

    lPathList.Add('/usr/share/cups/fonts/');
    lPathList.Add('/usr/share/fonts/truetype/');
    lPathList.Add('/usr/local/lib/X11/fonts/');
    lPathList.Add(GetUserDir + '.fonts/');

Linux will probably be similar to the above - but no guarantees. There are other font paths I haven't listed above. My font cache also runs recursively through the paths I specify. I don't know if the FontMgr you mentioned does that.

I tried to look in the fontconfig source code to see how they do it, but couldn't find anything - though I didn't look too hard.

Regards,
- Graeme -

Reply by email

Edilson Vieira
to Graeme Geldenhuys

Ok Graeme. Thanks a lot!

2013/6/26 Graeme Geldenhuys

Show quoted text 39 lines
On 25/06/13 19:12, Edilson Vieira wrote: > My question is How do I get the system font directory on Windows and Linux? I has the same problem when I wrote a font cache system for AggPas in fpGUI. Under Windows it is easy. There is a registry entry you can query. Under Linux and FreeBSD it is not so easy. FreeBSD is slightly easier than Linux, because they are more standarised (no 1000's of distros doing there own thing) in where things must be installed. eg: Here are _some_ font paths on FreeBSD lPathList.Add('/usr/share/cups/fonts/'); lPathList.Add('/usr/share/fonts/truetype/'); lPathList.Add('/usr/local/lib/X11/fonts/'); lPathList.Add(GetUserDir + '.fonts/'); Linux will probably be similar to the above - but no guarantees. There are other font paths I haven't listed above. My font cache also runs recursively through the paths I specify. I don't know if the FontMgr you mentioned does that. I tried to look in the fontconfig source code to see how they do it, but couldn't find anything - though I didn't look too hard. Regards, - Graeme - -- _______________________________________________ Lazarus mailing list http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20130627/97269adc/attachment.html>

Reply by email