Forum > Unix
TFont Full path
CanineQwer:
I have TFont.
How to get the full path to the font storage location?
Now I take TFont.Name and use it on the command line along with "fc-list" and "grep".
Please suggest a better solution.
*Linux.
wp:
There is no cross-platform solution. In TAChart, I use this code:
--- Code: Pascal [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---procedure PopulateFontDirList(AList: TStrings);const CSIDL_FONTS = 20;var s: String;begin if AList = nil then raise Exception.Create('PopulateFontDirList: list not allocated.'); {$IFDEF WINDOWS} s := SHGetFolderPathUTF8(CSIDL_FONTS); if s <> '' then AList.Add(s); {$ENDIF} {$IFDEF linux} AList.Add('/usr/share/cups/fonts/'); AList.Add('/usr/share/fonts/truetype/'); AList.Add('/usr/local/lib/X11/fonts/'); AList.Add(GetUserDir + '.fonts/'); {$ENDIF} {$IFDEF LCLCarbon} AList.Add('/Library/Fonts/'); AList.Add('/System/Library/Fonts/'); AList.Add('/Network/Library/Fonts/'); AList.Add('~/Library/Fonts/'); {$ENDIF} {$IFDEF LCLCocoa} AList.Add('/Library/Fonts/'); AList.Add('/System/Library/Fonts/'); AList.Add('/Network/Library/Fonts/'); AList.Add('~/Library/Fonts/'); {$ENDIF}end;
CanineQwer:
I do not need cross-platform.
I specifically need Linux.
It is possible and specifically GTK.
winni:
Hi!
For what reasons do you need the path to the font files?
The is the var screen.fonts which is a list of all fonts that Lazarus knows.
And for assigning a font to a component you dont need the path:
MyComponent.Font.Name := 'Arial' ;
Winni
CanineQwer:
I know that to use a font, the path is optional.
But I need a font file to transfer it to other people.
So just searching for it manually, as @wp suggested?
Is this the best solution?
Navigation
[0] Message Index
[#] Next page