[Bf-committers] Arabic support in text editing

Majid AL-Dharrab majid at aldharrab.com
Thu Oct 27 16:09:39 CEST 2011


I'm not sure if freetype2 alone can render Arabic/Bidi text perfectly. But
I'm sure that fribdi is simply inadequate. As I said earlier, Arabic text is
not just about converting letters to their presentation form. That approach
will render a lot of fonts unusable. Let alone all the languages that use
Arabic script and don't work with that simple approach. That problem can be
avoided using a more 'proper' method to handle layouts and shaping. And
let's not forget about all the other complex cases that can be solved with
an OpenType-based solution (Indic, Thai, diacritics, vertical text .. etc).
AFAIK, freetype2 alone doesn't deal with all of that. I might be wrong about
this but this is how I've remembered it for quite a while. You'll need a
developer's opinion to confirm that, though.

Pango is great. But as Sergey pointed out, it requires GLib, which is quite
a dependency. Also, I think its harfbuzz version is slightly out of date.
Not that important but it's something to consider. But if you think using it
instead of hooking up fribidi and harfbuzz directly is a better trade-off,
then by all means :)

On Thu, Oct 27, 2011 at 2:49 PM, Dalai Felinto <dfelinto at gmail.com> wrote:

> Shaping itself is already "kind-of" handled by freetype2. It may look
> wrong in some corner cases (e.g. those words that take off the
> ground). But overall the result of getting the text in their
> presentation form was working ok (not that I can tell good arabic from
> bad arabic, but Yousef himself seemed pleased with the result).
>
> Agree that fribidi may be buggy though. I'm my tests, at least the
> standalone (known to be buggy) produced a different enough result from
> our current _to_utf.py scripts.
>
> I know nothing about ligatures and how opentype (i.e. harfbuzz) does
> it better than freetype2. So I take your word for that.
> But what I heard (chatting on #harfbuzz) is that harfbuzz does not
> handle bi-di. I believe this is the reason why fribidi still plays an
> important role (or another bidi algorithm) and pango was suggested
> (given that it already integrates fribidi and harfbuzz).
>
> --
> Dalai
>
> 2011/10/26 Majid AL-Dharrab <majid at aldharrab.com>:
> > Actually, fribidi's shaper is very primitive and rudimentary and it has
> lots
> > of fundamental problems. It simply replaces letters with their Unicode
> > presentation forms depending on their position in a word. That is not a
> good
> > approach because it completely ignores ligatures and other OpenType
> > features, leading to broken support for most modern fonts that use
> OpenType
> > tables. That's why libass only uses a fribidi function that positions
> text
> > characters in the correct order, following rules from Unicode's bidi
> > algorithm (http://unicode.org/reports/tr9/#The_Paragraph_Level). Shaping
> is
> > then handled by HarfBuzz, which a great OpenType shaper.
> >
> > Unfortunately, I'm not a developer, so I'm afraid I can't help any
> further
> > with this issue. But you can contact libass's developer if you face any
> > problems with either lib. His GSoC project was supporting complex and
> bidi
> > scripts, so he probably knows a couple of tricks that might help. Good
> luck.
> > :)
> >
> > On Wed, Oct 26, 2011 at 9:57 AM, Dalai Felinto <dfelinto at gmail.com>
> wrote:
> >
> >> Thanks for the link.
> >>
> >> I looked at fribidi and found it interesting. Their standalone is
> >> doing the same as we are with the python scripts (they call it log2vis
> >> - to convert from logic to visual strings).
> >>
> >> Now, if we use this lib, do we still need harfbuzz? It seemed to me
> >> that truetype2 can handle most of the layout, no?
> >>
> >> --
> >> Dalai
> >>
> >> 2011/10/25 Majid AL-Dharrab <majid at aldharrab.com>:
> >> > I guess you can't go wrong with harfbuzz-ng on freetype2. After all,
> that
> >> is
> >> > what's used to render text in Firefox. libass, the SSA subtitle
> renderer
> >> > used in VLC and MPlayer, has recently started to support complex and
> bidi
> >> > scripts using harfbuzz and fribidi on top of freetype2. That resulted
> in
> >> > very sophisticated rendering of complex texts. Implementing that
> turned
> >> out
> >> > to be easier than the developer had thought.
> >> >
> >> >
> >>
> http://ssadev.blogspot.com/2011/05/getting-complex-text-layout-into-libass.html
> >> >
> >> > I hope his experience helps make the issue a bit easier for our
> Blender
> >> > devs. Good luck!
> >> > _______________________________________________
> >> > Bf-committers mailing list
> >> > Bf-committers at blender.org
> >> > http://lists.blender.org/mailman/listinfo/bf-committers
> >> >
> >> _______________________________________________
> >> Bf-committers mailing list
> >> Bf-committers at blender.org
> >> http://lists.blender.org/mailman/listinfo/bf-committers
> >>
> > _______________________________________________
> > Bf-committers mailing list
> > Bf-committers at blender.org
> > http://lists.blender.org/mailman/listinfo/bf-committers
> >
> _______________________________________________
> Bf-committers mailing list
> Bf-committers at blender.org
> http://lists.blender.org/mailman/listinfo/bf-committers
>


More information about the Bf-committers mailing list