New Bitmap Font Module
Community Forums/Showcase/New Bitmap Font Module
| ||
Here is a module I made that can display fonts created with the AngelCode Bitmap Font Generator.![]() Download it at: http://www.wieringsoftware.nl/blitz/ |
| ||
Whoooo! This is one of the best and fastest arround! |
| ||
Downloading now! Looks great. |
| ||
b.t.w. 1. is this crossplatform or Win32 only?! 2. can it do warping? (like max 30 chars on 1 line?) 3. i get black non-transparant boxes behind the characters when adding it to my own engine. Your demo however works fine. Whats wrong? (i have setblend alphablend) 4. could you document the module? screenshot: ![]() |
| ||
1. I only tested it in Win32, so I'm not really sure (please let me know if there are problems!). 2. You mean wrapping? I'll probably add that to the next version (along with ALIGN_JUSTIFY) 3. Turn on alpha blending (the function doesn't do that itself, because you could also be using LIGHT_BLEND) 4. It is mostly documented, you probably have to run Rebuild Documentation to integrate it. |
| ||
Ok. thanks! Im really looking forward to the update. About the blending, i said i had ALPHABLEND set :-) Here is the code: 'Font test SetBlend ALPHABLEND SetScale 0.6, 0.6 myBMF.CallBackChars = "<>0123456789" myBMF.SkipChars = "<>" myBMF.DrawText ("<>By using <callback functions>, you can make your text look even prettier! You can use~n" + .. "such a function to change the color of the text and <highlight> something for example ...~n" + .. "~n" + .. "... or move the characters around: 0 1 2 3 4 5 6 7 8 9~n" + .. "~n" + .. "<HAVE FUN!>", 34, 470) SetScale 1, 1 b.t.w. can someone with a Mac reading this, please compile the ready to go BMPFont demo from Wiering and check if it runs with MacOS and/or Linux?! |
| ||
goldstar - in the screenshot you posted it looks fine, i dont see any squares behind the letters, shadows look like they may be turned on. Wiering thanks for the module, |
| ||
goldstar - it's fine, I see the black blocks, looks like a maskimage problem. |
| ||
I am trying to convert the demo to an independent exe by including all of the fnts and pngs as integrated binary files "incbin" but for some rason I get an error when I try to incbin "arial.fnt", I get "unhandleException:attempt to access field or method of Null object" here: Local BMFArial: TBMFont = TBMFont.Create ("incbin::", "Arial.fnt") this is what I changed: Incbin "Arial.fnt" ' load font with textures from file Local BMFArial: TBMFont = TBMFont.Create ("incbin::", "Arial.fnt") any idea what I should do or is it possible? |
| ||
Local BMFArial: TBMFont = TBMFont.Create ("incbin::Arial.fnt")? <edit> this suggests a copyright issue though |
| ||
no. you are assuming it's a true font but it's just the name and is a file created by Angel Code Font Generator. it is used to extract the characters from the png file. |
| ||
Goldstar, sorry I overread that :-) Then you probably have changed AutoImageFlags. Try adding this before creating/initializing the fonts: AutoImageFlags MASKEDIMAGE | FILTEREDIMAGE Jesse, you probably didn't include the two .png files with incbin as well. This works for me: Incbin "Arial.fnt" Incbin "Arial_00.png" Incbin "Arial_01.png" Local BMFArial: TBMFont = TBMFont.Create ("incbin::", "Arial.fnt") |
| ||
yea, thats probably what happened. although, I still haven't tried it. Thanks. [edit] by the way, thans for sharing. Really apreciate it. |
| ||
doh. i forgot to set the maskcolor to 0,0,0. fixed now. |
| ||
Im using bathazar font and I cant get the ' to work. I export it using the font bitmap generator but cant get it to work with the module - it just uses a space instead |
| ||
You can list all the characters in your font like this:For Local i: Int = 0 To BMF.Id.length - 1 Print BMF.Id[i] + ": " + Chr(BMF.Id[i]) Next You'll probably see that Chr(8216) or Chr(8217) is the one you are looking for. You could probably also do something with a callback function and draw a comma at position dy=-10 or so, something like: if Char="<" dy = -10 if Char=">" dy = 0 In your text that would be: ... <,> ... |
| ||
Excellent mod!, thanks a lot Wiering!. I have a problem trying to use it in my game though, for some reason all the letters have an offset, for example i do this: DrawText("x: " + MouseX() + ".. y: " + MouseY(), MouseX(), MouseY()) And the text appears like 100 pixels away from the cursor of the mouse, in both x an y coords, any idea on why this happens???. EDIT: Finally i figured it out, its because i had Automidhandle(true), i put it back to false and there is no problem. |
| ||
Uhm, guys, this doesnt work anymore with the latest version of Angle Font. Can anyone find out how to fix this? The file format seems to have changed a bit... |
| ||
http://www.blitzbasic.com/Community/posts.php?topic=79976#902310 |