Skip to content
This repository has been archived by the owner on Feb 6, 2022. It is now read-only.

Add explicit line-height to .libjass-font-measure #46

Merged
merged 1 commit into from
Aug 1, 2015

Conversation

Dador
Copy link
Contributor

@Dador Dador commented Jul 26, 2015

Currently line-height for .libjass-font-measure determined by site css. For example if you run libjass on github.com then line-height for .libjass-font-measure would be 1.4. Of course that's not correct that line-height and font size in subtitles determined by site css.

I'm put "1.15" and not "normal" because:

declaring line-height: normal not only vary from browser to browser, which I had expected—in fact, quantifying those differences was the whole point—but they also vary from one font face to another, and can also vary within a given face.

"1.15" looks similar to line-height used in libass/VSFilter. Maybe you know where in libass sources I can find real value of line-height?

BTW, if line-height is constant then maybe libjass-font-mesure is unnecessary? I mean if we know line-height then we can compute line-height and font-size without putting symbol in .libjass-font-measure.

@Arnavion
Copy link
Owner

Of course that's not correct that line-height and font size in subtitles determined by site css.

Yes, that's right. It should be forced to the default value (normal).

I'm put "1.15" and not "normal" because: ... but they also vary from one font face to another, and can also vary within a given face. "1.15" looks similar to line-height used in libass/VSFilter.

This is the correct behavior, so "normal" is correct. normal is usually 1.2, so it should look close to your change.

Maybe you know where in libass sources I can find real value of line-height?

VSFilter / libass treat the ASS font size as the line height and derives the actual font size using font metrics. libjass doesn't have access to the font metrics, so it computes the font size by using the test div.

BTW, if line-height is constant then maybe libjass-font-mesure is unnecessary?

Line height is not constant, as you found yourself from the blog post.

In fact, in the past, libjass used to use a constant 1.33 in the same way you suggest (before I completely understood how font size worked in browser vs ASS). This actually worked for some font+font size combinations, but obviously not for all. Eventually I realized what was going on and wrote the test div technique.

@Dador
Copy link
Contributor Author

Dador commented Aug 1, 2015

Okay. I returned "normal".
I still wasn't sure that "normal" using same calculations as libass/VSFilter. But anyway it looks normal :)

@Arnavion Arnavion merged commit 68d8987 into Arnavion:master Aug 1, 2015
@Arnavion Arnavion added this to the v0.11.0 milestone Aug 26, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants