What's Been Removed?
MudgeFont is a bitmapped font generator tool. You tell it
what size bitmap you want, specify the font (face, height, weight, padding),
and it will generate all the data you need to render that font on screen.
MudgeFont was originally written by Tom van Dijck, and was posted to Flipcode as the
Code Of The Day on May 19th, 2003:
Mr. van Dijck then created a SourceForge project for it
proceeded to drop off the face of the earth. This is unfortunate,
because MudgeFont had a couple of flaws. But!
MudgeFont came with full source, so I was able to fix
everything major, and even add some features. And now I've
released all my fixes to you, the general public. How lucky you are!
My MudgeFont web page is here:
And you can download a fresh copy of the source code (with a prebuilt binary) here:
Everybody likes screenshots. So here are a couple of exciting action shots of MudgeFont actively in action!
Mudgefont working over a lovely Futura medium font as a 256x256 texture.
Mudgefont operating on the same Futura medium font, but this time as a 512x512 texture.
Since that affords you lots more space, I've made the font larger as a result.
I also turned on "Show Rectangles" so you can see the characters delimited.
Mudgefont still on the same Futura medium font, but this time I've turned
on "Force Monospaced" (and reduced the font size accordingly).
Restored the font to proportionally-spaced, and added some extra border padding
below the '/' character (on the top line).
Here is the complete list of changes I've made to the original MudgeFont source:
The original tool filled in the generated bitmap with white,
then overdrew it with all the characters from the font. But the
border around each character was left alone. This meant that in the
final bitmap there were white boxes around every character. And since
the TGA exporter used the bitmap pixel's color to determine the resulting
pixel's transparency, these boxes was propogating to the TGA file, which
showed up in the output now and then due to rounding errors in computing
the texels. I changed it so the bitmap is seeded with black.
Similarly, the original tool wrote out its TGA file with entirely
white pixels, using only the alpha channel to carve out the characters.
This meant that Photoshop displayed the resulting TGA as a unbroken field
of white, and the only tool I had handy that displayed it properly was
DXTexTool. I changed the exporter so that 100% transparent pixels were
black, leaving all other pixels as white. This doesn't look perfect
in Photoshop, but it yields the general idea. (Why not scale the white
by the transparent color? Just in case you actually render the font
texture, instead of say using a diffuse color or another texture.)
I changed all the "border" controls to accept a range from -255 to 255.
They used to only go from 0 to 16. This means you can squeeze out wasted
pixels on the top and bottom of each character, which means you can get
higher resolution characters for the same size bitmap.
I added "top" and "bottom" border adjustments for individual characters.
(I used this to add some extra space below _ in one font so it wouldn't
bump into the character underneath it.)
It used to be that you could only "Add Characters" to the list of
characters... if you wanted to delete characters, or rearrange them,
you were out of luck. Now it's a full-fledged "Edit Characters" dialog,
where you can add or remove characters at whim.
And it's got a nice big easy-to-read monospaced font, so it's easy to work with.
I made the dialog box larger, so that now an entire 512x512 texture will
fit in the preview window without scrolling around.
I added "Force Monospaced", which forces any font to be a monospaced
font. Specifically, it forces all characters to be as tall as the
tallest character, as wide as the widest character, and it centers each
character horizontally (but not vertically) in this space. New in version
1.0.3: "Force Monospaced" now allows you to force monospacing individually
for the X or Y axes.
Note: After I added this feature, I realized that you can easily
convert any font into a monospaced fonts from your font engine. Just draw
each character as wide as the widest character, centering it in the extra
space. (That's all my "Force Monospaced" code in MudgeFont did, anyway.)
Turning on "Force Mononspaced" means wasting precious space in your texture,
pixels which would be much better spent making your fonts look good. I suggest
you don't use it. But I've left it in, in case you have texture space to burn
and for some reason you can't modify your font loader.
I fixed the file loader so that it changes the texture height & width
radio buttons to match the file as loaded.
I changed the crosshatch filled into unused area of the bitmap view
to use lovely purple colors instead of just black and gray. Similarly,
I changed the rectangles drawn by "Show Rectangles" to be green instead
of gray. Now you can tell which is what, where!
I expunged all warnings generated during compilation.
I changed everything that said "mudFont" to say "MudgeFont".
All relevant files and identifiers. Mr. van Dijck was a bit
inconsistent about whether the tool was "mudFont", "MudgeFont",
or "mudGE Font builder". And sadly, a foolish consistency is
the hobgoblin of my small mind. Also, this helps distinguish
this new version from the old
mudfont files that
are surely even now cluttering up your hard drive.
I changed the file extension from ".fnt" (bad choice, that's
the original extension for bitmapped font files for Windows)
I changed the File Save and File Export code so it automatically
generates a filename for youthe filename that, 99% of the
time, you were going to type in anyway. I also turned off the
"Are you sure?" alert boxes, 'cause they irritate me. (Yes,
I'm sure! Stop asking!)
I cleaned up the menu. I added ellipses to every menu item
that brings up a dialog box, and added the Help menu (which
only contains an About dialog and a link that launches you
to the MudgeFont home page).
I converted the .TGA export code to write a packed struct
directly to the file, instead of the hand-coded "write this
field now write that field" code.
I added a Python script,
mudgefontxmlto.py, which makes it
easy to convert the XML file into another format. Currently it supports
three formats: INI, C, and my own funny text file format "Twiddle".
Feel free to hack it up so it writes the file format you need. Just
create a new subclass of
writer and overload the
write(), and (optionally)
close() methods as you
need. If you know any Python at all (and you should!) you won't have
Just one thing so far: I've disabled the hacked-up downsampling
A Flipcode user named "Steven Wittens" posted to the discussion
saying it was a bad idea:
Never, ever, EVER anti-alias text by downsampling a high-resolution version.
This is exactly what has caused a lot of people to dismiss text anti-aliasing
as simple blurring. By downsampling, edges will lie on half-pixel offsets
and will become blurry.
Sounds right to me. For now, the field is still supported; it's just that
the controls on the dialog box have been disabled. It'll probably be
completely removed in a future revision (if there ever is one).
A properly anti-aliased letter will still have sharp, crisp edges, but also
smooth curves where necessary. This is done through hinting, and all this
work is destroyed if you downsample.
Probably not a lot. MudgeFont now does everything that I need,
and is pretty well behaved. It has some warts, but nothing
I haven't gotten used to. So I'm not likely to spend a lot of time
on it from here on out.
That said, I'd welcome submissions. Or, heck, even notes of thanks.
(Haven't gotten a single email about MudgeFont... you people sure are quiet!)
Here is the original license that shipped with MudgeFont:
* Copyright (c) 2003 mudGE Entertainment
* This software is provided 'as-is', without any express or implied warranty.
* In no event will the authors be held liable for any damages arising
* from the use of this software.
* Permission is granted to anyone to use this software for any purpose,
* including commercial applications, and to alter it and redistribute
* it freely, subject to the following restrictions:
* 1. The origin of this software must not be misrepresented;
* you must not claim that you wrote the original software.
* If you use this software in a product, an acknowledgment
* in the product documentation would be appreciated but is not required.
* 2. Altered source versions must be plainly marked as such, and must
* not be misrepresented as being the original software.
* 3. This notice may not be removed or altered from any source distribution.
I have added the following rider:
** Changes Copyright 2004 Larry Hastings
** All my changes are released with the same license as the above.
In non-legalese, this license allows you to do anything you like with the software,
except claim that you wrote the original version.
Saturday, September 11th, 2004
Changed the "Add Characters" dialog into the wonderful "Edit Characters" dialog.
Added top and bottom border offsets for individual characters. This meant I needed
to store more data in the middle of the save file, which in turn meant...
Changed the save file format. Now if the first character is a zero, it means
it's a versioned file. And while I was at it...
Changed the default file extension from ".fnt" to ".mudge".
Changed "Force Monospaced" from a simple checkbox to a list,
where you can choose from four options: "Proportionally-spaced",
"Force Monospaced In X", and
"Force Monospaced In Y".
Changed the save dialog boxes so they generate the filename for you and don't
prompt you with "are you sure?".
Cleaned up the menu; added ellipses to items that bring up dialog boxes,
and created the Help menu (which only has two entries).
Changed the TGA file writer for File Export code to use a packed struct.
Disabled the drop-down list that allowed you to turn on "anti-aliasing"
(aka "downsampling from a higher-resolution version"). All it did was make
your font blurrier around the edges.
Added an ugly icon. Maybe I'll do a better one someday.
Sunday, February 29th, 2004
Added "Force Monospaced".
Changed color of "Show Rectangles" rectangles to green.
Stands out better against the black/white font, dontcha think?
Changed color of unused font background area from cyan
to purple, so the green "Show Rectangles" stand out better.
Thursday, February 19th, 2004
The initial public release of my upgraded version.
Monday, May 19th, 2003
Tom van Dijck's initial public release.
Happy font generating!