Skip useless memset() when copying a bitmap
shaper: add FriBidi error handling

It is unlikely, but FriBidi might not process a string correctly,
and we should handle that. Tested by making it fail always. This
should also fix some compiler warnings.
Merge pull request #102 from grigorig/fribidi-errorhandle

shaper: add FriBidi error handling
Minor refactor as preparation for LayoutResX/Y

Reduces the diff for the next commit. No functional changes.
Implement LayoutResX/LayoutResY

This allows ASS scripts to be independent from video resolution.