Latest OTS warns on some LTSH tables

Bug #1531508 reported by Dave Crossland
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Ubuntu Font Family
New
Undecided
Unassigned

Bug Description

https://github.com/khaledhosny/ots reports the following non-fatal errors:

ufl/ubuntu/Ubuntu-BoldItalic.ttf
ERROR: LTSH: bad num_glyphs: 1268
ERROR: LTSH: Table discarded

ufl/ubuntu/Ubuntu-LightItalic.ttf
ERROR: LTSH: bad num_glyphs: 1268
ERROR: LTSH: Table discarded

ufl/ubuntu/Ubuntu-Medium.ttf
ERROR: LTSH: bad num_glyphs: 1263
ERROR: LTSH: Table discarded

ufl/ubuntu/Ubuntu-MediumItalic.ttf
ERROR: LTSH: bad num_glyphs: 1268
ERROR: LTSH: Table discarded

Revision history for this message
Mark Shuttleworth (sabdfl) wrote : Re: [Bug 1531508] [NEW] Latest OTS warns on some LTSH tables

Thanks Dave, is it a regression in the latest beta?

Mark

Revision history for this message
Dave Crossland (davelab6) wrote :

No, this is Version 0.80 as served by Google Fonts today. Where can I get the latest beta? :)

Revision history for this message
Mark Shuttleworth (sabdfl) wrote : Re: [Bug 1531508] Re: Latest OTS warns on some LTSH tables

On 06/01/16 17:50, Dave Crossland wrote:
> No, this is Version 0.80 as served by Google Fonts today. Where can I
> get the latest beta? :)

I know a guy :)

Revision history for this message
Paul Sladen (sladen) wrote :

To reproduce:

$ wget http://font.ubuntu.com/download/ubuntu-font-family-0.83.zip && unzip ubuntu-font-family-0.83.zip
$ git clone <email address hidden>:khaledhosny/ots.git && cd ots
$ sed -i -e 's/std=c++11/std=c++0x/' Makefile.am
$ ./autogen.sh && ./configure && make
$ echo ../ubuntu-font-family-0.83/*.ttf | xargs -tn1 ./ot-sanitise
gg/ots/ot-sanitise gg/0.83/ubuntu-font-family-0.83/Ubuntu-BI.ttf
ERROR: LTSH: bad num_glyphs: 1268
ERROR: LTSH: Table discarded
gg/ots/ot-sanitise gg/0.83/ubuntu-font-family-0.83/Ubuntu-B.ttf
gg/ots/ot-sanitise gg/0.83/ubuntu-font-family-0.83/Ubuntu-C.ttf
gg/ots/ot-sanitise gg/0.83/ubuntu-font-family-0.83/Ubuntu-LI.ttf
ERROR: LTSH: bad num_glyphs: 1268
ERROR: LTSH: Table discarded
gg/ots/ot-sanitise gg/0.83/ubuntu-font-family-0.83/Ubuntu-L.ttf
gg/ots/ot-sanitise gg/0.83/ubuntu-font-family-0.83/Ubuntu-MI.ttf
ERROR: LTSH: bad num_glyphs: 1268
ERROR: LTSH: Table discarded
gg/ots/ot-sanitise gg/0.83/ubuntu-font-family-0.83/UbuntuMono-BI.ttf
gg/ots/ot-sanitise gg/0.83/ubuntu-font-family-0.83/UbuntuMono-B.ttf
gg/ots/ot-sanitise gg/0.83/ubuntu-font-family-0.83/UbuntuMono-RI.ttf
gg/ots/ot-sanitise gg/0.83/ubuntu-font-family-0.83/UbuntuMono-R.ttf
gg/ots/ot-sanitise gg/0.83/ubuntu-font-family-0.83/Ubuntu-M.ttf
ERROR: LTSH: bad num_glyphs: 1263
ERROR: LTSH: Table discarded
gg/ots/ot-sanitise gg/0.83/ubuntu-font-family-0.83/Ubuntu-RI.ttf
gg/ots/ot-sanitise gg/0.83/ubuntu-font-family-0.83/Ubuntu-R.ttf

Revision history for this message
Paul Sladen (sladen) wrote :

On Monday a 'Ubuntu_0.831.zip' was handed to me (initially without any content/context…); these have been processed by DM with 'ttx' to change the name-table mapping, but exhibit the same warning, so it's something flagging up beyond a rebuild:

$ echo ../Ubuntu_0.831/Ubuntu-*.ttf | xargs -tn1 ./ot-sanitise
./ot-sanitise ../Ubuntu_0.831/Ubuntu-BI.ttf
ERROR: LTSH: bad num_glyphs: 1268
ERROR: LTSH: Table discarded
./ot-sanitise ../Ubuntu_0.831/Ubuntu-B.ttf
./ot-sanitise ../Ubuntu_0.831/Ubuntu-C.ttf
./ot-sanitise ../Ubuntu_0.831/Ubuntu-LI.ttf
ERROR: LTSH: bad num_glyphs: 1268
ERROR: LTSH: Table discarded
./ot-sanitise ../Ubuntu_0.831/Ubuntu-L.ttf
./ot-sanitise ../Ubuntu_0.831/Ubuntu-MI.ttf
ERROR: LTSH: bad num_glyphs: 1268
ERROR: LTSH: Table discarded
./ot-sanitise ../Ubuntu_0.831/Ubuntu-M.ttf
ERROR: LTSH: bad num_glyphs: 1263
ERROR: LTSH: Table discarded
./ot-sanitise ../Ubuntu_0.831/Ubuntu-RI.ttf
./ot-sanitise ../Ubuntu_0.831/Ubuntu-R.ttf

Revision history for this message
Dave Crossland (davelab6) wrote :

On 6 January 2016 at 13:49, Paul Sladen <email address hidden> wrote:

> $ sed -i -e 's/std=c++11/std=c++0x/' Makefile.am
>

Does that need to be a PR upstream?

Revision history for this message
Paul Sladen (sladen) wrote :

And the test release/0.84 beta presently testing in X (but not in Google Fonts) :

$ COLUMNS=120 dpkg -l ttf-ubuntu-font-family | awk '{print $2,$3}' | tail -n1
ttf-ubuntu-font-family 0.84~mono0.83+arabicfont

$ dpkg -L ttf-ubuntu-font-family | grep '.ttf$' | xargs -tn1 ./ot-sanitise 2>&1 | sed -e 'sX/u.*/XX'
./ot-sanitise Ubuntu-RI.ttf
./ot-sanitise UbuntuMono-RI.ttf
./ot-sanitise Ubuntu-C.ttf
WARNING: glyf: 2-bytes indexing is not possible (due to the padding above)
./ot-sanitise Ubuntu-Arabic_B.ttf
ERROR: Layout: DFLT script doesn't satisfy the spec. LangSysCount is not zero: 15
ERROR: Layout: Failed to parse script table 0
ERROR: GPOS: Failed to parse script list table
Failed to sanitise file!
./ot-sanitise Ubuntu-BI.ttf
./ot-sanitise Ubuntu-MI.ttf
./ot-sanitise UbuntuMono-R.ttf
./ot-sanitise Ubuntu-Th.ttf
./ot-sanitise Ubuntu-B.ttf
./ot-sanitise Ubuntu-LI.ttf
./ot-sanitise Ubuntu-L.ttf
./ot-sanitise Ubuntu-Arabic_R.ttf
ERROR: Layout: DFLT script doesn't satisfy the spec. LangSysCount is not zero: 15
ERROR: Layout: Failed to parse script table 0
ERROR: GPOS: Failed to parse script list table
Failed to sanitise file!
./ot-sanitise Ubuntu-R.ttf
./ot-sanitise UbuntuMono-BI.ttf
./ot-sanitise UbuntuMono-B.ttf
./ot-sanitise Ubuntu-M.ttf

First is gone, but different warnings!

Revision history for this message
Dave Crossland (davelab6) wrote :

On 6 January 2016 at 14:03, Paul Sladen <email address hidden> wrote:

> First is gone, but different warnings!
>

These are much worse :(

Revision history for this message
Dave Crossland (davelab6) wrote :

If you "ttx -s font.ttf" then font.G_S_U_B_.ttx you'll see something like,

<?xml version="1.0" encoding="UTF-8"?>
<ttFont ttLibVersion="3.0">

  <GSUB>
    <Version value="1.0"/>
    <ScriptList>
      <!-- ScriptCount=1 -->
      <ScriptRecord index="0">
        <ScriptTag value="DFLT"/>
        <Script>
          <DefaultLangSys>
            <ReqFeatureIndex value="65535"/>
            <!-- FeatureCount=4 -->
            <FeatureIndex index="0" value="0"/>
            <FeatureIndex index="1" value="1"/>
            <FeatureIndex index="2" value="2"/>
            <FeatureIndex index="3" value="4"/>
          </DefaultLangSys>
          <!-- LangSysCount=1 -->
          <LangSysRecord index="0">
            <LangSysTag value="TRK "/>
            <LangSys>
              <ReqFeatureIndex value="65535"/>
              <!-- FeatureCount=1 -->
              <FeatureIndex index="0" value="3"/>
            </LangSys>
          </LangSysRecord>
        </Script>

This is wrong, in that it contains actual LangSysRecords in the DFLT script. According to the spec at https://www.microsoft.com/typography/otspec/chapter2.htm:

"If a Script table with the script tag 'DFLT' (default) is present in the ScriptList table, it must have a non-NULL DefaultLangSys and LangSysCount must be equal to 0."

Therefore you can removed those lines, making the top of the file as follows

<?xml version="1.0" encoding="UTF-8"?>
<ttFont ttLibVersion="3.0">

  <GSUB>
    <Version value="1.0"/>
    <ScriptList>
      <!-- ScriptCount=1 -->
      <ScriptRecord index="0">
        <ScriptTag value="DFLT"/>
        <Script>
          <DefaultLangSys>
            <ReqFeatureIndex value="65535"/>
            <!-- FeatureCount=4 -->
            <FeatureIndex index="0" value="0"/>
            <FeatureIndex index="1" value="1"/>
            <FeatureIndex index="2" value="2"/>
            <FeatureIndex index="3" value="4"/>
          </DefaultLangSys>
          <!-- LangSysCount=0 -->
        </Script>

And that will hot-fix it.

Revision history for this message
Paul Sladen (sladen) wrote :

@Dave, Re #6 above; I was for a few minutes pondering doing an Automake macro to detect the gcc version and use 'std=c++0x' for gcc versions < 4.7 from before the C++ standard was ratified and to use 'std=c++11' on more recent gcc, but I fear that's going to be time-consuming—although perhaps I could do a PR to the documentation to at least mention it.

Revision history for this message
Paul Sladen (sladen) wrote :

@Dave, Re: #9; that has come out of DM's latest workflow/build-path, so (hopefully) DM might have an interest in deploying a fix upstream; if not, then the before/after above is enough to write a fixer/patcher; and as it is the 'Ubuntu-Arabic' split could work better and one possibility is sticking two sets o numerals in along with OT locale overrides for Arabic.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.