Re: Question on bitmap fonts
Re: Question on bitmap fonts
- Subject: Re: Question on bitmap fonts
- From: Tobia Conforto <email@hidden>
- Date: Tue, 1 Apr 2008 11:24:08 +0200
Aki Inoue wrote:
It appears that this is the intended behavior.
The font contains glyphs that extend beyond the ascender line (the
accented glyphs) and Cocoa automatically adjusts the default line
height accordingly to avoid baseline shifts.
But the font doesn't have any glyphs that extend beyond the ascender
line!
The font is designed for fixed-width 9x18 cells, where the 18px height
is split between a 14px ascent and a 4px descent.
There are no glyphs that go above 14px from the baseline, nor below
-4px. All glyphs fit nicely in the fixed-width cells, and yet when I
put enough characters in the font, the system adds an additional 4px
of ascent: an additional inter-line space that is not occupied by any
glyph and makes the font unusable.
Can you try the two fonts I linked in my previous email, below, and
tell me what is causing the additional spacing? They both have
accented characters, and none of them has any combining chars or other
strange things. Yet one displays the bug and the other works perfectly.
Tobia
On 2008/03/31, at 9:23, Tobia Conforto wrote:
Hello
After 1000 messages to this list and no reply, I'm resubmitting my
question about bitmap fonts, hoping to get any bit of help or any
pointer at all (docs, other mailing lists, etc.)
Basically, 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?
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