In one of my applications I use my own font (see also Windows, MacOS) and I wanted use that same TTF font in the Linux binary.
Since I'm not totally convinced this is the "best" way to do this (not a Linux GUI user myself), her what worked for me.
For one your font needs to be copied to "~/.fonts", and I did it this way:
When the font cannot be found in the directory, the application will create the directory and copy the font (distributed with the executable and placed in the same directory as the executable!), and show a message that the application needs to restart - you could do an automatic restart with a TProcess but for odd reason with my application this kept failing and locking files.
So this is my code, used in the OnCreate event of the main form;
if not FileExistsUTF8(ExpandFileNameUTF8('~/.fonts')+DirectorySeparator+'yourfont.ttf') then
begin
ForceDirectoriesUTF8(ExpandFileNameUTF8('~/.fonts'));
CopyFile( ExtractFilePath(ParamStr(0))+DirectorySeparator+'yourfont.ttf',
ExpandFileNameUTF8('~/.fonts')+DirectorySeparator+'yourfont.ttf' );
MessageDlg('Installed "yourfont.ttf'' font in "~/.fonts".'+LineEnding+LineEnding+
'Closing YourApplicationName now.'+LineEnding+LineEnding+
'Please restart this one time so the installed font becomes available.', mtInformation, [mbOK],0);
Application.Terminate;
end;
The restart is needed so your application sees the newly copied font.
After the restart it will see that it was installed in "~/.fonts".