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

[makeotfexe] Bug in building MarkToBase lookup type 4 #811

Closed
readroberts opened this issue Jun 14, 2019 · 1 comment
Closed

[makeotfexe] Bug in building MarkToBase lookup type 4 #811

readroberts opened this issue Jun 14, 2019 · 1 comment
Assignees

Comments

@readroberts
Copy link
Contributor

SourceCodePro sources build with makeotf with empty anchor records. The same feature files produce no empty anchor records when built with fontmake. I'm pretty sure makeotf is wrong.

@readroberts readroberts self-assigned this Jun 14, 2019
@miguelsousa miguelsousa changed the title [makeotf] Bug in building MarkToBase lookup type 4. [makeotfexe] Bug in building MarkToBase lookup type 4 Jun 17, 2019
readroberts added a commit that referenced this issue Jun 19, 2019
Fix afdko issue Bug in building MarkToBase lookup type 4 #811.

In fillMarkToBase(), If a base record does not have anchor for a given mark class, the logic assigns it an offset of 0. Later, in writeMarkToBase(), an offset of 0 for a base anchor record is used as a flag to write a NULL anchor record.

There are several parts to how the bug happens. First, the offset to the first mark anchor record is always zero. This is not a problem for the array of offsets to the mark anchor records, as the logic assumes these are never NULL. Second, the the anchor offset array is filled first with the mark anchor records, and then extended with the base anchor records. Third, when the base anchor records are processed, the code tries to find a match for the current base anchor record's coords in the anchor record array; if a match is found, the offset for that anchor record is used. This means that if a base anchor record's coords match the coords of the first mark anchor record, the offset for the baser anchor record will be set to the same as that of the first mark anchor record - which is zero. In writeMarkToBase(), this valid offset is then interpreted as flagging a NULL anchor.

I think this bug was added by me on 5/9/2016 commit [20af6dd], when I changed the handling of empty mark records.
readroberts added a commit that referenced this issue Jun 19, 2019
afdko issue "Bug in building MarkToBase lookup type 4" #811.
readroberts added a commit that referenced this issue Jun 19, 2019
afdko issue "Bug in building MarkToBase lookup type 4" #811.
readroberts added a commit that referenced this issue Jun 19, 2019
Fix afdko issue Bug in building MarkToBase lookup type 4 #811.

In fillMarkToBase(), If a base record does not have anchor for a given mark class, the logic assigns it an offset of 0. Later, in writeMarkToBase(), an offset of 0 for a base anchor record is used as a flag to write a NULL anchor record.

There are several parts to how the bug happens. First, the offset to the first mark anchor record is always zero. This is not a problem for the array of offsets to the mark anchor records, as the logic assumes these are never NULL. Second, the the anchor offset array is filled first with the mark anchor records, and then extended with the base anchor records. Third, when the base anchor records are processed, the code tries to find a match for the current base anchor record's coords in the anchor record array; if a match is found, the offset for that anchor record is used. This means that if a base anchor record's coords match the coords of the first mark anchor record, the offset for the baser anchor record will be set to the same as that of the first mark anchor record - which is zero. In writeMarkToBase(), this valid offset is then interpreted as flagging a NULL anchor.

I think this bug was added by me on 5/9/2016 commit [20af6dd], when I changed the handling of empty mark records.
readroberts added a commit that referenced this issue Jun 19, 2019
afdko issue "Bug in building MarkToBase lookup type 4" #811.
cjchapman pushed a commit that referenced this issue Jun 20, 2019
Fix afdko issue Bug in building MarkToBase lookup type 4 #811.

In fillMarkToBase(), If a base record does not have anchor for a given mark class, the logic assigns it an offset of 0. Later, in writeMarkToBase(), an offset of 0 for a base anchor record is used as a flag to write a NULL anchor record.

There are several parts to how the bug happens. First, the offset to the first mark anchor record is always zero. This is not a problem for the array of offsets to the mark anchor records, as the logic assumes these are never NULL. Second, the the anchor offset array is filled first with the mark anchor records, and then extended with the base anchor records. Third, when the base anchor records are processed, the code tries to find a match for the current base anchor record's coords in the anchor record array; if a match is found, the offset for that anchor record is used. This means that if a base anchor record's coords match the coords of the first mark anchor record, the offset for the baser anchor record will be set to the same as that of the first mark anchor record - which is zero. In writeMarkToBase(), this valid offset is then interpreted as flagging a NULL anchor.

I think this bug was added by me on 5/9/2016 commit [20af6dd], when I changed the handling of empty mark records.
@miguelsousa
Copy link
Member

Fixed via #815

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

2 participants