FoxPrint font.  
Author Message
Aleniko29139





PostPosted: Visual FoxPro General, FoxPrint font. Top

In order for users to be able to use a font, is it enough for it to reside in the working folder of my VFP app, or do I need to install the actual font

Thanks again,

Aleniko


Visual FoxPro1  
 
 
giuln





PostPosted: Visual FoxPro General, FoxPrint font. Top

to use a font you have to load it.

In your app declare this API

DECLARE LONG AddFontResource IN Gdi32 STRING lpFileName
DECLARE LONG RemoveFontResource IN Gdi32 STRING lpFileName

At startup load fonts

LOCAL cFileName, cHomeDir

cHomeDir = AddBs(<YourAppHomeDir>)

cFileName = SYS(2000, cHomeDir + 'FONTS\*.TTF') && If Fonts are in <YourAppHomeDir>\Fonts directory
DO WHILE !EMPTY(cFileName)
AddFontResource(cHomeDir + 'FONTS\' + cFileName)
cFileName = SYS(2000, '', 1)
ENDDO

Closing your app release fonts loaded

LOCAL cFileName, cHomeDir

cHomeDir = AddBs(<YourAppHomeDir>)

cFileName = SYS(2000, cHomeDir + 'FONTS\*.TTF')
DO WHILE !EMPTY(cFileName)
RemoveFontResource(cHomeDir + 'FONTS\' + cFileName)
cFileName = SYS(2000, '', 1)
ENDDO

Since you load fonts on application startup, if you have to use these fonts, for example, in a report you have to edit report from your application (or when your application is running, at least).