[fpc-pascal] Raspberry Pi Zero Wireless Self-hosted

2017-06-16 Thread Paul Breneman

How simple can we get? http://wiki.freepascal.org/self-hosted
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Implementing AggPas with PtcGraph

2017-06-16 Thread James Richters
I've been able to use windows fonts with aggpas with the following code:
 
   agg^.Font('ConsolaB.ttf' ,45 );
   agg^.Text(300 ,100 ,'Text Here' );

and it works fine if I copy the font to the same folder as my program.  I'm 
wondering how I can just use standard windows fonts without copying them... but 
not assuming windows is installed in c:\windows

agg^.Font('C:\Windows\Fonts\ConsolaB.ttf' ,45 )
works fine, but as I mentioned I can't be sure windows is installed in 
C:\Windows

I would like to do something like: 
agg^.Font('%windir%\Fonts\ConsolaB.ttf' ,45 );

but of course that won't work because the %windir% variable only works in batch 
files.   

Is there some other way I can capture the install directory of windows, or the 
system so I can make this work properly?


Also, while I was tinkering with this,  I also wanted to see what differences 
there are between Freetype and Windows True Type fonts, and I noticed something 
odd.. 
If I compile with {$DEFINE AGG2D_USE_FREETYPE }  it works fine... but if I 
compile with it commented out,  it does work, and I get text on the screen, but 
the font is not the one I selected.  It seems to be a default font that I can't 
change. Does the font need to be defined differently if using Win32 TT font 
engine?I am using the current 'develop' branch of fpGUI version of aggpas 
now.  I have not tried it with the release version.

I'm also wondering if there is a way to specify the font by the name used by 
windows applications, or is that more complicated than it is really worth?

James



___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Implementing AggPas with PtcGraph

2017-06-16 Thread DaWorm
On Fri, Jun 16, 2017 at 1:49 PM, James Richters <
ja...@productionautomation.net> wrote:

>
> I would like to do something like:
> agg^.Font('%windir%\Fonts\ConsolaB.ttf' ,45 );
>
>
You should be able to use SHGetFolderPath() with CSIDL_WINDOWS.  Not sure
you can always count on Fonts being a subfolder of that, though.

https://msdn.microsoft.com/en-us/library/windows/desktop/bb762181(v=vs.85).aspx


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

https://msdn.microsoft.com/en-us/library/windows/desktop/bb762494(v=vs.85).aspx

Not sure if any are defined in FPC, but should be easy to create/import if
not.

Jeff.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Implementing AggPas with PtcGraph

2017-06-16 Thread James Richters
>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

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal