Ticket #335 (closed enhancement: fixed)

Opened 6 years ago

Last modified 6 years ago

[PATCH] First step to allow case-insensitive font search for subtitles

Reported by: maru Owned by: astrange
Priority: normal Milestone: 1.3
Component: Subtitles Version: 1.1
Severity: normal Keywords:
Cc:

Description

ATSUFindFontFromName does a case sensitive search for the given fontname.

There are ASS subtitles where the font is all lowercase or uppercase. In this case, the fail-over font is used although the font exists in the MKV file.

I think the best solution would be to use NSFontManager but this means larger changes. The attached patch is just a quick fix that works with the "problem"-files I have here.

Attachments

font.patch Download (1005 bytes) - added by maru 6 years ago.
Use NSFontManager in the failover case.
atsu-font.patch Download (1.4 KB) - added by maru 6 years ago.
Applied changes as requested by Alex

Change History

comment:1 Changed 6 years ago by astrange

  • Owner set to astrange
  • Status changed from new to assigned
  • Milestone set to 1.2

Changed 6 years ago by maru

Use NSFontManager in the failover case.

comment:2 follow-up: ↓ 3 Changed 6 years ago by astrange

It might be a bad idea to link to AppKit?. Let me ask someone else...

comment:3 in reply to: ↑ 2 Changed 6 years ago by maru

Replying to astrange:

It might be a bad idea to link to AppKit?. Let me ask someone else...

Well another way of doing this would be to get all Font IDs of the system with "ATSUGetFontIDs" iterate over the list with "ATSUFindFontName" and do a case in-sensitive for the font. I am pretty sure this will take longer than with NSFontManager but on the plus side we do not depend on AppKit? any longer.

comment:4 Changed 6 years ago by astrange

As long as we can only get one name per font, we still need a final ATSFontFindFromName, otherwise the bugs in ATSUI on 10.4 mean we'll never find some fonts. I have an example file for that somewhere...

Still, that's not a problem since it's all done while the file is being opened. I'd like to move some of these arrays into the renderer class instead of the stack, but I'll look at it later.

Other notes: use kFontMicrosoftPlatform and just do 'font = fontIDs[x]'.

Changed 6 years ago by maru

Applied changes as requested by Alex

comment:5 Changed 6 years ago by astrange

  • Status changed from assigned to closed
  • Resolution set to fixed
Note: See TracTickets for help on using tickets.