12-07-2023, 04:40 PM
Now added the ability to embed a small selection of fonts directly into a QB64PE program, which means they wouldn't have to rely on any external files once compiled and ran, so you don't have to worry about the end user not having the proper files on their drive to run your program glitch-free.
Basic style example is below:
Basic style example is below:
Code: (Select All)
$Let INCLUDE_ALL = TRUE
$Let EMBED_COURIER_NEW = TRUE
$Let EMBED_CONSOLA = TRUE
$Let EMBED_SOURCE_CODE_PRO = TRUE
'Note that we ALSO have to specify which fonts we want to embed in our program,
'as we do above with the EMBED_COURIER_NEW = TRUE statement.
'This is because fonts can become quite large in size, and no single program
'needs to become bloated by several hundred MB as it attempts to embed fonts in itself
'that it doesn't even make use of!
'$INCLUDE:'..\Library Files\Toolbox.BI'
Screen _NewImage(800, 600, 32)
f = ReturnFont("Courier New", 20, "") ' A simple little _LOADFONT replacement
_Font f: _PrintString (0, 0), "Hello World" ' except here, we specify the font's name (not FILE NAME)
_Font 16: _FreeFont f
f = ReturnFont("Courier New", 20, "Bold") ' and we can set the style which we want for the font.
_Font f: _PrintString (0, _FontHeight), "Hello World"
_Font 16: _FreeFont f
f = ReturnFont("Courier New", 20, "Italic")
_Font f: _PrintString (0, _FontHeight * 2), "Hello World"
_Font 16: _FreeFont f
f = ReturnFont("Courier New", 20, "Bold,Italic")
_Font f: _PrintString (0, _FontHeight * 3), "Hello World"
_Font 16: _FreeFont f
f = ReturnFont("Consola", 20, "")
_Font f: _PrintString (0, _FontHeight * 5), "Hello World"
_Font 16: _FreeFont f
f = ReturnFont("Consola", 20, "Bold")
_Font f: _PrintString (0, _FontHeight * 6), "Hello World"
_Font 16: _FreeFont f
f = ReturnFont("Consola", 20, "Italic")
_Font f: _PrintString (0, _FontHeight * 7), "Hello World"
_Font 16: _FreeFont f
f = ReturnFont("Consola", 20, "Bold,Italic")
_Font f: _PrintString (0, _FontHeight * 8), "Hello World"
_Font 16: _FreeFont f
f = ReturnFont("Source Code Pro", 20, "Medium")
_Font f: _PrintString (0, _FontHeight * 10), "Hello World"
_Font 16: _FreeFont f
'$INCLUDE:'..\Library Files\Toolbox.BM'