Font Loading Failures with Same-Family Subsetted Fonts

Issue Description

1. Issue A:

When embedding two subsetted fonts with the same family name (e.g., Simplified 方正小标宋_GBK.1.ttf and Traditional 方正小标宋_GBK.2.ttf) into an MKV file, infuse fails to load both fonts correctly. This results in:

  • Traditional subtitles: Characters like “紅瞳” render correctly (both characters exist in 方正小标宋_GBK.2.ttf).
  • Simplified subtitles: Only shared characters (e.g., “瞳”) render correctly, while unique characters (e.g., “红”) fall back to the system font.

Key Observations:

  • “瞳” exists in both sub and displays correctly regardless of the loaded font.
  • “红” (Simplified) is missing in 方正小标宋_GBK.2.ttf but exists in 方正小标宋_GBK.1.ttf, yet fails to render due to font overwriting.
    Root Cause:
  • The player uses a hash table keyed by family name, causing later-loaded fonts to overwrite earlier ones.
  • No iterative search for characters across fonts of the same family.

Additional Notes

When multiple fonts with identical family names are embedded (e.g., fzzy_gbk1.ttf, fzzy_gbk2.ttf, heiti1.ttf, heiti2.ttf), infuse fails to load any of these fonts for styles referencing their shared family names. Instead, all affected subtitles fall back to the system default font.

2. Issue B: Incorrect Font Weight Handling

When subtitles embed multiple weights of the same font family (e.g., “Microsoft YaHei Bold” and "Microsoft YaHei "), infuse fails to apply weights correctly:

  • Non-bold text sporadically renders as bold (e.g., “Test”).
  • Explicit bold tags ({\b1}) are ignored.
    Root Cause:
  • Bold/Regular variants overwrite each other in the font cache.

I have uploaded two samples to upload.firecore.com named SAMPLE.A.mkv and SAMPLE.B.mkv.



What does the changelog entry ‘Improved handling of SSA/ASS subtitles and font handling’ in version 8.3 specifically refer to?

I tested it with a video file that has ASS/SSA subtitles referencing multiple font weights (e.g., Bold, Light) that all belong to a single font family (where the different weights are all named ‘Microsoft YaHei’). The player still fails to select and render the correct font weights specified in the subtitle.