Hello,
My recent project: a completely OS independent strictly FB font library.
The .zip linked below contains a 10MB include file with RLE compressed raster font textures.
The included fonts are Calibri, AvenirNext & Consolas and their BOLD versions in sizes 10 -> 100 (in steps of two).
The .bi file also contains a font rendering routine that is extremely easy to use (see DEMO program).
The font rendering routine only holds one texture in RAM and reloads a texture if the size or type-facing changes.
So less changes makes the routine more efficient.
There is an option to include only used fonts / sizes in the executable to keep the executable size as low as possible.
These includes work as follows: (include only the needed fonts and their sizes)
the size should be rounded to a multiple of 2: for example 20, 22, 24 etc.
Add a 'B' to the define to include the BOLD version.
Valid FONT options are CALIBRI, AVENIRNEXT, CONSOLAS
--------------------------------------------------------------------------------------------------
#define "CALIBRI_20" --> includes the font texture for Calibri 20
#define "CALIBRI_20B" --> includes the font texture for Calibri 20 BOLD
etc.
These #defines should be defined BEFORE including fbfnt.bi
font routine pass variables:
.draw_font(buffer as fb.image ptr, x as int, y as int, text as string, color as uinteger, font_name as string, size int, bold boolean)
valid font name options are: "consolas", "avenirnext", "consolas"
size variable will be rounded to the nearest integer / 2
The font render routine will display an error message on location x, y if a font was not included in the executable.
https://1drv.ms/u/s!ArvnuLSK5obmgq1L7vLYyrDVUfSE0g
Have fun
FBFNT.bi --> stricly FB extremely simple font LIB
-
- Posts: 54
- Joined: Jun 29, 2014 17:15
-
- Posts: 54
- Joined: Jun 29, 2014 17:15
Re: FBFNT.bi --> stricly FB extremely simple font LIB
Small update:
Font color would not change if the type facing stayd the same.
Pim
Font color would not change if the type facing stayd the same.
Pim
Re: FBFNT.bi --> stricly FB extremely simple font LIB
Code does not compile in 64-bit (crashes immediately, probably due to a pointer size issue). 32-bit works fine, though.
Re: FBFNT.bi --> stricly FB extremely simple font LIB
I changed all instances of integer with long via wordpad in fbfnt.bi
Then I had to re-change
dim as integer img_w,img_h,pitch in sub font_data.apply_color
and another instance of pitch to integer to satisfy imageinfo
Then it is fine in 64 bits.
I reckon that is the biggest .bi file I have seen, but the resulting fonts look good.
Thank you Pim Scheffers
Then I had to re-change
dim as integer img_w,img_h,pitch in sub font_data.apply_color
and another instance of pitch to integer to satisfy imageinfo
Then it is fine in 64 bits.
I reckon that is the biggest .bi file I have seen, but the resulting fonts look good.
Thank you Pim Scheffers