<html>
<head>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<div class="moz-cite-prefix">Hi Behdad,<br>
<br>
I already implemented a solution and it seems to be working. This
is basically what I do:<br>
<br>
1) Use fribidi to extract the v2l and dir tables (get_bidi_types).<br>
<br>
2) Re-order the string using the v2l table:<br>
For every character:<br>
strOut[i] = strIn[v2l[i]]<br>
<br>
((( Now strOut is ordered but not shaped )))<br>
<br>
3) Split the string in direction runs using the criteria:<br>
dir[ v2l[i] ] != dir[ v2l[i-1] ]<br>
<br>
4) Shape each run separately telling harfbuzz everything is LTR.<br>
<br>
5) For every glyph<br>
g->cluster = v2l[g->cluster]<br>
<br>
6) profit!<br>
<br>
But I have two questions:<br>
<br>
1) Splitting by BiDi type looks like a bad idea because the spaces
are WS while arabic and english text are AL and LTR respectively.
So it is forcing algorithm to shape every word separately,
creating and destroying the hb_buffer each time. Would it be a
better idea to use the BiDi levels as the split criteria?<br>
<br>
2) Is there anything wrong with reordering arabic characters from
LTR to RTL and then shape them as if they were LTR?<br>
<br>
Thanks!<br>
<br>
El 30/10/2013 17:08, Behdad Esfahbod escribió:<br>
</div>
<blockquote
cite="mid:CAF63+7V=Pw+zPJKWtR29_esJmFZW3J3NC-Yns_=6=8mXU4BTmw@mail.gmail.com"
type="cite">
<p dir="ltr">You got it mostly right. I'll reply to you in detail
next week. Traveling right now.</p>
<div class="gmail_quote">On Oct 30, 2013 3:56 PM, "eduardo" <<a
moz-do-not-send="true" href="mailto:eduardo@brainstorm.es">eduardo@brainstorm.es</a>>
wrote:<br type="attribution">
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">
BiDi/harfbuzz integration code samples are also welcome<br>
<br>
On Mon, 28 Oct 2013 12:48:09 +0100, Eduardo Castineyra wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi,<br>
<br>
I have an unicode string with the bidi already solved, but I
don't<br>
know exactly how to feed harfbuzz with the result. There is
a list of<br>
things I don't know and finally my guess on how this should
be solved:<br>
<br>
1) Given the friBiDi already switched the order of the
glyhs, do I<br>
still need to set the buffer direction to RTL ?<br>
2) Do I have to shape each unidirectional segment
separately? How do<br>
I manage the clusters?<br>
3) How do I combine the L_to_V output from friBiDi with the
hb clusters?<br>
<br>
Could you please correct me if I got something wrong with
this algorithm?<br>
<br>
from friBiDi, I'm using only the l2v, v2l and RTL props, and<br>
completely discarding the glyhps:<br>
<br>
1) friBiDi pass<br>
2) Using the l2v list identify the direction of every
character<br>
3) Split the original text into monodirectional runs.<br>
4) For each run, we save the lowest visual position (LVP)
and the<br>
lowest logical position (LLP)<br>
5) Shape every segment separately (setting the appropriate
buffer direction).<br>
6) Sort the segments based on their LVP<br>
7) Add the LLP to the cluster of every glyph.<br>
<br>
Isn't there an easier way to do this?<br>
<br>
Thanks!<br>
_______________________________________________<br>
HarfBuzz mailing list<br>
<a moz-do-not-send="true"
href="mailto:HarfBuzz@lists.freedesktop.org"
target="_blank">HarfBuzz@lists.freedesktop.org</a><br>
<a moz-do-not-send="true"
href="http://lists.freedesktop.org/mailman/listinfo/harfbuzz"
target="_blank">http://lists.freedesktop.org/mailman/listinfo/harfbuzz</a><br>
</blockquote>
<br>
_______________________________________________<br>
HarfBuzz mailing list<br>
<a moz-do-not-send="true"
href="mailto:HarfBuzz@lists.freedesktop.org" target="_blank">HarfBuzz@lists.freedesktop.org</a><br>
<a moz-do-not-send="true"
href="http://lists.freedesktop.org/mailman/listinfo/harfbuzz"
target="_blank">http://lists.freedesktop.org/mailman/listinfo/harfbuzz</a><br>
</blockquote>
</div>
</blockquote>
<br>
</body>
</html>