Bitmap fonts in Cocoa apps, line-height bug
Bitmap fonts in Cocoa apps, line-height bug
- Subject: Bitmap fonts in Cocoa apps, line-height bug
- From: Tobia Conforto <email@hidden>
- Date: Mon, 17 Mar 2008 13:10:23 +0100
Hello
I would like to know what are the best practices and recommended
programs for preparing bitmap fonts for use in Cocoa applications.
I'm also reporting what is probably a bug in either OS X or the
available font editors.
If there is a list better suited to this question, please point me to
it.
I'm trying to convert the well known X11 fixed unicode fonts to a
format usable in Cocoa text editors and terminal programs. These
fonts are available under a free license on Markus Kuhn's website: http://www.cl.cam.ac.uk/~mgk25/ucs-fonts.html
and are provided in source BDF format.
I tried using the free editor Fontforge to convert 9x18.bdf into a so-
called (by Fontforge) "Apple bitmap-only .dfont" format. Mostly it
works, but I've run into a problem that Fontforge's programmers can't
solve. See this thread on their list:
http://www.nabble.com/BDF-to-Apple-bitmap-only-dfont,-wrong-line-height-td15155775.html
The problem is that the generated dfont is rendered by OS X with 4px
of additional ascent (or line-height) and we can't figure out where it
comes from. If I convert only the ASCII subset of the original
Unicode font, the line-height is correct. As soon as I add more than
a couple of non-ASCII characters, the 4px bug comes out.
I tried doing the same conversion using a trial version of the
commercial BitFonter 3.0 editor ($500) and I got the same results as
with Fontforge.
I looked into the .dfont file with a hex editor, using this manual as
a reference http://developer.apple.com/textfonts/TTRefMan/ but I
couldn't find anything out of place.
Here is a zip http://gruppo4.com/~tobia/osx-font-problem.zip where
I've put two OS X dfont files I created from 9x18.bdf, using
Fontforge, plus a text file with the font tables I extracted using the
hex editor.
In "test3" I converted the full Latin 1 charset (Unicode points < 256)
and it shows the 4px bug; in "test7" I deleted all glyphs other than
ASCII and a couple of Latin 1 accented letters, and it displays
correctly in all Cocoa apps.
What am I doing wrong? What's different in the two files? Can you
replicate this bug? Is this a bug in OS X, a weird setting in the
original BDF, or a bug shared between Fontforge and BitFonter?
Can you think of any workaround or alternative program I could try?
Any input will be appreciated
Tobia
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden