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

[metrics] Add a private tag for Italic correction, Ital #2378

Closed
wants to merge 1 commit into from

Conversation

ebraminio
Copy link
Collaborator

@ebraminio ebraminio commented Apr 24, 2020

@@ -107,6 +107,7 @@ _get_gasp (hb_face_t *face, float *result, hb_ot_metrics_tag_t metrics_tag)
#define _HB_OT_METRICS_TAG_HORIZONTAL_DESCENDER_HHEA HB_TAG ('H','d','s','c')
#define _HB_OT_METRICS_TAG_HORIZONTAL_LINE_GAP_OS2 HB_TAG ('O','l','g','p')
#define _HB_OT_METRICS_TAG_HORIZONTAL_LINE_GAP_HHEA HB_TAG ('H','l','g','p')
#define _HB_OT_METRICS_TAG_ITALIC_CORRECTION HB_TAG ('I','t','a','l')
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Feel free to suggest something better

g_assert_cmpint (value, ==, 426);
int x_scale;
hb_font_get_scale (font, &x_scale, NULL);
g_assert_cmpint ((int) roundf (-asinf ((float) value / x_scale) * 180.f / (float) M_PI), ==, -12);
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

How to get post->italicDegree back, can be done by HB_OT_METRICS_TAG_HORIZONTAL_CARET_RUN / HB_OT_METRICS_TAG_HORIZONTAL_CARET_RISE right now also of course

@jfkthame
Copy link
Collaborator

I don't understand this. "Italic correction" is a specific TeX-related concept that is not the same as "italic angle", and cannot be directly computed from it; it's a per-glyph metric that is up to the font designer to specify.

In XeTeX (for example), we do synthesize a "fake" value for italic correction -- using italic angle as one of the inputs -- but that's just a fallback heuristic to make up for the lack of this glyph metric in OpenType fonts. I don't think harfbuzz should be attempting to do anything like that; it's purely an application-level function.

@ebraminio
Copy link
Collaborator Author

ebraminio commented Apr 25, 2020

[..] I don't think harfbuzz should be attempting to do anything like that; it's purely an application-level function.

#1890 is what I suggest but nobody shows any interest and Behdad says no client will use that (but I believe a font manager easily can take advantage of it, don't you know any other client willing to use it?) so the only remained option will be providing one hb_face_get_italic_angle like API.

@ebraminio
Copy link
Collaborator Author

Another doomed attempt :/ let's agree on having hb-style or a hb_font_get_italic_angle like API instead I believe.

@ebraminio ebraminio closed this Apr 28, 2020
@ebraminio ebraminio deleted the italic-correction branch April 28, 2020 11:02
@ebraminio ebraminio restored the italic-correction branch April 28, 2020 14:37
@ebraminio ebraminio reopened this Apr 28, 2020
@ebraminio
Copy link
Collaborator Author

let's take another look later

@ebraminio ebraminio closed this Jun 10, 2020
@ebraminio ebraminio deleted the italic-correction branch June 10, 2020 15:48
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.

Expose post table’s italicAngle?
2 participants