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

[tx] -dcf mode fails to dump hinted CFF2 variable font #322

Closed
blueshade7 opened this issue Apr 19, 2018 · 2 comments
Closed

[tx] -dcf mode fails to dump hinted CFF2 variable font #322

blueshade7 opened this issue Apr 19, 2018 · 2 comments
Assignees

Comments

@blueshade7
Copy link
Contributor

blueshade7 commented Apr 19, 2018

Run tx as:

tx -dcf KozSmaGoPr6NTestHints.otf

Result:

tx: Type 2 stack underflow
tx: fatal error
### Header (00000cb8-00000cbc)
major  =2
minor  =0
hdrSize=5
offSize=0
@blueshade7
Copy link
Contributor Author

@blueshade7 blueshade7 self-assigned this Apr 19, 2018
cjchapman pushed a commit that referenced this issue Apr 19, 2018
…font (#323)

* Fixed assert "out of range region index found in item variation store subtable"

Fixed an assert "out of range region index found in item variation store subtable " in var_getIVSRegionIndices because a wrong region count was used to range-check region indexes.
The bug was exposed when reading Monotype AvenirNext-Variable.ttf

* Fixed tx dcf mode with a hinted CFF2 variable font

The number of regions in VarStore table must be read ahead of reading charstrings in a CFF2 variable font, because the number of regions determines the number of parameters  to a blend operator, which in turn determines the length of each hintmask/coutermask operator.

As a fix, moved a call to dcf_getvsIndices out of dcf_DumpVarStore and placed it dcf_BegFont ahead of calling initCstrs.

* clean up the fix for -dcf with hinted CFF2 VF

1. Moved if (region->begin > 0) test to function dcf_getvsIndices from its caller
2. Factored out the common code to set h->dcf.numRegions out of dcf_SaveStemCount and dcf_GlyphBeg as a function dcf_setNumRegions

* Fix windows build

Moved a statement after declarations
@miguelsousa
Copy link
Member

Fixed by #323

schriftgestalt pushed a commit to schriftgestalt/afdko that referenced this issue May 18, 2019
…d CFF2 variable font (adobe-type-tools#323)

* Fixed assert "out of range region index found in item variation store subtable"

Fixed an assert "out of range region index found in item variation store subtable " in var_getIVSRegionIndices because a wrong region count was used to range-check region indexes.
The bug was exposed when reading Monotype AvenirNext-Variable.ttf

* Fixed tx dcf mode with a hinted CFF2 variable font

The number of regions in VarStore table must be read ahead of reading charstrings in a CFF2 variable font, because the number of regions determines the number of parameters  to a blend operator, which in turn determines the length of each hintmask/coutermask operator.

As a fix, moved a call to dcf_getvsIndices out of dcf_DumpVarStore and placed it dcf_BegFont ahead of calling initCstrs.

* clean up the fix for -dcf with hinted CFF2 VF

1. Moved if (region->begin > 0) test to function dcf_getvsIndices from its caller
2. Factored out the common code to set h->dcf.numRegions out of dcf_SaveStemCount and dcf_GlyphBeg as a function dcf_setNumRegions

* Fix windows build

Moved a statement after declarations
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants