-
Notifications
You must be signed in to change notification settings - Fork 209
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
Investigate unexpected vsfilter behavior with \h on certain font #706
Comments
Following since this is my screenshot + the error I ran into. Thanks for making the issue! |
This comment was marked as outdated.
This comment was marked as outdated.
The |
Apologies, I somehow missed that the full script and not just the font is attached. |
Fallback works normally (for |
Except that in another anomaly, I wanted to double-check that it’s using Uniscribe by verifying that I see kerning, but it doesn’t seem to be applying any kerning at all! But it should, per #237… According to fontTools’ TTX, the font has a version 0 |
Resaving from FontForge with the kerning additionally saved to |
I’ve spent this hour transplanting bits and pieces from the font in #42 to the font here in hopes of finding which particular piece is preventing fallback/substitution, but nothing has helped so far :-( |
Finally managed to get the font to let It happens when I remove U+0022 QUOTATION MARK (and not any other particular code point, although I haven’t exhaustively tried each) from the font’s Windows cmap 🤯 I truly have no idea why this is. At first glance it might seem related to the quotation marks surrounding the |
My gut feeling is that perhaps GDI probes some hardcoded list of code points (which includes U+0022) and if it sees glyphs for all of them, it blindly assumes the font supports a whole subset of Unicode (which includes U+00A0) and skips font fallback for any code points in that subset. And it’s weird, because like, don’t ASCII-only fonts exist? Why would you assume that the non-ASCII NBSP is supported? In fact, I’m able to produce similar behaviour by removing all code points except the quotation mark and the Latin letters:
|
And now I can’t reproduce this! It worked just a few minutes ago! Now it’s rejecting the font and using Arial instead. I’ve been restarting MPC-HC between tests to clear any possible per-process caches, but maybe that’s not enough? Or did I make a mistake somewhere? Meanwhile, a font with full sets of both uppercase and lowercase letters but without the quotation mark (or any other code points) is accepted, and |
As noted in #237 (comment), U+0022 is actually among the four magical-constant code points that cause GDI to switch to Uniscribe if the font lacks glyphs for them. So the fallback works in this case because the string is rendered by Uniscribe, just as in the other Uniscribe cases in the earlier test above. |
Discovery of the century incoming… GDI doesn’t do inline font fallback. At all. GDI uses font linking—and nothing more. The Uniscribe-based code path does inline font fallback, and its fallback choice can differ from GDI’s font linking. My proof:
|
Turns out Uniscribe proper actually allows enabling and disabling both font linking and font fallback, but GDI’s various entry points configure it differently. |
Well, further tests suggest that while the API allows this, * Wouldn’t be a huge surprise, seeing as e. g. ** Yes, this whole GDI/Uniscribe business depends on whether the language support pack is installed. That is, the delegation to Uniscribe only happens when the pack is installed. Fun. I haven’t been able to find conclusively what this pack is, but my guess is it’s one of (or perhaps a DLL included in both of) the optional installs available via checkboxes in old Regional Settings (for those who don’t know: [1], [2], [3 with pictures]). My hopeful understanding is that it’s been included unconditionally since Vista, but it was still optional in XP. And XP was still popular in the early softsub era. Welp. |
Sample script + font:
GosmickSample.zip
Lines in question:
Reported MPC/vsfilter output:
![image](https://private-user-images.githubusercontent.com/819638/266824047-4dfd85ff-6699-44e9-abe7-b76515a16297.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjEzNDEzMTQsIm5iZiI6MTcyMTM0MTAxNCwicGF0aCI6Ii84MTk2MzgvMjY2ODI0MDQ3LTRkZmQ4NWZmLTY2OTktNDRlOS1hYmU3LWI3NjUxNWExNjI5Ny5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjQwNzE4JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI0MDcxOFQyMjE2NTRaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT01ODdlYTdkMTE3NGVkODQzODQ2NWU4NDkyM2FmMzY2YzUyOTQxMDY5MGY2ZmU2NjUwN2Q2NDcxZmE3ODZmYjNhJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCZhY3Rvcl9pZD0wJmtleV9pZD0wJnJlcG9faWQ9MCJ9.Od_f6dR2JaMAtdJzO6PkPzHjr00N3_OwuwUSirG4QvE)
So, uh, it seems to be rendering
\h
(i.e. U+00A0/nbsp) witha
, which is in the.notdef
glyph slot? What?The libass behavior here is sane (we render whitespace as expected), and I haven't seen any indication that anybody has deliberately relied on this behavior, so this might not be worth changing, but I figure it's at least worth understanding and documenting.
The text was updated successfully, but these errors were encountered: