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.