Wintermute Engine Forum

Wintermute Engine => Technical forum => Topic started by: bf5man on March 02, 2003, 09:14:48 PM

Title: Importing Fonts
Post by: bf5man on March 02, 2003, 09:14:48 PM
I'd like to know if there's an easy way to import fonts.
The hard part is to make the bmp and i haven't found a way to do this that took less than three hours  ;).

Thanks.

bf5man.
Title: Re:Importing Fonts
Post by: Mnemonic on March 02, 2003, 09:59:08 PM
Well, I used Windows Notepad to make the default WME fonts ;D

But you might want to check this cute little utility instead:

http://www.lmnopc.com/bitmapfontbuilder/
Title: Re:Importing Fonts
Post by: Scarpia on March 02, 2003, 11:22:58 PM
Well, I used Windows Notepad to make the default WME fonts ;D

You did what??!??

Ehm.. Maybe I'm just a tech nerd, but.... I'm really curious as to how you managed that!??


Scarpia
Title: Re:Importing Fonts
Post by: bf5man on March 02, 2003, 11:31:56 PM
Wow!  :o

That's exactly what i was looking for.

Thanks mister Mnemonic.

bf5man.
Title: Re:Importing Fonts
Post by: Scarpia on March 03, 2003, 01:06:13 AM
Well..... I downloaded the font program, seems nice.. But then I created a 512x512 pixel font and imported it into WME. Somehow, I didn't get a .FONT definition to go with it, and I had no way of creating one...??

{edit} i managed to make a new .FONT by creating it from scratch in Notepad and saving it in the project's Fonts folder -- but that's pretty awkward really, it should be possible to do from the project manager (as in, context menu on font folder, then add font - whoop - automatically a new .FONT file..)


Scarpia


Title: Re:Importing Fonts
Post by: bf5man on March 03, 2003, 02:23:33 AM
Scarpia,
I've got a spacing problem with the letters. Here an exemple: http://cybertechs.qc.ca/prs/mini-baja/font.gif

There's too much spacing and i can't find how to reduce it.

If you find how, tell me please :)

Another question, how can we find the "size" of a variable (the size of the array)?

thanks

bf5man.
Title: Re:Importing Fonts
Post by: Brassfire on March 03, 2003, 12:42:07 PM
No ttf? :(
Title: Re:Importing Fonts
Post by: Mnemonic on March 03, 2003, 02:49:21 PM
You did what??!??

Ehm.. Maybe I'm just a tech nerd, but.... I'm really curious as to how you managed that!??
Heh heh :) Just put all the characters to a text file, opened the file in Notepad and took a screenshot. Of course, I have modified it heavily in Paint Shop afterwards. But it's cool to say I create fonts using Notepad, isn't it? ;)


{edit} i managed to make a new .FONT by creating it from scratch in Notepad and saving it in the project's Fonts folder -- but that's pretty awkward really, it should be possible to do from the project manager (as in, context menu on font folder, then add font - whoop - automatically a new .FONT file..)
I can't test it right now (don't have WME on this computer) but this *should* be possible. Right-click, Add->Add font. If it's not there, something's gone terribly wrong.


I've got a spacing problem with the letters. Here an exemple: http://cybertechs.qc.ca/prs/mini-baja/font.gif
Hmm, could you send me both files? I'll check it out. Do you have the background color set to trasparent (i.e. by default the pink color, RGB(255,0,255)). This seems WME is unable to determine the right edge of the letters (it tests where the trasparent pixels begin).


Another question, how can we find the "size" of a variable (the size of the array)?
Ahem, nope, currently not. It's a bit complicated because the arrays in WME are "sparse arrays". But it could at least return the number of members. I'll do something about it.


No ttf? :(
Nope, no TTF. I always liked the bitmap fonts better. They are easier to edit and TTF's tend to have problems with different codepages...
Title: Re:Importing Fonts
Post by: Scarpia on March 03, 2003, 06:20:24 PM
Mnemonic: Heh, Notepad rocks. I use it all the time. It's cool to say I create pro web sites with DHTML, Javascript and ASP in Notepad ;)

Bf5man: my font started out that way too. Then I found out my problem was I created the BMP with a black background, and since the transparency color in the FONT file was set to pink (255,0,255), the letters were all too far apart. Altering it to (0,0,0) will push your letters closer together. HOWEVER, with my (rather large type) font, the letters are still too far apart. Something tells me the engine adds a number of pixels relative to the column width, and this function seems to be a bit too steep, but I can't tell for sure, as I'm obviously blackboxing here. Jan?


Scarpia
Title: Re:Importing Fonts
Post by: Mnemonic on March 03, 2003, 06:24:19 PM
HOWEVER, with my (rather large type) font, the letters are still too far apart. Something tells me the engine adds a number of pixels relative to the column width, and this function seems to be a bit too steep, but I can't tell for sure, as I'm obviously blackboxing here. Jan?

Hmmmm, by default it shouldn't. Unless you have something like "EXPAND_WIDTH = 1" in your font definition file.
Title: Re:Importing Fonts
Post by: Scarpia on March 03, 2003, 06:35:40 PM
I dont use the EXPAND_WIDTH method. I tried it with negative numbers, but that's no good with wide characters like m's or w's. There is certainly several pixels between characters as it is now, and the BMP is 1-bit B/W, so it should work.

If that isn't it, then I can't figure it out.

Scarpia
Title: Re:Importing Fonts
Post by: Mnemonic on March 03, 2003, 09:58:24 PM
Um, I dunno then. I'd need to see the files to say more...
Title: Re:Importing Fonts
Post by: Mnemonic on March 05, 2003, 09:31:55 PM
Ow, stupid me. I forgot to tell you one important thing: The letters must be left alligned to the grid! The engine only determines the right edge of the letters automatically.
See the attached picture to see what I mean.

This should do the trick; sorry I didn't think of it earlier :-[

(http://www.dead-code.org/misc/font_grid.gif)