[ptcGraph] How to use InstallUserFont function lazarus / 39-Graphics ---------------------------------------------------------------------- Roland57 · 2022-07-28 12:23 Hello! I tried to use the InstallUserFont function from the ptcGraph unit. Here is my code: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i uses{$IFDEF unix}  cThreads,{$ENDIF}  ptcGraph, ptcCrt; procedure ChangeFont(const aFontName: string; const aSize: word);const  fontError = -1;var  font: smallint;begin  font := InstallUserFont(aFontName);  if font = fontError then  begin    WriteLn(ErrOutput, {$I %FILE%} + ' line ' + {$I %LINE%} + ': Failed to change font');    Exit;  end;  WriteLn('font = ', font);  SetTextStyle(font, HorizDir, aSize);end; var  gd, gm: smallint;  begin  gd := VESA;  gm := m800x600x16m;  InitGraph(gd, gm, '');  SetBkColor($FFFFFF);  ClearViewPort;    SetFillStyle(SolidFill, $FF00FF);  Bar(0, 0, 199, 199);    ChangeFont('SourceCode Pro', 12);  SetColor($000080);  OutTextXY(    (200 - TextWidth('A')) div 2,    (200 - TextHeight('A')) div 2,    'A'  );    ReadKey;  CloseGraph;end.  I appended this line in ptcgraph/inc/gtext.inc: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i     function InstallUserFont(const FontFileName : string) : smallint;     begin         _graphresult:=grOk;         { first check if we do not allocate too many fonts! }         if installedfonts=maxfonts then         begin              _graphresult:=grError;              InstallUserFont := DefaultFont;              WriteLn(ErrOutput, {$I %FILE%} + ' line ' + {$I %LINE%} + ': Too many fonts'); // <---            exit; I don't get any error message, but it doesn't work: on the screen I still have the default font (see screenshot). What am I doing wrong? P.-S. I use (I believe) the latest ptcGraph version. I downloaded it with this command: Code: Bash  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i timestamp=$(date +"%Y%m%d")svn checkout https://svn.code.sf.net/p/ptcpas/code/trunk ptcpas-code-$timestamp ---------------------------------------------------------------------- retronick · 2022-08-04 00:54 I can only comment from using from Windows but ptcgraph does not distribute the *.chr font files. Grab them from my github. it does not use true type fonts. https://github.com/RetroNick2020/Channel- Code/tree/master/freepascal/BGI%20CHR%20Font%20Demo ---------------------------------------------------------------------- Roland57 · 2022-08-04 06:48 Thanks. The demo works on Linux, and looks nice.  If I understand well, goth.inc has been generated from GOTH.CHR? ---------------------------------------------------------------------- retronick · 2022-08-25 04:22 yes - correct. you can convert any of the fonts into an array so they can be part of your exe. use the freepascal/lazarus tool data2inc to generate the array from the font file. is located in the bin folder