Split some parts of ass_render_event into functions

The split doesn't necessarily follow any logic; for the most part
it just moves each processing loop into its own function.
Print debug message when loading a memory font
Check bitmap allocation for overflows

This actually fixes #146.

The overflow check itself is obvious. Also, make ass_align() return an
unaligned value if aligning it would overflow. This is probably better,
as it for example makes the overflow check in the caller simpler.
Check the overflow check for overflows

Seriously...

Checking for negative values might not be needed, but do it anyway.
Deal with code-duplication bullshit

Much of outline_to_bitmap() is duplicated. What?

Add the overflow check to duplicated code too.
Some more overflow checks
Fix some of the recently added checks
Provide a strndup() fallback

This standard function is not available everywhere, so we detect it and
provide a fallback if missing.
More malloc checking

Use strndup() instead of malloc+copy.

Make all code deal with the possibility that ASS_Drawing.text can be
NULL (which can happen on allocation failure).

Skip fix_collisions() on malloc failure - the lines will overlap, but at
least libass won't crash.
More malloc checking

In both cases, fallback to doing nothing if alloc fails.
Leave spline evaluation to rasterizer
Fix incorrect closing of last drawing contour
Flip coordinate system in rasterizer
Replace FT_Outline with ASS_Outline
Check allocations in drawing