[HarfBuzz] harfbuzz versus fribidi
Stephen Burke
steve.burke.56 at gmail.com
Tue Aug 25 00:35:42 PDT 2015
Thanks. That explanation put together some pieces that weren't fully
making sense like why fribidi was doing the shaping for Arabic/Persian
and Hebrew.
Is there a project using Harfbuzz that I can look at for some sample
code or if not what header should I start looking at? I tried
searching through my package manager for fribidi on ubuntu and ended
up looking at a project that had some bugs related to the sizes going
in and coming out of log2vis.
On Sat, Aug 22, 2015 at 10:27 AM, eduardo <eduardo at brainstorm.es> wrote:
> Hi Stephen,
>
> AFAIK, harfbuzz is not a replacement for fribidi. They are different
> libraries that solve diferent problems.
>
> (disclaimer: this information is probably very inaccurate but it ended up
> working for us)
>
> Fribidi solves bidirectional text layout and Harfbuzz solves text shaping.
>
>
>
> Bidirectional text layout is needed when you merge LTR and RTL segments in
> the same text because it is not always trivial to know what segment of text
> goes in what position. For instance (imagine the text I write backwards is
> some RTL language)
>
> dias eH
> "Hello, my name is
> odraudE
> "
>
> In one line, it should look like this:
>
> "Hello, my name odraudE" is dias eH
>
> This is what fribidi solves. And it is based on an algorithm named "The
> unicode bidirectional algorithm".
>
>
>
>
> Harfbuzz solves text shaping. In occidental alphabets there is (roughly)
> only one visual representation for each character, but not in other
> alphabets. For instance, in tamil you have:
>
> ட + உ = டு
>
> There is no unicode number for டு because it is not a character. It is the
> visual representation of two characters, also called "glyph". You can put
> your cursor on the right and press backspace to delete the latest one and
> you will see the first one.
>
> Different sets of characters have different visual representations which not
> always have to do with what those characters look like when they are
> presented out of context (standalone presentation).
>
> How to draw each set of characters, depends on the font. Opentype and
> truetype fonts have a set of tables the software can look up in order to
> know what glyph to use in what context.
>
> That's basically what harfbuzz does. Harfbuzz can only work with paragraphs
> that use one single alphabet.
>
> but....
>
>
>
> FriBidi also does shaping for some languages and Harfbuzz also sorts the
> characters properly when the segment is RTL
>
> FriBidi only does shaping for Arabic/Persian and Hebrew. That's basically
> because all the glyphs for those languages have a unicode number the shaping
> can be done without checking any font table. And also because Behdad is
> persian ^^ So if you are only worried about those languages, using only
> FriBidi is ok. However, it doesn't support diacritic accents which some user
> might demand.
>
> Harbuzz inverts the segment of text if you tell harfbuzz that text is RTL.
> So it might also be ok to only use Harfbuzz if you are not going to write
> bidirectional paragraphs (either only english or only arabic).
>
> But if you want both things, you have to send the text first to FriBidi,
> then to harfbuzz and always tell harfbuzz the text is LTR, because fribidi
> already put the arabic characters in their correct order and harfbuzz will
> invert them. So in this case, you have to lie to harfbuzz and tell him
> arabic is LTR.
>
> As I said before, there are probably a lot of false claims, but this worked
> for us for a couple of years and our users (from Lebanon, Iran, India and
> Thailand) are happy, and so we are.
>
> Hope this helps.
>
> Edu.
>
>
>
>
>
> On 21.08.2015 16:31, Stephen Burke wrote:
>>
>> I just put in support for bidi text using fribidi and the log2vis api.
>> There are numerous warnings about using this api saying it is
>> deprecated but it is the most user friendly for a developer.
>>
>> Can you describe the upgrade path to harfbuzz? Why would I want to
>> use that library and what's the difference between fribidi and
>> harfbuzz?
>>
>> Thanks.--
>>
>> Steve
>> www.stayathomedevs.com [1]
>>
>> Game Data Editor Unity Plugin [2]
>>
>> Links:
>> ------
>> [1] http://www.stayathomedevs.com
>> [2] https://www.assetstore.unity3d.com/en/#!/content/18480
>>
>> _______________________________________________
>> HarfBuzz mailing list
>> HarfBuzz at lists.freedesktop.org
>> http://lists.freedesktop.org/mailman/listinfo/harfbuzz
>
>
--
Steve
www.stayathomedevs.com
Game Data Editor Unity Plugin
More information about the HarfBuzz
mailing list