freetype-devel
[Top][All Lists]
Advanced

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

Re: [ft-devel] Incomplete cmap table for platform 0 (Apple Unicode)


From: mpsuzuki
Subject: Re: [ft-devel] Incomplete cmap table for platform 0 (Apple Unicode)
Date: Mon, 1 Oct 2007 11:04:29 +0900

Hi,

On Sun, 30 Sep 2007 21:13:00 +0900
"Dmitry Timoshkov" <address@hidden> wrote:
>http://bugs.winehq.org/show_bug.cgi?id=9840 has a ttf font attached
>to it which can be perfectly displayed in Windows, but Wine is not able
>to actually show any character using this font, only 'c' is displayed.

Thank you for providing the sample font. It seems that
the first cmap (platformID, platformSpecificID) = (0, 0)
= (Unicode, Default Semantics) is not broken, but designed
to ignore most of glyph. Its contents is like this:

[cmap]    format = 4, length=0x007a, languageID=0x0000(unknown)
  startCode=0x0022, endCode=0x0022, idDelta=0x0036, idRangeOffset=0x0000
  startCode=0x0026, endCode=0x0027, idDelta=0x0000, idRangeOffset=0x0012
  startCode=0x002c, endCode=0x002c, idDelta=0x0025, idRangeOffset=0x0000
  startCode=0x002e, endCode=0x002f, idDelta=0x0000, idRangeOffset=0x0012
  startCode=0x003b, endCode=0x003c, idDelta=0x0000, idRangeOffset=0x0014
  startCode=0x003e, endCode=0x003e, idDelta=0x0021, idRangeOffset=0x0000
  startCode=0x005b, endCode=0x005d, idDelta=0x0000, idRangeOffset=0x0014
  startCode=0x0060, endCode=0x0060, idDelta=0xfff5, idRangeOffset=0x0000
  startCode=0x007b, endCode=0x007e, idDelta=0x0000, idRangeOffset=0x0016
  startCode=0xffff, endCode=0xffff, idDelta=0x0001, idRangeOffset=0x0000

  subtable0 cmap fmt4 : code 0x0022 -> gid 0x0058(88) glyfLength=22
  subtable0 cmap fmt4 : code 0x0026 -> gid 0x0053(83 = 83 + 0) glyfLength=0
  subtable0 cmap fmt4 : code 0x0027 -> gid 0x0052(82 = 82 + 0) glyfLength=18
  subtable0 cmap fmt4 : code 0x002c -> gid 0x0051(81) glyfLength=20
  subtable0 cmap fmt4 : code 0x002e -> gid 0x0054(84 = 84 + 0) glyfLength=14
  subtable0 cmap fmt4 : code 0x002f -> gid 0x0056(86 = 86 + 0) glyfLength=16
  subtable0 cmap fmt4 : code 0x003b -> gid 0x0061(97 = 97 + 0) glyfLength=24
  subtable0 cmap fmt4 : code 0x003c -> gid 0x0060(96 = 96 + 0) glyfLength=22
  subtable0 cmap fmt4 : code 0x003e -> gid 0x005f(95) glyfLength=22
  subtable0 cmap fmt4 : code 0x005b -> gid 0x0059(89 = 89 + 0) glyfLength=20
  subtable0 cmap fmt4 : code 0x005c -> gid 0x0057(87 = 87 + 0) glyfLength=16
  subtable0 cmap fmt4 : code 0x005d -> gid 0x005a(90 = 90 + 0) glyfLength=20
  subtable0 cmap fmt4 : code 0x0060 -> gid 0x0055(85) glyfLength=14
  subtable0 cmap fmt4 : code 0x007b -> gid 0x005e(94 = 94 + 0) glyfLength=52
  subtable0 cmap fmt4 : code 0x007c -> gid 0x005d(93 = 93 + 0) glyfLength=14
  subtable0 cmap fmt4 : code 0x007d -> gid 0x005c(92 = 92 + 0) glyfLength=52
  subtable0 cmap fmt4 : code 0x007e -> gid 0x005b(91 = 91 + 0) glyfLength=0
  subtable0 cmap fmt4 : code 0xffff -> gid 0x0000(0) glyfLength=0

In HUDfont.ttf, most alphabets have glyphIndex < 81,
so this cmap cannot access them. One of the problem
is that the cmap is NOT broken in the viewpoint of
the data structure, so non-intellectual validator
(that does not compare the coverage of accessible glyph
and the coverage of included glyph) cannot refuse it.

Your patch assumes that Apple Unicode cmap is often
broken but others are more reliable, but I'm afraid
that this is not generic assumption.

>That's because Freetype selects first unicode cmap table which happens
>to be with platform id 0 (Apple Unicode), and that cmap table is incomplete
>(or truncated). cmap tables for other platforms (1 and 3) are good, and
>making Freetype ignore cmap with platform id 0 makes the font display
>properly in Wine's notepad.
>
>Attached is the hack that makes Freetype ignore cmaps with platform id 0.
>
>What Freetype developers think about this problem?

Excuse me, do you think the selection of best cmap is
the role of FreeType? I think, FreeType2 provides an
API for users to select cmap subtable by the pair of
platformID & platform-specificID.
http://www.freetype.org/freetype2/docs/reference/ft2-base_interface.html

I think, it's better for Wine to have internal priorities
of "prefered" cmap and try to load from the best to
the worst. For example, thinking about UCS-4 capable fonts
(like SURSONG.TTF or SIMSUN-EXTB.TTF). Such fonts have
cmap subtables for Microsoft UCS2, and Microsoft UCS4.
Usually Microsoft UCS4 cmap subtable appears after MS
UCS2 cmap subtable. So, if we let FreeType to choose the
cmap subtable automatically, we cannot reach Microsoft
UCS4 cmap subtable, even if we ignore Apple Unicode.
>From the viewpoint of compatibility with Microsoft products,
it's not good idea.

So, I think, it's better for Wine to have internal priorities
of "prefered" cmap subatble and choose the best cmap subatble
by himself. How do you think of?

Regards,
mpsuzuki





reply via email to

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