Re: We are not the only ones ...

From: Erik van der Poel (
Date: Sun Apr 18 1999 - 00:05:11 EDT

"F. Avery Bishop" wrote:
> I found out
> after the aticle went to press that some of those functions had bugs in
> Windows 95 that were fixed in Windows 98.

Yes, I've been told that the B7 bug was fixed in Win98-J, and our app
does not crash there, so that makes sense.

> After all is
> said and done, converting to ANSI and using the A routine is probably the
> easiest thing to do.

Actually, in our case, that is not such a trivial thing to do. The new
Mozilla (5.0-to-be) uses Unicode internally, so being able to pass
Unicode strings directly to the W functions is great.

If I had to call the A routines, I would have to look not only at the
glyph repertoire of the font (which I am already doing), but also at the
character repertoire of each of the font's charsets (*_CHARSET). For
each charset supported by the font, I would have to compute the
intersection of the font's glyph repertoire and the charset's character
repertoire (since some people don't have the euro glyph in all fonts
yet), and then switch among the font's charsets (and among fonts
themselves) to measure/draw Unicode strings. Not impossible, but I'd
rather not have to do that...

> If it only fails on 00b7 when passed as a single character, it seems you
> could hack a solution using a string with 00b7 plus one other character
> whose height is known to be less than that of 00b7, and then subtract off
> the width of that other character.

It also crashes when B7 is one of several characters passed to the
routine. However, B7 is the only Unicode that crashes the routine on its
own. On the other hand, 17D and 17E seem to crash it only when
accompanied by neighboring characters.

> This assumes the font you're using
> doesn't kern, and there's no other typographical interaction between the
> other character and 00b7. By the way, have you tried GetCharWidthsW? It
> might work OK, assuming you only need widths.

Yes, at the point(s) where we call GetTextExtentPoint32W, we are only
interested in the width. I tried GetCharWidthW, and it works fine. One
concern with this is kerning. I'm hoping I don't have to worry about
kerning. If I make sure that this code is only used on Win95-J, then
maybe it's not so bad if it doesn't kern (for measurement, not drawing).

> The other workaround is a pain, but it should work: Use GetFontData to query
> the glyph widths directly from a table in the true type font file; in this
> case the smallGlyphMetrics table should do.

I hope GetCharWidthW will suffice...

> You have to know a lot about the
> TTF file format to get this to work -- see
> for details.

Yes, I am already a little familiar with the TrueType file format. I
needed to study that to get my font glyph repertoire code working
properly (to do font switching (in MS terminology, font linking)). I
noticed that Win2000 will have a nice little routine called
GetFontUnicodeRanges. :-)

> Sorry I'm not more help than this.

No, you've been very helpful. You reminded me to take a closer look at
GetCharWidthW. I'm hoping it will get me close enough to where I want to


This archive was generated by hypermail 2.1.2 : Tue Jul 10 2001 - 17:20:45 EDT