Fix resetting border style with \rSTYLE

With \rSTYLE, it is possible to change the border style within the same
subtitle event. You can do this by setting a different BorderStyle value
in the newly requested style. VSFilter handles this as expected, while
libass uses a single border style for the whole subtitle event.

This fixes libass issue #56.
Terminate drawings immediately on a \p0 tag

The parsing code allowed override tags after \p0 to affect the drawing.
This is incorrect. Finish the drawing object as soon as \p0 is
encountered instead.

This requires moving the code executing the style overrides from
get_next_char() in ass_parse.c to the main render loop in
ass_renderer.c, because we have to re-enter the rendering loop
inside of a tag. The old code was simply executing all tags until
a new character could be returned to the renderer loop, mutating up
the state (RenderContext fields) for the drawing after the drawing
was closed, but before it was rendered.

This fixes libass issue #47.
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).
Fix \fay when used with multiline subs

When \fay tag is applied to a multiline sub, it causes subsequent lines
of the sub to be offset vertically as if it was rendered next to the
previous line (not below).

Patch by Hector Martin <hector@marcansoft.com>, with an additional
correction related to libass issue #46.
Add ass_set_line_position() API function for subtitle position

This allows users to change the vertical position of normal subtitles.
MPlayer has such a feature as -sub-pos option using its internal
subtitle renderer.

Bump LIBASS_VERSION to indicate the API addition.
Fix change detection when cache is cleared

check_cache_limits() clears the image list. If all subtitles disappear
right in the frame the cache has been cleared, ass_detect_change() will
see two empty image lists (old - not empty, but cleared, new - empty),
and signal to the application that there was no change. As result,
media players which rely on the change detection will keep displaying
the last subtitle until the next subtitle event.

This bug was found by uau and has been reported on IRC in February.
shaper: always use LTR base direction by default

Unfortunately, VSFilter always assumes LTR base direction. All existing
Arabic subtitles have been designed with that in mind. This causes
various issues, for instance punctuation placed at the wrong side of
a line.

We have no other choice than to use the same braindead always-LTR
assumption (except if overridden by the font encoding property).
shaper: allow font encoding -1 for neutral base direction
Update changelog
shaper: add UCDN support

Add explicit support for UCDN, without relying on any HarfBuzz
integration. This finally allows easy usage of HarfBuzz without glib,
ICU, or some other big bloated library!
Fix change detection in a rare case

If an empty track is passed to ass_render_frame, always set the
change detection value to 2 (content and positions changed). This is
acceptable in both the case that the previous call resulted in images
(obviously) and in the case that the previous call resulted in no
images (in that case the change detection result doesn't actually
matter).
drawing: scale pbo according to drawing scale

Fixes issue #68.
shaper: improve skipping of zero-width characters

The list was somewhat incomplete. Add what's important and left, and
disable removal if HarfBuzz is used. HarfBuzz removes these characters
now by itself. Refactor a little into a separate function.
Revert "shaper: add UCDN support"

This reverts commit 840ce4c2d9381e340c3239d104933fea85fff3e5.

Harfbuzz added UCDN support much quicker than I thought and the latest
release 0.9.5 contains UCDN already, so we don't need it in libass
anymore.
Update changelog
shaper: add hack to workaround grid-fitting

This complements commit 7af780, which didn't correctly apply the hack
to the advance/position as calculated by the shaper.
Bump minimum Harfbuzz version to 0.9.5
Fix generation of libass.pc
Add MSVC project file and make changes needed for MSVC compilation
Work around some msvc debug asserts