Page 2 of 2

Re: Install a font from program code?

Posted: Sun Apr 21, 2019 9:52 am
by edk
Hi Andrés.
You should add a font before setting it, not after. The ON INIT event starts later than SET FONT and therefore does not work.

Code: Select all

(...)
IF ! FILE( CMedia + 'Fonts\tecnico.fino.ttf' )
	MSGBOX( "No existe el archivo")
*	 STRFILE ( HMG_LoadResourceRawFile ( 'tecnico', RT_RCDATA ), 'tecnico.fino.ttf' )
ENDIF
	
AddFont( CMedia + 'Fonts\tecnico.fino.ttf' )
	
DEFINE WINDOW Form_1 AT 0 , 0 WIDTH 640 HEIGHT 480 NOSIZE MAIN BACKCOLOR { 000, 023, 052 }  ;	
				 ON INIT msgbox ("ON INIT")  ;
				 ON RELEASE RemoveFont( CMedia + 'Fonts\tecnico.fino.ttf' )
		SET FONT TO "tecnico", 13	
		msgbox ("Set font")
		*----------------------------------------------------------------------------------- 		
(...)

Bez tytułu.png
Bez tytułu.png (6.57 KiB) Viewed 1412 times

Re: Install a font from program code?

Posted: Sun Apr 21, 2019 3:14 pm
by andyglezl
Muchas gracias EDK, funciona OK.
+-------------------------------------------
Thank you very much EDK, it works OK.