freetype-devel
[Top][All Lists]
Advanced

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

[Devel] ftbench.c: fonts that may have multiple cmap entries per glyph


From: Anthony Fok
Subject: [Devel] ftbench.c: fonts that may have multiple cmap entries per glyph
Date: Thu, 26 Sep 2002 17:00:37 +0800
User-agent: Mutt/1.4i

Hello David,

Many thanks for applying (and enhancing) the patches for ttcmap0.c and
ftbench.c.  :-)  I'd just like to offer an alternative viewpoint to your
comment in ftbench.c:

        * src/ftbench.c: the program did perform out-of-bound memory writes
        with certain fonts containing a buggy charmap

        -    while (gindex)
        +
        +    /* certain fonts contain a broken charmap that will map character 
codes */
        +    /* to out-of-bounds glyph indices. Take care of that here !!       
     */
        +    /*                                                                 
     */
        +    while ( gindex && i < face->num_glyphs )

The out-of-bound memory writes was not due to buggy charmap, but rather,
valid (non-buggy) fonts in which one glyph may have multiple charmap
entries, such that: num_charmap_entries > num_glyphs.

For example, a Unicode CJK font may want to fully support U+F900 to U+FA6A
CJK Compatibility Ideographs, where U+F900 is actually U+8C48,
U+F901->U+66F4, etc.  To save space, we need not create duplicate glyph
data, but rather, F900/8C48 could share the same glyph, and so on.

So, an alternate way is to count num_charcodes rather than num_glyphs,
and the following patch provides this alternative.  I don't know which one
you or Vincent Caron prefer.  :-)  (This is not as urgent; if you are too
busy, this can wait until after 2.1.3.)

Anyhow, please do remove the extraneous "i++" in the body of the for loop
right after "/* no charmap, do an identity mapping */", as that left
odd-numbered entries unfilled.  Many thanks!  :-)

Cheers,

Anthony

-- 
Anthony Fok Tung-Ling
ThizLinux Laboratory   <address@hidden> http://www.thizlinux.com/
Debian Chinese Project <address@hidden>       http://www.debian.org/intl/zh/
Come visit Our Lady of Victory Camp!           http://www.olvc.ab.ca/

Attachment: 005-freetype-2.1.2-ftbench.patch
Description: Text document


reply via email to

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