cjk-list
[Top][All Lists]
Advanced

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

Re: [cjk] texlive svn write access Fw: Re: revisiting ttf2tfm and dvipdf


From: Hin-Tak Leung
Subject: Re: [cjk] texlive svn write access Fw: Re: revisiting ttf2tfm and dvipdfmx
Date: Wed, 17 Jul 2013 03:34:46 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:20.0) Gecko/20100101 Firefox/20.0 SeaMonkey/2.17.1

Peter Breitenlohner wrote:
<snipped
I think I have a few issues I'd like to fix,
- segfault and indeterminism in ttf2tfm /freetype1

segfault: which version? A potential segfault was fixed in Nov 2011
for TL'12, but there might be others.  Does this also occur for the
FreeType 2 version (on a 32bit or 64bit system)?  If so I'd appreciate the
input producing the segfault and/or a patch avoiding it.

That's texlive shipped with fedora. It says 20130608 r30832 over all.

The segfault happens with
http://ftp.kh.edu.tw/Linux/CLE/fonts/ttf/big5/wangttf/wcl-01.ttf
when generating subfont 55. (and all its family, 02 - 10).

The command line is simply:
ttf2tfm wcl-01.ttf -P 3 -E 4 -q -w   address@hidden@

This is a regression. It worked 10 years ago I wrote it in cjk/doc/pdfhowto/HOWTO.txt. (and I have the 10-yr-old "something55.tfm")

There is also an *intermittent* floating point exception with the mikachanALL.ttc . (from sourceforge - I am testing again the 10-year-old font as I wrote cjk/doc/pdfhowto/HOWTO.txt, which may be a bit difficult to hunt down an exact copy of - the wcl-01 is the same as on my hard disk from the above url).

I did include gdb trace for both in my original e-mail to Werner but it seems he may have stripped them out when replying so my forward to texlive svn did not have them. I am including them again at the very end. They have source code and line numbers, etc.

indeterminism: see below

The indeterminism is with a few dozen of fonts for half a dozen vendors, so should be easy to reproduce. The two fonts mentioned above, as well as all 4 of the Arphic GPL chinese fonts (the original versions), and msmincho, msgothic, simsun shipped with windows 7 (possibly older versions as well). The command line for those are:

ttf2tfm msmincho.ttc -q -w address@hidden@ , same with msgothic.
ttf2tfm simsun.ttc -q -w           address@hidden@


- the post table issue is in pdftex/dvipdfmx/xdvidpdfmx (see below). Very
  old fonts use 00000000 but really should be treated as 00030000 (which
  is basically no post table).

dvipdfmx/xdvidpdfmx do just that but produce a warning (as they should, such
fonts should be fixed).  Not so sure about pdftex/luatex/xetex, still have
to look what they do (if anything).

All of them do an abort. The two fonts, from the same vendor, are of the win 3.x era. To quote the ttf spec:

"Format 3.0
This format makes it possible to create a special font that is not burdened with a large ‘post’ table set of glyph names. This format specifies that no PostScript name information is provided for the glyphs in this font file. The printing behavior of this forma t on PostScript printers is unspecified, except that it should not result in a fatal or unrecoverable error. Some drivers may print nothing
, other drivers may attempt to print using a default naming scheme.
Windows v3.1 makes use of the italic angle value in the ‘post’ table but does not actually require any glyph names to be stored as Pascal s
trings ."

In any case, I have modified the two fonts with an hex editor and change the 00000000 to 00030000, then they work with both pdftex and dvipdfmx. So they probably should have been version 3 instead.

I see from the ttf spec that version 3 means "no post table" and probably
was "retrofitted" for such fonts without a post table, since version 1 means macintosh order, and version 2 means a full table, (and an obsolete v 2.5 meaning a macitosh subset) and there is no such thing as a version 0. It did have a right minimum size - 32 bytes - so is mostly valid other than the odd version number.

I'd propose treating unknown versions with size 32 bytes as version 3 (which basically means "don't have a post glyph name table" from the above quote of the spec) with a warning rather than abort. The reason being that abort is just rather unpleasant, and if pdftex or dvipdfmx doesn't need any info from a post table, why should they abort?

Not everybody should be required to use a hex editor to modify a "not-needed" byte in some 15-yr-old fonts to use them.

- I am surprised to find that many tfm's change when I run ttf2tfm
repeatedly.  Is it supposed to do that?  (I now store these generated
files in a local git repository, so it is rather noticeable).

Again an example would be helpful. I certainly see no such phenomenon, but
that might be due to the use of uninitialized variables.

See above, for a few examples.

I am not dying to spend time on fixing the segfault, the floating exception, or the indeterminism myself. So if you want to address them yourself, please feel free to do so.

P.S. Here are the locations of segfault and floating point exceptions:

---------------
(gdb) run open/wcl-01.ttf   -P 3 -E 4 -q -w    address@hidden@
Starting program: /usr/bin/ttf2tfm open/wcl-01.ttf   -P 3 -E 4 -q -w    
address@hidden@

Program received signal SIGSEGV, Segmentation fault.
0x000000000041101c in TT_Get_Short () at ./file.c:905
905        getshort = ((Short)CUR_Frame.cursor[0] << 8) |
(gdb) bt
#0  0x000000000041101c in TT_Get_Short () at ./file.c:905
#1 Load_TrueType_Glyph (load_flags=<optimized out>, glyph_index=<optimized out>, glyph=<optimized out>, instance=<optimized out
>)
at /usr/src/debug/texlive-2012/source/libs/freetype/freetype-1.5/lib/ttgload.c:813 #2 TT_Load_Glyph (instance=..., glyph=..., address@hidden, loadFlags=<optimized out>, address@hidden) at /usr/src/debug/texlive-2012/source/libs/freetype/freetype-1.5/lib/ttapi.c:1224 #3 0x00000000004071f1 in readttf (address@hidden, quiet=True, address@hidden)
    at ../../../texk/ttf2pk/ttfaux.c:525
#4 0x0000000000401c86 in main (argc=<optimized out>, argv=<optimized out>) at ../../../texk/ttf2pk/ttf2tfm.c:907
------------

(gdb) run  open-more/mikachanALL.ttc -f 1 -q -w address@hidden@
Starting program: /usr/bin/ttf2tfm open-more/mikachanALL.ttc -f 1 -q -w 
address@hidden@

Program received signal SIGFPE, Arithmetic exception.
0x0000000000407443 in readttf (address@hidden, quiet=True, address@hidden)
    at ../../../texk/ttf2pk/ttfaux.c:262
262        fnt->xheight = properties.os2->sxHeight * 1000 / fnt->units_per_em;
(gdb) bt
#0 0x0000000000407443 in readttf (address@hidden, quiet=True, address@hidden)
    at ../../../texk/ttf2pk/ttfaux.c:262
#1 0x0000000000401c86 in main (argc=<optimized out>, argv=<optimized out>) at ../../../texk/ttf2pk/ttf2tfm.c:907
(gdb) print fnt->units_per_em
$1 = 0
(gdb) print properties.os2->sxHeight
$2 = 6896
(gdb)
--------------




reply via email to

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