LoadNewFont
FontIndex = LoadNewFont(Filename$, [Size=0], [StyleFlag =0], [Format =-1] The format of this font)
 
Parameters:

    Filename$ = The Filename of the font you wish to load
    [Size=0] = The size of this font
    [StyleFlag =0] = Style flags Bold, Italics, Underline
    [Format =-1] The format of this font
Returns:

    FontIndex = The index identifier of this font
 

      The LoadNewFont function can load either standard windows font (true type or bitmap), or PlayBasic's very own CRF (Compressed Raster Font) format.

      Compressed Raster Fonts we're added to PlayBasic V1.64 as a global font solution. CRF's are a form of bitmap font, that can be drawn onto any surface and include support for Alpha Channel (Anti Aliasing).

      You can convert fonts to CRF format both internally (MakeBitmapFont) or by using the PlayFONT tool (See PlayBasic.com for Free PlayBASIC tools/forums).


[ StyleFlags ]
0 = Normal style
1 = Bold
2 = Itelics
3 = Combined Bold + Italics
4 = Underline
5 = Bold + Underline
6 = Italics+ Underline
7 = Bold + Italics + UnderLine


[ Format ]
-1 = Windows True Type (default)
2= Video Bitmap Font
4= FX Bitmap Font
8= Compress Raster Font (CRF)





FACTS:


      * By default all PlayBASIC programs use the "Courier New" as font #1.

      * Not all Windows fonts can be loaded!

      * If you try and load a windows font doesn't exist, or can't be loaded. The default font will be loaded in it's place.

      * Windows True Type/Bitmaps Fonts will be automatically converted to a CRF when drawing text to FX surfaces.

      * CRF fonts can be loaded from memory (rather than from disc) by replacing the filename with the address and & character.. eg Index=LoadNewFont( "&"+Str$(AddressInMemory), Size,Flags) They can also be automatically loaded from memory when attached as a resource. See #AddResource




Mini Tutorial:


This example displays a message in the default font, then loads a second font as the current font and displays a second message.

  
  
; Display a message in the PB default font
  Print "This text is displayed in the normal font"
  
; Load the "Arial" font as font 2, size 24, in the normal style
  MyFont=LoadNewFont("Arial",24,0)
  
; Set Font at the current font.
  SetFont MyFont
  
; Display a message in the PB default font
  Print "This text is displayed in the Arial font"
  
; Display the screen and wait for a key top be pressed
  Sync
  WaitKey
  




This example would output.

  
  This Text is displayed in the normal font
  This Text is displayed in the Arial font
  

 
Related Info: CreateBitmapFont | CreateFXFont | DeleteFont | GetFontStatus | LoadFont | MakeBitmapFont | NewBitmapFont | PrepareFXFont :
 


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