[XeTeX] CID-keyed font support?

Dohyun Kim nomosnomos at gmail.com
Fri Jul 18 10:52:14 CEST 2014


2014-07-18 0:00 GMT+09:00 Jiang Jiang <gzjjgod at gmail.com>:
> Hi,
>
> I wonder if this has been discussed before but I have been wondering
> if CID-keyed fonts are supported by XeTeX/xdvipdfmx at all.
>
> Recent release of Source Han Sans [1] brought up the question again.
>
> If you install Source Han Sans CN Regular for instance, the following document:
>
> \font\body="Source Han Sans CN" at 10pt \body
> 测试
> \end
>
> won't work:
>
> (./test.tex [1]
> ** WARNING ** Failed to load ToUnicode CMap for font "SourceHanSansCN-Regular"
> ** WARNING ** Glyph for CID 16719 missing in font
> "/Users/jjgod/Library/Fonts/SourceHanSansCN-Regular.otf".
>  )
>
> The resulting PDF end up having the wrong glyphs.
>

With SourceHanSansKR, I experienced the same thing. Let me share my guess.

The number 16719 in the log above must be a GID. But xdvipdfmx
considers it as CID as shown, so there is a discrepancy between xetex
and xdvipdfmx.  CID and GID may differ when a cid-keyed font includes
a subset of the glyphs specified by ROS (Adobe-Identity-0 in our
case). See http://blogs.adobe.com/CCJKType/2012/04/cid-vs-gid.html .

So I instead tried the so-called "Pan-CJK" font,
SourceHanSansOTF-1.000.zip downloadable at
http://sourceforge.net/projects/source-han-sans.adobe/files/ .  As
this font has full 65535 glyphs under Adobe-Identity-0, CIDs are
identical to GIDs.  In this case, however, xdvipdfmx failed to make
PDF with error message as follows:

xdvipdfmx:warning: Failed to load ToUnicode CMap for font
"SourceHanSans-Regular"
(CID:/Users/nomosnomos/Library/Fonts/SourceHanSans-Regular.otf[LJIICX+SourceHanSans-Regular][CIDFontType0]
xdvipdfmx:fatal: sfnt: Freetype failure...
Output file removed.
 )
Error 256 (driver return code) generating output;

So it seems that we have to do something with xdvipdfmx and/or its
freetype library. The SourceHanSans fonts are sure to have no problem
as they work quite well on my mac OS.

Best,
Dohyun Kim




More information about the XeTeX mailing list