freetype-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Devel] CJK 'monospace' fonts and horiAdvance ....


From: Jungshik Shin
Subject: [Devel] CJK 'monospace' fonts and horiAdvance ....
Date: Mon, 12 May 2003 11:46:07 -0400 (EDT)

Hi,

I've just found a bug in Freetype 2.1.2 (I'm sorry I haven't checked the
CVS, yet, but it's likely that it's not yet fixed because 2.1.4rc2 release
note didn't mention it).  Some East Asian fonts have 'monospace' bit/flag
set although they're not literally monospace fonts. (semantically they're
monospace fonts). They're rather dual-width / bi-width fonts. Simply put,
Latin letters and western digits have exactly half as wide as Chinese
characters, Katakana/Hirakana and Hangul syllables. It appears that FT2
is a bit too 'innoncent' to believe that 'monospace' bit/flag being set
means every glyph in a font has the same advance width (horiAdvance). For
CJK fonts, this is not the case. I found this problem while trying to
figure out why fontconfig 2.2 doesn't work as expected while 2.1.90 to
2.1.92 worked correctly (before that, fontconfig made the same assumption
as is made by FT2.). [0]

I propose that for CJK "monospace" fonts, FT2 does the following:

  either
    A. ignore monospace bit and measure individual glyphs

  or

    B. to optimize a bit

  1. measure 10 ASCII digits and 10 Chinese characters for number 1 to 10
     [2]

  2. If the width of glyphs in the former group is all equal and exatly half
     the width of glyphs in the latter, this is a sure sign that
     it's a dual-width font.

  3. For characters with East Asain Width Class [1] of 'N', return
     the width of the first group. For characters with East Asian Width
     class of 'W', return that of the second group.
     For EA W.C. of 'A'(mbiguous), it's likely to be the latter
     in CJK fonts, but to be sure,  measure each glyph.


 Hope this fix will make in 2.1.4


  Best,

    Jungshik



[0] http://fontconfig.org/cgi-bin/bugzilla/show_bug.cgi?id=82
[1] http://www.unicode.org/reports/tr11/
[2] Some Korean fonts don't have Chineese characters at all. If OS2
    lang bit indicates that it's a Korean font, measure instead
    a sequence of 10 characters beginning at U+AC00 with the interval
    of 588 (decimal). That is, U+AC00, U+AC00 + 588, ....,
    U+AC00 + 588 * 9




reply via email to

[Prev in Thread] Current Thread [Next in Thread]