Thanks for this Sven B. DB has been lacking in the image manipulation commands department for some time and your plugin is awesome.
I have knocked up a pretty simple bitmap fonts routine using Image Kit - may be of some use to some people:
By way of example I have set up 2 different fonts at 2 different sizes each and included the png files in the attachment - I have also included the photoshop setup file for this layout. Just select all the character layers and change the font - resize the image to create different font sizes.
makebmpfonts()
bmptext(200,10,"Jackdaws love my big sphinx of quartz.",alLeft,fnMedusa22,fsBold,1,-2,1,0.5,0)
bmptext(200,35,"Jackdaws love my big sphinx of quartz.",alCenter,fnMaiandra16,fsBold,0,0,1,1,1)
wait key
end
function makebmpfonts()
global fsNormal : fsNormal = 0
global fsBold : fsBold = 1
global fsItalic : fsItalic = 2
global fsBoldItalic : fsBoldItalic = 3
global fsExtraBold : fsExtraBold = 4
global alLeft : alLeft = 0
global alCenter : alCenter = 1
global alRight : alRight = 2
global fnMaiandra16 : fnMaiandra16 = 200000
makefontset(fnMaiandra16,"maiandra16pt.png",16,16)
global fnMaiandra22 : fnMaiandra22 = 201000
makefontset(fnMaiandra22,"maiandra22pt.png",22,22)
global fnMedusa16 : fnMedusa16 = 202000
makefontset(fnMedusa16,"medusa16pt.png",16,16)
global fnMedusa22 : fnMedusa22 = 203000
makefontset(fnMedusa22,"medusa22pt.png",22,22)
endfunction
function makefontset(basefont,filename as STRING,width,height)
load image filename,basefont,1
makebmpfont(basefont,fsNormal,0,width,height)
makebmpfont(basefont,fsBold,0,width,height)
makebmpfont(basefont,fsItalic,0,width,height)
makebmpfont(basefont,fsBoldItalic,0,width,height)
makebmpfont(basefont,fsExtraBold,0,width,height)
makebmpfont(basefont,fsNormal,1,width,height)
makebmpfont(basefont,fsBold,1,width,height)
makebmpfont(basefont,fsItalic,1,width,height)
makebmpfont(basefont,fsBoldItalic,1,width,height)
makebmpfont(basefont,fsExtraBold,1,width,height)
endfunction
function makebmpfont(basefont,style,outline,width,height)
tempimg = basefont - 1
fontimg = basefont + (style*100) + (outline*500)
for y = 0 to 5
for x = 0 to 15
inc fontimg
copy image fontimg,basefont,(outline*(16*width))+(x*width),(style*(6*height))+(y*height),(outline*(16*width))+width+(x*width),(style*(6*height))+height+(y*height)
ink rgb(255,0,255),0 : box 0,0,width,height : paste image fontimg,0,0,1
leading = width
spacing = 0
for py = 0 to width - 1
for px = 0 to height - 1
if point(px,py) <> rgb(255,0,255)
if leading > px and px < width then leading = px
if spacing < px and px > 0 then spacing = px
endif
next px
next py
if spacing > leading
copy image tempimg,fontimg,leading,0,spacing+1,width
copy image fontimg,tempimg
else
resize image fontimg,(width/2),width,0
endif
next x
next y
endfunction
function bmptext(x,y,caption as STRING,align,font,style,outline as BOOLEAN,tracking,red as FLOAT,green as FLOAT,blue as FLOAT)
tempimg = font-1
font = font + (style * 100) + (outline * 500)
width = 0
height = 0
for c = 1 to len(caption)
chr = font+asc(mid$(caption,c))-31
inc width,image width(chr)+tracking
next c
width = width - tracking
height = image height(chr)
if image exist(tempimg) then delete image tempimg
create image tempimg,width,height
set blend mode 2
xx = 0
for c = 1 to len(caption)
chr = font+asc(mid$(caption,c))-31
paste image on image chr,tempimg,xx,0
inc xx,image width(chr)+tracking
next c
set image brightness tempimg,red,green,blue
if align = alCenter then x = x - floor(image width(tempimg)/2)
if align = alRight then x = x - image width(tempimg)
paste image tempimg,x,y,1
endfunction