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

[cffLib] Fix for #1451 #1456

Merged
merged 2 commits into from Jan 17, 2019
Merged

Conversation

justvanrossum
Copy link
Collaborator

@justvanrossum justvanrossum commented Jan 17, 2019

A charstring is not guaranteed to end in an operator, so the final bytecodes 11 and 14 can be part of an encoded numeric value; so remove 'return' or 'endchar' at the program level instead of bytecode.

Fixes next issue from #1451

…tecodes 11 and 14 can be part of an encoded numeric value; so remove 'return' or 'endchar' at the program level instead of bytescode
@justvanrossum
Copy link
Collaborator Author

The "if not isCFF2" test later could actually be the else clause of this new if. That error could be raised even before compilation starts.

@justvanrossum
Copy link
Collaborator Author

The "if not isCFF2" test later could actually be the else clause of this new if. That error could be raised even before compilation starts.

Yes, let me incorporate that change in this PR.

if isCFF2:
# If present, remove return and endchar operators.
if program and program[-1] in ("return", "endchar"):
program = program[:-1]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

del program[-1] would avoid the copy

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, but I thought it was nicer to not alter self.program. But I can change it if you want.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah, you mean, in case the reference to program list was shared by some other object.. Ok, let's leave it like that.

Copy link
Member

@anthrotype anthrotype left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tested with SourceSerifProVF and this works, thanks Just!

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

Successfully merging this pull request may close these issues.

None yet

2 participants