Last Comment Bug 702505 - ots is stripping out GPOS/GSUB tables for Caflisch Script Pro
: ots is stripping out GPOS/GSUB tables for Caflisch Script Pro
Status: RESOLVED FIXED
:
Product: Core
Classification: Components
Component: Graphics (show other bugs)
: Trunk
: All All
: -- major (vote)
: mozilla11
Assigned To: Jonathan Kew (:jfkthame)
:
:
Mentors:
http://people.mozilla.org/~jdaggett/t...
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2011-11-14 18:46 PST by John Daggett (:jtd)
Modified: 2012-02-01 13:57 PST (History)
0 users
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Attachments
list of Adobe Font Folio 11 fonts that are rejected by ots (5.43 KB, text/plain)
2011-11-14 20:29 PST, John Daggett (:jtd)
no flags Details
list of Adobe Font Folio 11 fonts that are rejected by ots (10.74 KB, text/plain)
2011-11-14 20:33 PST, John Daggett (:jtd)
no flags Details
list of fonts with errors in Adobe Font Folio 11 (181.01 KB, text/plain)
2011-11-14 20:40 PST, John Daggett (:jtd)
no flags Details
patch, don't reject fonts for the presence of 'size' in GPOS (877 bytes, patch)
2011-11-15 15:05 PST, Jonathan Kew (:jfkthame)
jd.bugzilla: review+
Details | Diff | Splinter Review

Description John Daggett (:jtd) 2011-11-14 18:46:22 PST
Steps to reproduce:

1. Load URL

Result: contextual shaping and alternates are disabled

With OTS debugging enabled:

ERROR at /builds/mozcentral/gfx/ots/src/layout.cc:158 (bool<unnamed>::ParseFeatureTable(const uint8_t*, size_t, uint16_t))
ERROR at /builds/mozcentral/gfx/ots/src/layout.cc:1263 (bool ots::ParseFeatureListTable(const uint8_t*, size_t, uint16_t, uint16_t*))
WARNING at /builds/mozcentral/gfx/ots/src/gpos.cc:771: faild to parse feature list table
WARNING at /builds/mozcentral/gfx/ots/src/layout.cc:398: glyph range is overlapping.
ERROR at /builds/mozcentral/gfx/ots/src/layout.cc:399 (bool<unnamed>::ParseCoverageFormat2(const uint8_t*, size_t, uint16_t))
ERROR at /builds/mozcentral/gfx/ots/src/layout.cc:1142 (bool<unnamed>::ParseChainContextFormat3(const uint8_t*, size_t, uint16_t, uint16_t))
ERROR at /builds/mozcentral/gfx/ots/src/layout.cc:1429 (bool ots::ParseChainingContextSubtable(const uint8_t*, size_t, uint16_t, uint16_t))
ERROR at /builds/mozcentral/gfx/ots/src/layout.cc:1159 (bool ots::LookupSubtableParser::Parse(const ots::OpenTypeFile*, const uint8_t*, size_t, uint16_t) const)
ERROR at /builds/mozcentral/gfx/ots/src/layout.cc:248 (bool<unnamed>::ParseLookupTable(ots::OpenTypeFile*, const uint8_t*, size_t, const ots::LookupSubtableParser*))
ERROR at /builds/mozcentral/gfx/ots/src/layout.cc:1307 (bool ots::ParseLookupListTable(ots::OpenTypeFile*, const uint8_t*, size_t, const ots::LookupSubtableParser*, uint16_t*))
WARNING at /builds/mozcentral/gfx/ots/src/gsub.cc:626: faild to parse lookup list table

The test uses Adobe's Caflisch Script Pro so I have a feeling the OTS code is wrong but I haven't looked at it closely yet.
Comment 1 John Daggett (:jtd) 2011-11-14 20:29:31 PST
Created attachment 574522 [details]
list of Adobe Font Folio 11 fonts that are rejected by ots

OTS is rejecting 926 out of 3320 Postscript CFF fonts in Font Folio 11.
Comment 2 John Daggett (:jtd) 2011-11-14 20:33:13 PST
Created attachment 574524 [details]
list of Adobe Font Folio 11 fonts that are rejected by ots

Argh, was counting errors, not fonts with errors:

163 fonts out of 3320 are rejected, not the number in the comment above.
Comment 3 John Daggett (:jtd) 2011-11-14 20:40:55 PST
Created attachment 574526 [details]
list of fonts with errors in Adobe Font Folio 11
Comment 4 John Daggett (:jtd) 2011-11-14 20:45:14 PST
How to build the standalong ots tool:
http://code.google.com/p/ots/wiki/HowToTestOts

1. Get ots source
svn checkout http://ots.googlecode.com/svn/trunk/ ots

2. Get gyp source
svn checkout http://gyp.googlecode.com/svn/trunk/ gyp

3. Build the standalone tool (OSX version)
$ gyp --depth=. -f xcode ots-standalone.gyp
$ xcodebuild -configuration Default -project ots-standalone.xcodeproj -target All

4. Run the tool over the font set
for f in ~/fontfolio11/*.otf; do echo $f; build/Default/idempotent $f; done &>fontfolio11.out
Comment 5 John Daggett (:jtd) 2011-11-14 20:53:21 PST
Docs on the idempotent tool:
http://code.google.com/p/ots/source/browse/trunk/test/README
Comment 6 Jonathan Kew (:jfkthame) 2011-11-15 00:34:01 PST
In both v1.010 and v2.015 of CaflischScriptPro-Regular, there appears to be an error in (at least one of) the GSUB lookup coverage tables: there are glyph ranges in CoverageFormat2 that overlap (i.e. the first glyph ID of a range is the same as the last glyph ID of the preceding range). The spec[1] requires that glyph ranges do not overlap, so OTS is correct to treat this as an error.

This explains the message "WARNING at /builds/mozcentral/gfx/ots/src/layout.cc:398: glyph range is overlapping." and the following errors in comment #0.

It's possible to "fix" this by relaxing the check at gfx/ots/src/layout.cc:398:

    if (start > end || (last_end && start <= last_end)) {
      OTS_WARNING("glyph range is overlapping.");
      return OTS_FAILURE();
    }

If we replace the test "start <= last_end" here by "start < last_end", thus permitting a one-glyph overlap between ranges (when start == last_end), the font loads successfully without discarding the OpenType features. However, this is not correct as per the OT spec.

It appears that the version deployed by TypeKit and used by the test in the URL field may have an additional problem in a GPOS feature table, but this does not occur with either of the versions I have examined as local files.

[1] http://www.microsoft.com/typography/otspec/chapter2.htm
Comment 7 John Daggett (:jtd) 2011-11-15 12:21:41 PST
Changing the condition noted in comment 6 from '<=' to '<' (i.e. to allow a one glyph overlap) reduces the number of failing fonts in Font Folio 11 from 163 to 20.
Comment 8 Jonathan Kew (:jfkthame) 2011-11-15 15:00:44 PST
In addition to the coverage table issue (which is a bug in CaflischScriptPro and other fonts), the GPOS table is rejected by OTS because of the presence (in the version served by typekit) of the 'size' optical-size feature. This is an OTS bug, just filed as http://code.google.com/p/chromium/issues/detail?id=104389.
Comment 9 Jonathan Kew (:jfkthame) 2011-11-15 15:05:05 PST
Created attachment 574706 [details] [diff] [review]
patch, don't reject fonts for the presence of 'size' in GPOS

This fixes the OTS bug that causes fonts with an optical size feature to be rejected; it won't actually make the current Caflisch Script Pro work, however, because of the coverage table issue in that font.
Comment 10 Jonathan Kew (:jfkthame) 2011-11-15 17:22:24 PST
Pushed the patch for GPOS 'size' to mozilla-inbound:
https://hg.mozilla.org/integration/mozilla-inbound/rev/cdf1844ffd59

This will not fully resolve the issue for Caflisch Script Pro, as it _also_ has the Coverage Table bug (see comment 6), so OTS will still discard its layout tables.
Comment 11 Ed Morley [:emorley] 2011-11-16 03:10:39 PST
https://hg.mozilla.org/mozilla-central/rev/cdf1844ffd59
Comment 12 Jonathan Kew (:jfkthame) 2011-11-29 23:07:42 PST
(In reply to Jonathan Kew (:jfkthame) from comment #8)
> In addition to the coverage table issue (which is a bug in CaflischScriptPro
> and other fonts), the GPOS table is rejected by OTS because of the presence
> (in the version served by typekit) of the 'size' optical-size feature. This
> is an OTS bug, just filed as
> http://code.google.com/p/chromium/issues/detail?id=104389.

FTR, this is now fixed upstream in OTS (rev 75).

Note You need to log in before you can comment on or make changes to this bug.