[MPlayer-users] How to force SSA subtitles size to constant one ?

Παναγιώτης Κατσαλούλ Παναγιώτης Κατσαλούλ
Fri Aug 24 23:03:38 CEST 2007


On 24 Αυγ 2007, at 11:23 ΜΜ, Evgeniy Stepanov wrote:

> On Friday 24 August 2007, Παναγιώτης  
> Κατσαλούλης wrote:
>> 3) When jubler creates the subtitle file, instead of using the given
>> font sizes, calculate new font size based on the value of OS2
>> metrics. E.g. when the user requests a font size of 24, to save
>> inside the file a font size of 30.
>>
> If you are generating subtitles in SSA/ASS format, then they will  
> later be
> displayed using os2 metrics. Either with mplayer, or asa (aegisub  
> and, in the
> future, vlc), or vsfilter. It can be considered part of the  
> standard, and it
> is absolutlely needed for all the subtitles made over the years to be
> displayed correctly.

You are probably right :(
I know that in the long term, this is what I should do - retain  
compatibility with others.
The key phrase is what you said: "It can be considered part of the  
standard"

So, if I understood right (from the patch), the way to do this is to  
rescale font based on the following factor:

(hori->Ascender - hori->Descender) / (os2->usWinAscent + os2- 
 >usWinDescent)

where hori are actual metrics and os2 are OS2 metrics.

Since I am using Java I know how to get the "hori" metrics. The  
problem is that Java seems to have dropped the "os2" metrics.
It is able though to read font tables from the file, using this  method:
http://java.sun.com/j2se/1.5.0/docs/api/java/awt/font/ 
OpenType.html#getFontTable(java.lang.String)
So, I think that if I use this information in conjunction with
http://developer.apple.com/textfonts/TTRefMan/RM06/Chap6OS2.html
I will be able to calculate this factor.

Am I missing something?


> So, both 1st and 2nd solutions are just hiding the actual problem.  
> I'd suggest
> recalculating font sizes (as in 3rd solution). Another way is to  
> give up
> compatibility with OS metrics. Just assume that fonts in subtitles  
> look
> differently that in the OS. After all, subtitles will be displayed in
> differents OSes, and these OSes use different metrics.

Well, the reason I love Java is exactly that it (is supposed to)  
behave the same in all (supported) platforms ;)
So your last sentence should not be true :P




More information about the MPlayer-users mailing list