|
NewBitmapFont | ||
FontIndex = NewBitmapFont(Width, Height, [Format=2]) | ||
Parameters: Width = The width of each character Height = The height of each character [Format=2] = optional bitmap font format. |
||
Returns: FontIndex = The Index of the newly created font |
||
NewBitmapFont() initializes a blank bitmap font. Upon creation each characters in the alphabet will be blank and have the same width and height. While this might not should that useful, it allows you to import your own hand drawn fonts. To import a font, you'll need to load your character set into PlayBASIC as an image, then grab the individual characters from it (using GetFontChr()) to store them in their corresponding ASCII positions. Once imported, you can use this font just like any other windows font. The benefits are that bitmap fonts are not only faster, but will vastly improve your programs visual style. [ Format Flags ] 2= Video Bitmap Font The format flags allow us to prepare the type of bitmap font this should be. In older veriosn of PB, if you wanted to create an FX bitmap font, you'd have to create a standard bitmap font (video) then prepare it as an FX font. Which was pretty slow. FACTS: * All characters in the font will have the same physical width and height. However you can adjust the render width using the FontChrWidth command * Use FontMaskColour to change the transparent colour of the font * To help make this process easier for new users we've included a fonts expansion library in the SLiBS folder. This library includes a function that will load an image (with your character set on it) it into a bitmap font. See the demo which is located in the Projects/Examples/Fonts folder. Mini Tutorial: This example loads the windows true type Arial, and the builds a custom bitmap version of it. In fact this example basically replicates what the MakeBitmapFont command does. But this approaches gives you the control and freedom to build or import your own hand drawn character sets into PB as a custom font.
This example would output.
|
Related Info: | CreateFXFont | FontMaskColour | GetFontChr | LoadFont | MakeBitmapFont | PrepareFXFont | SetFont : |
|
|||||||||||||||||||||||||||||||||||||||
(c) Copyright 2002 - 2024 - Kevin Picone - PlayBASIC.com |