Skip to content

[read-fonts] add T1 charstring ops#1734

Open
dfrg wants to merge 1 commit intomainfrom
t1csops
Open

[read-fonts] add T1 charstring ops#1734
dfrg wants to merge 1 commit intomainfrom
t1csops

Conversation

@dfrg
Copy link
Member

@dfrg dfrg commented Feb 5, 2026

Extend charstring evaluation to support a minimal set of Type1 specific operators.

Extend charstring evaluation to support a minimal set of Type1 specific operators.
Copy link
Contributor

@drott drott left a comment

Choose a reason for hiding this comment

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

Impressive level of deep-diving into CFF. Big thanks for digging in!

}

#[test]
fn op_callothersubr_flex() {
Copy link
Contributor

Choose a reason for hiding this comment

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

Would it be possible to exercise a few of the additional new operations be covered in tests, VStem3, HStem3, for example?

Copy link
Member Author

Choose a reason for hiding this comment

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

The stem operators aren't implemented in this PR so there's not much to test. Since PDFium doesn't enable hinting for Type1, my inclination is to ignore this for now unless some need pops up in the future. I can however add some tests for div and setcurrentpoint. The only remaining (functional) operator is seac which can't really be tested without additional Type1 infrastructure because we need access to the charstrings.

/// Type2 charstring.
///
/// See reference at <https://adobe-type-tools.github.io/font-tech-notes/pdfs/5177.Type2.pdf>.
Type2,
Copy link
Contributor

Choose a reason for hiding this comment

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

Is it possible to cover acceptance/rejection of CharString kind somehow in tests - or exercise usage of this enum?

Copy link
Member Author

@dfrg dfrg Feb 6, 2026

Choose a reason for hiding this comment

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

Unfortunately, there's not much we can do since we recently removed operator validation to handle a broken font (and match FT) and these basically control which operators are applicable (or adjust behavior).

I can add another set of tests for sbw and hsbw that assert no changes to state in Type2 mode.

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.

2 participants