Here is a collection of routines that allow the loading, displaying of, and putting into bitmaps of bitmapped fonts (ie fonts that are stored in a bitmap)
+ Code Snippetfunction putCharIntoBitmap(bm as integer,_
img as integer,_
width as integer,_
string$ as string)
if string$""
create bitmap bm, len(string$)*width, width
set current bitmap bm
writeFontChars(string$,0,0,width)
get image img,0,0,len(string$)*width,width,1
set current bitmap 0
delete bitmap bm
endif
endfunction
function writeFontChars(str as string,_
x as integer,_
y as integer,_
width as integer)
one as integer
a as integer
if str""
for one=1 to len(str)
a=asc(mid$(str,one))
select a
case 32 : rem A Space
endcase
case default : if image exist(a)
paste image a,x+((one-1)*width),y,1
endif
endcase
endselect
next one
endif
endfunction
function createFont(width as integer,_
height as integer,_
charXWidth as integer,_
charYWidth as integer,_
charXOffset as integer,_
charYOffset as integer,_
charXStep as integer,_
charYStep as integer,_
filename as string,_
chars as string)
xLoop as integer
yLoop as integer
pos as integer
load bitmap filename,1
set current bitmap 1
pos=1
for y=0 to height-1
for x=0 to width-1
if pos>len(chars) then exitfunction
get image asc(mid$(chars,pos)),_
(x*charXStep)+charXOffset,_
(y*charYStep)+charYOffset,_
(x*charXStep)+charXOffset+charXWidth,_
(y*charYStep)+charYOffset+charYWidth,_
1
inc pos
next x
next y
set current bitmap 0
delete bitmap 1
endfunction
Here is a small test program
+ Code Snippetset display mode 800,600,32
createFont(9,5,_
32,32,_
1,1,_
34,34,_
"E:\Users\Nicholas\Bitmap fonts\32_32V3.BMP",_
"ABCDEFGHIJKLMNOPQRSTUVWXYZ 0123456789,.-'():!")
writeFontChars("HELLO",32,32,32)
wait key
Any other versions will be on my web site.