bidi / rtl language support in Ruby (Rails)

As long as you are only doing web things with HTML Ruby and Rails are
doing well with Arabic / Hebrew languages. As soon as you want to
export that data into lets say an image or a pdf you need to reorder
the UTF-8 string with a so called "bidi" algorithm.

Has anyone implemented this in Ruby? Or exists a wrapper for Pretty
Good Bidi Algorithm or
fribidi ( ?