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