-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
"Arbitrary" change in fonts? #15011
Comments
You need to install and use font that supports all the glyphs. There are multiple
what happens is that some glyphs are rendered with different font than others and as you notice they will look different and not connect with the rest. |
Thank you, I will see if that fixes it, I will look through fonts and decide on a handful to install for Chinese. Is there any way to set a "preferred" Chinese font for simplified and traditional in MPV or how does it choose which one it uses by default? Maybe the one that Windows sets? I will look into it also. |
Well, I installed some other fonts, but this doesn't seem to solve the problem. Furthermore, the Simplified font does have a font which can be used without missing characters (as does the Traditional), but for some reason, and this is the "bug", the Simplified seemingly changes for no reason to the Traditional font (but only in the characters that are equal to the Traditionals, since the others do not exist in that font). Any ideas? |
Have you configured mpv to use one of those fonts? Add Much as you guessed, libass (the subtitle renderer) asks your system for an arbitrary font that can display the first character, and precisely to avoid suddenly changing fonts, it keeps using that same font whenever it can. So if you first encounter characters that are the same in Simplified and Traditional forms and your system picks e. g. a Traditional-only font, and then later you encounter a Simplified-only character, it asks your system for a second font to display it. An example from your log:
When you switched to the Traditional track, your log shows:
Then you switched back to the Simplified track, and the log shows the same message as above:
You switched back and forth a bunch more times, but the log for each track stayed consistent: Traditional picked YuGothicUI, while Simplified picked YuGothicUI and then JhengHeiUI. The log suggests that prior track switches never affected subsequent rendering. Yu Gothic is actually a Japanese font family, not Chinese at all. Unfortunately in your case, Windows picks it as the default, thinking you want to display Japanese kanji. This is partly a libass bug, because your subtitle track is marked Chinese, so it should be asking Windows to prefer Chinese fonts, and this is a known issue that is tracked in libass/libass#607, but a fix isn’t expected any time soon. If I’m not mistaken, you could work around this (if you really wanted) by setting your system locale to Chinese. JhengHei is actually a Traditional Chinese font family, so it’s ironic that it gets picked here for the Simplified track. I’m guessing the subtitles contain characters that are absent in Japanese but nevertheless present either in Traditional Chinese or just as a courtesy in JhengHei. To display Simplified Chinese SRT subtitles in a decent font, set To display Traditional Chinese SRT subtitles in a decent font, set |
Thank you very much for the clear explanation, I think I understand what happens more thoroughly now, and the options you've given me are enough to help me get through the problem, since I have to configure other stuff with dual subs and so on in the terminal to start the video, adding more options is the way to go. Maybe I'll just add those options to mpv.conf so that I don't have to add them everytime, in any case. Then, I guess, this isn't exactly and mpv bug but a libass bug, so I think I should close this, as it's solved. Thank you again! |
Well, trying this out, this mirrors another feature request I posted a bit ago (for --secondary-sub-scale to be an option), is there any way to set the font for each subtitle in particular? For example: |
Perhaps someone with better mpv knowledge will correct me, but as far as I’m aware, this isn’t possible. And indeed, even if it were, it seems both of your Chinese tracks are annotated with the exact same language tag (at least as far as mpv can tell), so it wouldn’t help. |
It wouldn't be possible in config. But it should be possible to make lua script that checks subtitle track langauge and set the font accordingly. I don't have time rn to give example, but should be straightforward, to observe tracks and act on that. |
Yep, although I wouldn't worry about the Chinese (since there are, I'm sure, fonts that support both; and, either way, I could re-mux if necessary to specify, if the tag exists), but more about the Spanish/English.
|
If you’re worried that Chinese fonts may have poor Latin support, you could, by the same logic, try to find a font that does have decent support for both, e. g. Code2000. |
Yep, I did that; thanks for the font suggestion, by the way! Nevertheless, it still would be cool to be able to choose which font to use for each language (especially if, say, you'd like a specific Chinese font which has poor Latin support; I guess, in any case, I could make a custom font with FontForge or a similar program if needed, but, well, that's another matter). |
mpv Information
Other Information
Reproduction Steps
Reproducible with --no-config.
Reproduce a video with both Chinese (simplified), Chinese (traditional) and other languages subs, in srt.
The fonts for, in this case, Chinese, change arbitrarily.
Expected Behavior
For the font not to change arbitrarily.
Actual Behavior
The font changes arbitrarily, apparently happens when you switch between subs, sometimes.
I think I understand why this changes now: if the first (simplified) sub has a line where all characters are simplified (and, hence, change the font to the "simpler" one, then the font will display in all lines as intended, when you change back; if, then you change to traditional, and then change back to simplified, it seems then the "sturdier" traditional font remains for characters that are from the "simplified" but actually the same as the "traditional" version, while the actual simplified characters which have no equivalent in the traditional form display with the "simpler" font.
Log File
output.txt
Sample Files
https://www.mediafire.com/file/sfxun4sd2qwhok0/sample.zip/file
I carefully read all instruction and confirm that I did the following:
--log-file=output.txt
.The text was updated successfully, but these errors were encountered: