freetype
[Top][All Lists]
Advanced

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

[Freetype] Does this font have a buggy format 4 cmap? :-)


From: Anthony Fok
Subject: [Freetype] Does this font have a buggy format 4 cmap? :-)
Date: Thu, 18 Jul 2002 12:07:33 +0800
User-agent: Mutt/1.4i

Hello all,

I am investigating a font (HKSCS-2001, Arphic Ming, proprietary) and am
trying to get it print HKSCS-2001 characters correctly.

        http://anthony.homelinux.net/~foka/gs/BMIN00L.TTF.bz2

        (Please don't re-distribute it, or I'll be in big trouble.  :-)

FreeType 1 and FreeType 2 can both display this font correctly.  However,
Ghostscript 7.05 seems to have some trouble with it.  Here are two examples:

    http://anthony.homelinux.net/~foka/gs/good.ps.gz
        (Generated with MING_UNI.TTF provided by the ITSD of HK Gov't)

    http://anthony.homelinux.net/~foka/gs/bad.ps.gz
        (Generated with BMIN00L.TTF)

I have been scratching my head over this for quite some time.  My current
hypothesis is that this font's format 4 cmap is a little buggy (overlapping
ranges?) and that gs_ttf.ps isn't handling the overlap "correctly" (i.e.
handling it the same way that MS Windows and FreeType do).  At least, the
final cmap4 tables generated by gs_ttf.ps and fonttools are different.

Anyhow, since I am new to format 4 cmap, I'm asking for help.  :-)
Here is an excerpt of the "gs --DDEBUG all_ac1.ps" log, the part
where gs_ttf.ps is parsing the format 4 cmap, I guess.  :-)

(There are many more ranges before this, but this appear to be the first
place where overlapping occurs):

startCode   endCode     idDelta      idOffset
[...]
scode=40860 ecode=40860 delta=-27162 droff=0  <----- Why same scode
scode=40860 ecode=40860 delta=-22323 droff=0  <----- and same ecode?
scode=40863 ecode=40863 delta=-22090 droff=0
scode=40864 ecode=40864 delta=-27165 droff=0
scode=40866 ecode=40866 delta=-27166 droff=0
scode=40868 ecode=40868 delta=-27167 droff=0
scode=40869 ecode=40869 delta=-23144 droff=0
scode=57344 ecode=61111 delta=22340 droff=0
scode=62211 ecode=62842 delta=21241 droff=0   # Up to U+F57A = glyph18547
scode=62842 ecode=62884 delta=21241 droff=0
scode=62884 ecode=62891 delta=21241 droff=0
scode=62891 ecode=62924 delta=21241 droff=0
scode=62924 ecode=62926 delta=21241 droff=0
scode=62926 ecode=62928 delta=21241 droff=0
scode=62928 ecode=62933 delta=21241 droff=0
scode=62933 ecode=63153 delta=21241 droff=0  # U+F6B1, glyph18858
scode=63153 ecode=63153 delta=16143 droff=0  # U+F6B1, glyph13760
[...]

By the way, in the case of
   scode=40860 ecode=40860 delta=-27162 droff=0  <----- Why same scode 
   scode=40860 ecode=40860 delta=-22323 droff=0  <----- and same ecode?

I.e. the same U+9F9C mapping to both glyph18537 and glyph13698, is it a bug,
or is it a new OpenType feature?  Viewing ftview, I noticed that glyph18537
and glyph13698 are variants for the Chinese character "turtle/tortoise".
Is this some neat glyph substitution stuff in OpenType, or is the font
slightly buggy?  :8-D

For completeness and ease of debugging, I have put up the following files
at http://anthony.homelinux.net/~foka/gs/ too:

    all_ac14_bmin00l.log  (output of "gs -DDEBUG all_ac14.ps" with bmin00l.ttx)
    bmin00l.ttx.gz  (TrueType XML file generated by fonttools, sans glyf table)
    cmap4-bmin00l-from-fonttools.txt  (extracted from bmin00l.ttx)
    cmap4-bmin00l-from-gs.txt         (extracted from all_ac14_bmin00l.log)
    UniCNS-UCS2-H   (extended to cover the latest Adobe-CNS1-4 / HKSCS-2001;
                     good.ps and bad.ps were generated with this UniCNS-UCS2-H)

I used "diff -u cmap4-bmin00l-from-gs.txt cmap4-bmin00l-from-fonttools.txt"
to compare the two.  :-)

Also, if it is not too much trouble to ask, I was wondering if someone would
be willing to revise gs_ttf.ps so that it can handle special format 4 cmap
(e.g. bmin00l.ttf) like FreeType or fonttools does?

Many thanks for all your help!

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/



reply via email to

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