-
Notifications
You must be signed in to change notification settings - Fork 218
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
Conversation
libass/ass_font.c
Outdated
.xy = 0x05700L, | ||
.xy = ass_face_is_postscript(face) | ||
? 0x02d24L /* tan(10 deg) */ | ||
: 0x05700L /* from GDI; roughly 0.34; tan(18.77 deg) */, |
There was a problem hiding this comment.
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)
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
18864fa
to
72c5bc8
Compare
Coefficient derived experimentally.
72c5bc8
to
61992a1
Compare
#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:
PostScript: