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

Match VSFilter’s faux italics on PostScript-outline fonts, too #760

Merged
merged 1 commit into from
May 13, 2024

Conversation

astiob
Copy link
Member

@astiob astiob commented May 11, 2024

#676 previously adjusted our faux italics to match GDI/VSFilter on TrueType fonts, but we later discovered that PostScript-outline fonts behave differently (font driver differences strike again) and our rendering became less similar to VSFilter’s after that change. This should fix it.

I derived the coefficient experimentally using Fansub Block. The first-approximation value I got was awfully close to 10° (9.998°), so I figure it’s probably exactly 10°. Thus, I’ve hardcoded the closest fixed-point representation of tan(10°) in this commit.

TrueType:
A screenshot shows a parallelogram whose interior angle is about 71.2°.

PostScript:
A screenshot shows a parallelogram whose interior angle is about 80.0°.

@astiob astiob added this to the 0.17.2 milestone May 11, 2024
@astiob astiob requested review from rcombs and TheOneric May 11, 2024 16:17
.xy = 0x05700L,
.xy = ass_face_is_postscript(face)
? 0x02d24L /* tan(10 deg) */
: 0x05700L /* from GDI; roughly 0.34; tan(18.77 deg) */,
Copy link
Contributor

Choose a reason for hiding this comment

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

Technically, it is more sin(20 deg) instead of tan(18.77 deg)

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks for the pointer. However, sin has no physical meaning in this context, whereas tan refers to the slant angle. I can add a comment that it may have apparently originated as sin(20°), but it doesn’t seem very useful—nor is it even a very good approximation of sin(20°), although certainly better than of tan(20°) for what it’s worth.

Copy link
Member

Choose a reason for hiding this comment

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

It's sin(20°)*256, truncated to an integer, and then shifted left 8 to expand to 8.8 form.

Copy link
Member Author

Choose a reason for hiding this comment

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

Well, yeah. “Truncated to 1/8th” being “not a very good approximation” (even rounding to 1/8th would have produced a different value). Anyway, is this relevant enough that you want it mentioned?

Copy link
Member Author

Choose a reason for hiding this comment

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

Reworded to add a mention of sin(20°). Does this look good?

Copy link
Member Author

Choose a reason for hiding this comment

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

Aaand removed again and reworded some more to avoid unofficial data.

@astiob astiob force-pushed the faux-italic-postscript branch 3 times, most recently from 18864fa to 72c5bc8 Compare May 12, 2024 21:53
@astiob astiob force-pushed the faux-italic-postscript branch from 72c5bc8 to 61992a1 Compare May 13, 2024 12:04
@astiob astiob merged commit 61992a1 into libass:master May 13, 2024
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants