Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OTS is requiring data chunks in CMAP format 14 subtable in order? #153

Open
be5invis opened this issue Oct 21, 2017 · 10 comments
Open

OTS is requiring data chunks in CMAP format 14 subtable in order? #153

be5invis opened this issue Oct 21, 2017 · 10 comments

Comments

@be5invis
Copy link

As read the source it looks like that, data chunks of Default UVS Tables and Non-Default UVS Tables must be ordered the same as varSelectors, but I did not see any requirements in the Spec restricting the order of data chunks.
If the data chunks are not ordered, OTS would report an error, triggered by line 531 in cmap.cc.

@khaledhosny
Copy link
Owner

PR with a test font, or just a test font, would be helpful.

@be5invis
Copy link
Author

be5invis commented Apr 5, 2018

The first file having this problem is a Microsoft IP.
The second is here ↓
sarasa-gothic-j-regular.zip

Message:

ERROR: cmap: Bad subtable offset (206 != 27265)
ERROR: cmap: Failed to parse format 14 cmap subtable 2
ERROR at src\ots.cc:675 (`anonymous-namespace'::ProcessGeneric)
ERROR: cmap: Failed to parse table
Failed to sanitize file!

Format 14 subtable of this font:

        List of VarSelectorRecord #0 :  
        VarSelector:     fe00
        defaultUVSOffset:     0
        nondefaultUVSOffset:     26831

        List of VarSelectorRecord #1 :  
        VarSelector:     fe01
        defaultUVSOffset:     0
        nondefaultUVSOffset:     26812

        VarSelector:     e0100
        defaultUVSOffset:     8056
        nondefaultUVSOffset:     6877

        List of VarSelectorRecord #3 :  
        VarSelector:     e0101
        defaultUVSOffset:     6005
        nondefaultUVSOffset:     1066

        List of VarSelectorRecord #4 :  
        VarSelector:     e0102
        defaultUVSOffset:     1014
        nondefaultUVSOffset:     440

        List of VarSelectorRecord #5 :  
        VarSelector:     e0103
        defaultUVSOffset:     428
        nondefaultUVSOffset:     349

        List of VarSelectorRecord #6 :  
        VarSelector:     e0104
        defaultUVSOffset:     0
        nondefaultUVSOffset:     315

        List of VarSelectorRecord #7 :  
        VarSelector:     e0105
        defaultUVSOffset:     307
        nondefaultUVSOffset:     288

        List of VarSelectorRecord #8 :  
        VarSelector:     e0106
        defaultUVSOffset:     0
        nondefaultUVSOffset:     274

        List of VarSelectorRecord #9 :  
        VarSelector:     e0107
        defaultUVSOffset:     0
        nondefaultUVSOffset:     260

        List of VarSelectorRecord #10 :  
        VarSelector:     e0108
        defaultUVSOffset:     0
        nondefaultUVSOffset:     251

        List of VarSelectorRecord #11 :  
        VarSelector:     e0109
        defaultUVSOffset:     0
        nondefaultUVSOffset:     242

        List of VarSelectorRecord #12 :  
        VarSelector:     e010a
        defaultUVSOffset:     0
        nondefaultUVSOffset:     233

        List of VarSelectorRecord #13 :  
        VarSelector:     e010b
        defaultUVSOffset:     0
        nondefaultUVSOffset:     224

        List of VarSelectorRecord #14 :  
        VarSelector:     e010c
        defaultUVSOffset:     0
        nondefaultUVSOffset:     215

        List of VarSelectorRecord #15 :  
        VarSelector:     e010d
        defaultUVSOffset:     0
        nondefaultUVSOffset:     206

        List of VarSelectorRecord #16 :  
        VarSelector:     e010e
        defaultUVSOffset:     0
        nondefaultUVSOffset:     197

@be5invis
Copy link
Author

be5invis commented Apr 5, 2018

This message is found here: https://github.com/khaledhosny/ots/blob/master/src/cmap.cc#L531
The code forces that the last UVS data block (DefaultUVSTable or NonDefaultUVSTable) must end at the end of the cmap subtable, which is not required by the OTSpec.

@khaledhosny
Copy link
Owner

khaledhosny commented Apr 15, 2018

If I drop this check, the santized file will be invalid, so something else seems to be broken as well.

@be5invis
Copy link
Author

@khaledhosny What exactly do you mean "something"? Something in my font or something in your program?

@khaledhosny
Copy link
Owner

Something in OTS.

@extratype
Copy link

extratype commented Jul 24, 2018

@be5invis I have the same problem with Source Han Sans fonts converted to ttf using otfcc-c2q. But you have passed OTS for Sarasa Gothic v0.5.4. How do you workaround this issue?

@be5invis
Copy link
Author

be5invis commented Jul 24, 2018

TTX roundtrip can fix that...

@extratype
Copy link

Thank you, it works. Yesterday TTX just crashed somehow :p

@khaledhosny
Copy link
Owner

Fixed in #197

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants