PDA

View Full Version : Creating font.bmp & font.dat makes my head hurt


nigecube
05-09-2005, 07:16 PM
I've been following the guide in the hdlpatch readme.txt regarding adding my own font to a HDL skin.

It reads:

Use Bitmap Font Builder (http://www.lmnopc.com/bitmapfontbuilder/) to
create the needed BMP and DAT files for font patching with the
following settings:

Texture Size: 256x256
Background: 1 1 1
Foreground: 128 128 128
Font Alignment: Left
Character Set: Full ASCII

Save the font image as BMP & Font Widths (Byte Format) DAT using the
same filename (file.bmp + file.dat)

Okay, understood!

However, no matter how many different fonts I try, they always appear as garbage once injected into an .elf. I know it's not my patching method because with somebody else's font.bmp and font.dat files it works perfectly.

All I can assume is that Font Builder is fussy about the choice of font. Any recommendations folks?

darkpoet
05-12-2005, 01:28 PM
I also have tried. Most recently with Garamond and previously with a few fonts I've collected over the years. I followed the program's recommendations to use 32-bit mode and font-smoothing (both in XP and as an option in the program)...

After following the instructions to a T and inserting my new Garamond .bmp and .dat into a pretty plain HDL ELF, it looks so much like garbage on my TV... after looking closely, I realized I could read a few of my games but that certain letters were cut off or completely messed-up, but some still made some sense.

....While searching for info and writing this message, I notice that my font.dat file is 512 bytes.... It should be 256... Hmmm... does that mean... yup, upon hex-editing my font.dat is full of a lot of zeroes... that's double the bits necessary right? 32 bits instead of 16, am I wrong? What do I do to fix it? Hmmmm, I'll try to figure that out and write back...

I looked at the "What's New?" under the "Help Menu" and discovered this (Some non-critical information deleted):

Version 1.9 - Apr 4, 2005
......Changed char width data type from bytes to integer so that it's not the limiting factor when creating huge textures. This will affect any code that used char widths. L+ABC widths are NOT affected by this change.

I'm sure there are more changes buried in there, but I can't remember them at the moment. It's been a while since I worked on this so you'll have to forgive me. ;)

What's that? Changed char width data type... DATA=.DAT ???

Version 1.9 BETA - Oct 08, 2001
This version was created for Westwood Studios for use in Earth & Beyond. This version was never released for public consumption.

Version 1.8 - Sept 27, 2001

Wow, he really hadn't worked on it in a long time...

Version 1.4 - April 1, 2001
Binary font metrics option. Stores the font widths to a .dat file in a 256 item byte array

Well at least I get confirmation it should be 256 bytes...

Inferences: HDLoader was originally made, probably using version 1.8... The publicly available version isn't compatible, and the author isn't likely to include any new options... seeing as how this version is actually probably quite old to him already... he just released it cause he thought he should...

Conclusion: Gonna have to use Version 1.8... Is there anyone out there who actually has it already so I don't have to petition the author to get it?

darkpoet
05-12-2005, 03:50 PM
OK my theory turned out to be accurate, I think. I hex-edited the font.dat file, deleting every second byte (starting with the 2nd byte, all zeroes), and at the end it was 256 bytes. Patched the HDL ELF again, and bam! Magic! It works.

How to reconcile the new BitMapFontBuilder with the HDLoader patcher?

Zero-X, if you read this, would it be possible to add an easy option to your patcher to automatically convert a 512-byte font.dat to 256-byte during the insert process? Or would it be easier to just use the old program...?

Perhaps I could write a QuickBASIC program (the only language I can do) to do the conversion... Dammit, is anyone else (with skillz) reading this thread?

Zer0-X
05-12-2005, 04:05 PM
This is the 1.8 version. If there's any problem in posting this just /dev/null it.

Perhaps I could add a small check into HDLPatch.

coolguycarlos
05-13-2005, 05:03 PM
Has anybody else tried any other application. I was using Bitmap Font Builder and it patched correctly and I had the same issue where it all appeared garbled. I just found out that Bitmap Font Builder will not allow you to edit True Type font. Does anybody else use any other applications to use True Type font.

nigecube
05-13-2005, 05:23 PM
@Darkpoet & Zer0-X

Thanks very much guys. V1.8 has got things working perfectly.

darkpoet
05-14-2005, 04:05 PM
Bitmap Font Builder is what you want for skinning HDLoader using existing fonts, yes... but you wanna edit TrueTypeFont files? Good luck. I've tried. It's difficult. Takes many hours. A lot better to download an existing font. There are tens of thousands available either as freeware, public domain, or included in packages such as Word, WordPerfect (perhaps these are "free use" fonts?) and so on... If you really want a font editor, look at The Bitmap Font Builder homepage, I believe he advises one to use. Or search Google...

And excellent ZeroX - a check would be great... do you think it would be possible to add an automatic "reduction" routine to remove every 2nd byte in 512 byte files...? Because it seems BFB has some pretty neat options (at least on the BMP side) for the new version... I dunno. Does the 1.8 use font-smoothing options?

Perhaps another utility might be more appropriate? I'm not sure what language you use or how easy this would be to do... as I said, I'm only familiar with BASIC due to my younger days with my Vic-20, C64, and DOS 3...

rhisto
05-27-2005, 08:41 AM
OK my theory turned out to be accurate, I think. I hex-edited the font.dat file, deleting every second byte (starting with the 2nd byte, all zeroes), and at the end it was 256 bytes. Patched the HDL ELF again, and bam! Magic! It works.



Looks like your large font was made for progressive overscan (twice the amount of pixel-height since that uses two half-images that quickly alternate on your monitor)

Rhisto

darkpoet
05-28-2005, 11:04 AM
OK this is far from an elegant solution but it does work.

This will change a 512-byte font.dat into a 257-byte file compatible with Zero-X's hdl-patch program... I realize the dat should be 256 bytes but I made this in BASIC (MS PDS actually) and I haven't programmed in years. Anyways, it works and that's the important thing. If you want the source PM me... if you can do something better, please do.