Fix issues with shearing in combination with scaling
commit7af78014635dbe81c3328405aa68dd2cfef94bc4
authorwm4 <wm4@nowhere>
Sat, 29 Sep 2012 19:45:59 +0000 (29 21:45 +0200)
committerwm4 <wm4@nowhere>
Sat, 29 Sep 2012 20:11:50 +0000 (29 22:11 +0200)
tree3a791ece0463c18bdedb61efdcd7887b3fefa9e2
parent31db1346d43e54e07bd563d8c9e6ffbdd195b84c
Fix issues with shearing in combination with scaling

There are two problems.

First, the shearing tags (\fay and \fax) misbehave when used with
scaling tags (\fscx and \fscy). We have to compensate for the scaling
in either direction when shearing, because the shearing is applied
after scaling. VSFilter, which by definition has the correct behavior,
does it the other way around.

Second, libass doesn't scale smoothly when small font sizes are
involved. These can come either from downscaling (e.g. make the mplayer
window smaller than the video with a video output like gl or vdpau), or
from setting the font size manually. In these cases, the font size
passed to freetype get very low, so that rounding errors or size
adjustments due to hinting or other pixel grid fitting add up. The
result is text rendered in the wrong size, or "pulsating" text if the
font size depends on animated parameters. This is worsened by the
practice found in subtitle scripts to use tag combinations like
"\fscy2500\fs2" to get more precision for controlling font size (needed
because VSFilter doesn't read fractional scale values).

We solve the second issue by always requesting a constant font size
from freetype, and then scaling the resulting glyph to the desired
size. This seems to disable freetype's glyph fitting issue. The caveat
is that it (obviously) also disables hinting, which may result in worse
text quality. However, the combination of applying \fs and \fscx tags,
and animating them, seems to leave no other choice.

This fixes libass issue #46 (hopefully).
libass/ass_render.c