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

[skrifa] tthint: graphics state #761

Merged
merged 4 commits into from
Jan 23, 2024
Merged

[skrifa] tthint: graphics state #761

merged 4 commits into from
Jan 23, 2024

Conversation

dfrg
Copy link
Member

@dfrg dfrg commented Jan 19, 2024

First of a series of TrueType hinting patches.

This one models the TT "graphics state" which is essentially all of the data involving outlines, measurement and rounding.

Includes a tiny math module that provides support for working with fixed point values as raw i32s. This is not ideal but exists from the initial port from FreeType and will require some time and attention to correct. This will need to be deferred to a later time.

First of a series of TrueType hinting patches.

This one models the TT "graphics state" which is essentially all of the data involving outlines, measurement and rounding.

Includes a tiny math module that provides support for working with fixed point values as raw i32s. This is not ideal but exists from the initial port from FreeType and will require some time and attention to correct. This will need to be deferred to a later time.
}

impl Default for RetainedGraphicsState {
fn default() -> Self {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is there a reference for where the defaults came from?

Copy link
Member Author

Choose a reason for hiding this comment

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

Added links to graphics state summary table in the spec which lists the default values.

(Wrapping(u.0 as i32) * sx / Wrapping(4)).0,
(Wrapping(v.0 as i32) * sy / Wrapping(4)).0,
)
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Some of these seems complex enough to warrant testing

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 normalize function is particularly nasty :/ Added test cases for mul_div_no_round, mul14 and normalize14 with values generated by their respective FT functions. These also include sanity checks that compute the result in floating point and test with a tolerance.

Copy link
Collaborator

@rsheeter rsheeter left a comment

Choose a reason for hiding this comment

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

Two broad comments:

  1. Testing seems light
  2. The detailed references are most appreciated

- add links to table containing default values for graphics state
- add tests for new fixed point math functions
@dfrg dfrg merged commit 7db6155 into main Jan 23, 2024
9 checks passed
@dfrg dfrg deleted the tthint-graphics-state branch January 23, 2024 18:06
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