[fpc-pascal] Implementing AggPas with PtcGraph

James Richters james at productionautomation.net
Fri Jun 16 23:32:14 CEST 2017


>You may be able to use CSIDL_FONTS or FOLDERID_Fonts as well.

 

Thank you for pointing me in the right direction.   I was able to get CSIDL_FONTS to work.  Getting the actual fonts folder is a better idea than assuming it’s in a \Fonts directory

 

I found an example on how to obtain the path from here:

http://wiki.lazarus.freepascal.org/Windows_Programming_Tips 

under “Getting special folders (My documents, Desktop, local application data, etc)”

 

Here is how I was able to get it to work.  I’m wondering if there is a better way to define my variables. I tried just making Font2Use a string but it didn’t compile;

 

Uses

  shlobj,

..

Var

  Font2Use,FontPath: Array[0..MaxPathLen] of Char; //Allocate memory

..

   SHGetSpecialFolderPath(0,FontPath,CSIDL_FONTS,false);

   writeln('Fonts: ' + FontPath);

   font2use:=FontPath+'\segoescb.ttf';

   Writeln(Font2use);

   agg^.Font(font2use ,45 );

..

 

 

James

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20170616/ebd9ba66/attachment.html>


More information about the fpc-pascal mailing list