SaveFont
SaveFont Filename$, [FontIndex]
 
Parameters:

    Filename$ = The filename and path of the font to be saved.
    [FontIndex] = The index of the font you wish to save, this field is optional.
Returns: NONE
 

     The SaveFont command makes PlayBASIC save the selected font to disc. The font will saved out in the PlayBASIC's custom format, known as CRF. The FontIndex parameter is optional, if excluded the command with save the current font (See GetCurrentFont)

     The save process includes the ability to convert the selected font to CRF format on demand, allowing you to save CRF versions of Type Type or Bitmap fonts, without have to convert the font to CRF first.




FACTS:


      * SaveFont saves fonts in PlayBASIC custom format known as CRF. These fonts store pixel data in 32bit form.



Mini Tutorial:


      This example uses the optional FONTS library to load a bitmap image containing a series of hand drawn characters into memory. Once loaded, it then saves it to your "C:\" drive (Note: The save might fail, if you don't have write access to that device) and renders some text in this newly save font. You'll notice that the font can be coloured via the INK command.


  
; Include the FONT Extras library
  #Include "fonts"
  
; get PlayBASIC compiler path to guess
; location of the help file media
  path$=ProgramDir$()+"\Help\Commands/Media/"
  
  
; Build Chr/Image map conversion string for this font
  ChrMap$=" !"+Chr$(34)+"#$%&'()*+,-./0123456789:;<=>?@abcdefghijklmnopqrstuvwxyz"
  
; Load this bitmap font in as FX bitmap font
  LoadBitmapFont(path$+"FRESH.png",10,ChrMap$,30,32,25,4)
  
; Save This FX Bitmap Font to disc. All saved fonts are exported in
; CRF format
  SaveFont "C:\FreshFont.crf",10
  
; load the newly saved CRF into font 1
  LoadFont "C:\FreshFont.crf",1
  
; draw a message on the screen in the current ink colour
  CenterText 400,100,"hello world"
  
; draw this bitmap font with a custom ink colour
  Ink $ff0000
  CenterText 400,150,"hello world"
  
; show the screen to the user
  Sync
  WaitKey
  
  



This example outputs.








Here's the bitmap font image, the test program uses to grab the font letters from.








 
Related Info: CreateBitmapFont | LoadFont | LoadNewFont | MakeBitmapFont :
 


(c) Copyright 2002 - 2024 - Kevin Picone - PlayBASIC.com