moi15moi/FontCollector

Multiple input .ass files leads to duplicate fonts

Closed this issue · 7 comments

If I call multiple input .ass files as so:
fontcollector -d -mkv "fma 01.mkv" -i "fma cr 01.ass" "fma shady 01.ass" "fma ani 01.ass" --collect-draw-fonts --additional-fonts-recursive "fonts"
The attachments in the final file look like this:
Attachments : DFHsr4.ttc / [ENG] DFHSMincho-W9 & DFPHSMincho-W9 & DFGHSMincho-W9.ttc / GANDHISANS-BOLDITALIC.OTF / [ENG] WKGMSamd.TTF / GANDHISANS-BOLD.OTF / timesbd.ttf / Wunderlich-Medium.otf / [ENG] Dosis-Book.ttf / timesbd.ttf / KozMinPro-Heavy.otf / DFHsr4.ttc / [ENG] A-OTF-GothicMB101Pr6N-Heavy-2.otf / KozMinPro-Heavy.otf / KozMinPro-Heavy.otf / KozMinPro-Heavy.otf / [ENG] HeiseiMincho-W9.ttf / timesbd.ttf

If I merge all of these subtitle files then only use it as an input, as so:
fontcollector -d -mkv "fma 01.mkv" -i "fma merged 01.ass" --collect-draw-fonts --additional-fonts-recursive "fonts"
I get the following attachments:
Attachments : DFHsr4.ttc / KozMinPro-Heavy.otf / GANDHISANS-BOLD.OTF / GANDHISANS-BOLDITALIC.OTF / KozMinPro-Heavy.otf / [ENG] Dosis-Book.ttf / [ENG] A-OTF-GothicMB101Pr6N-Heavy-2.otf / timesbd.ttf / [ENG] WKGMSamd.TTF / DFHsr4.ttc / [ENG] HeiseiMincho-W9.ttf / Wunderlich-Medium.otf / [ENG] DFHSMincho-W9 & DFPHSMincho-W9 & DFGHSMincho-W9.ttc

As you can see, including multiple input files that use overlapping fonts leads to the same font file being merged multiple times.

Since you haven't uploaded a sample, I created a sample which should replicate your problem, but when I run the command fontcollector -d -mkv "test_video.mkv" -i "1.ass" "2.ass" --collect-draw-fonts, I don't have your problem

Are you sure you are on the latest version (3.0.0) ? You can run the command pip show FontCollector to see which version you have.

Here's a sample:
fontcollector test.zip

I don't get the same results as I did in the original post, but the timesbd.ttf font still repeats here if you use the non-merged subs.

One thing I noticed is that the timesbd and KozMinPro-Heavy fonts that are repeated in the original post are both fonts that are installed on my system, and the others are not installed. This makes me think that the issue is likely related to using both OS fonts and an additional fonts folder at the same time.

Again, which fontcollector version do you have?

I'm using version 3.0.0.

I installed Wunderlich-Medium.otf and both bat you shared and I still am not able to reproduce your bugs.
I have no idea what cause this problem

This bug is due to georgkrause/langcodes#19

I am waiting for them to merge my PR and push a new version on pypi

They merged my PR.
For the moment, to resolve this bug, you can install the main branch of langcodes by executingpip install git+https://github.com/georgkrause/langcodes.git