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
[Subtitles] Add support to font collection (.ttc) #23429
Conversation
From what I can find in specs there isn't a difference in tables between .ttc and .otc font collections. Any reason not to include .otc? |
for me no problem add it, but are you able to find at least one .otc file to make test? |
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.
Codewise I can't figure out anything to nitpick now, the versioning was my only concern.
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.
Looks good, just some minor suggestions.
I did some hunting for ".otc" collections, and it seems like using the ".ttc" extension appears to be the convention. Per Adobe, the tables in the collection need to be checked to determine if the fonts are ttf or otf (ttf will have 'glyf' tables). So I don't think it is worth the effort to worry about otc. I did build a couple of otf font collections using Adobe Font Development Kit for OpenType following the 2 examples provided, but not sure it's worth looking at them. If you are interested anyway here are the files: https://mega.nz/file/PapUxRRL#Y_Fv9nIUldgPJ43XOHvbfbjp7sESg6SQDfrS2x5sJpA |
out of curiosity i tried both .otc attached but fontforge and also libass are not able to load glyphs |
please wait to merge this |
all ok ready to merge |
Description
This PR add support to use font collection (.ttc) to subtitles
since .ttc contains more fonts, we need to inspect the file to get family name of each font
this format is already supported in to libass renderer but we have not allowed his use
that lead to the problem with mkv's where user opened issue
this code change
the results in the fontcache.xml will be as follow:
NOTE 1: the DFMrg9.ttc file on zip below contains multiple font familynames for different architectures on each font,
but for some reason to me unknown with this particular fonts kodi is not able to convert the familyname enoceded "macintosh" to uft8, i tried use fontforge to check fonts, but i have not found problems and i have no idea where is the problem (could be also on freetype library). So for now i prioritized the family name set for MS/APPLE platforms then use MAC as fallback, in this way we can workaround it.
NOTE 2: i add fontfamily name selection from "english" field that should be always filled, this for two reasons, prevent possible problems of "tofu" chars appears in the GUI font list, kodi dont support multilanguage GUI, and avoid add a encoding mapping to decode each language with iconv, if there will be problems on particular use cases it will be addressed when reported
Motivation and context
fix #23402
How has this been tested?
tested mkv provided in the issue that embed an ass subtitle + fonts
tested .ttc fonts with srt subtitles by using fonts on zip Fonts.zip
What is the effect on users?
Allow users to use .ttc files and display font correctly
Screenshots (if appropriate):
Types of change
Checklist: