<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Mon, Apr 4, 2016 at 12:45 PM, Khaled Hosny <span dir="ltr"><<a href="mailto:khaledhosny@eglug.org" target="_blank">khaledhosny@eglug.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On Tue, Mar 22, 2016 at 10:52:43PM +0000, Jamie Dale wrote:<br>
> Hey all,<br>
><br>
> I've spent today fixing some issues in our editable text controls, mostly<br>
> relating to issues caused by the difference between characters and grapheme<br>
> clusters.<br>
><br>
> I've sorted most of my issues now, but I'm still having an issue the لا<br>
> ligature in Arabic.<br>
><br>
> My current code that performs picking on text, or applies formatting to<br>
> text that spans a ligature, assumes that any ligature can be split into its<br>
> component grapheme clusters, however this assumption does not hold true for<br>
> that ligature as it cannot be split.<br>
><br>
> Does HarfBuzz have a way to identify these mandatory ligatures, or failing<br>
> that, how do people generally deal with this sort of thing? I have ICU<br>
> available if it has anything that can help?<br>
<br>
</span>You just don’t try to identify mandatory ligatures. What we are doing in<br>
Scribus (that bit of code is not published yet) is to treat all<br>
ligatures as unbreakable. You simply find how many characters in a<br></blockquote><div><br></div><div>s/characters/Unicode graphemes/<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
ligature, distribute the width on them and find the width of the<br>
selected part, draw the selection rectangle then render the ligature<br>
twice once with the highlight color clipped to the width of the selected<br>
area and once with the regular color clipped to the rest of the glyph<br>
width. You can try to use hb_ot_layout_get_ligature_carets() to get<br>
better positions than simply distributing the width over the number of<br>
components, but very few fonts support it and you will need a fallback<br>
code anyway.<br>
<br>
I believe this is essentially what Firefox does as well.<br>
<br>
Regards,<br>
Khaled<br>
<div class="HOEnZb"><div class="h5">><br>
> Thanks,<br>
> Jamie.<br>
<br>
> _______________________________________________<br>
> HarfBuzz mailing list<br>
> <a href="mailto:HarfBuzz@lists.freedesktop.org">HarfBuzz@lists.freedesktop.org</a><br>
> <a href="https://lists.freedesktop.org/mailman/listinfo/harfbuzz" rel="noreferrer" target="_blank">https://lists.freedesktop.org/mailman/listinfo/harfbuzz</a><br>
<br>
_______________________________________________<br>
HarfBuzz mailing list<br>
<a href="mailto:HarfBuzz@lists.freedesktop.org">HarfBuzz@lists.freedesktop.org</a><br>
<a href="https://lists.freedesktop.org/mailman/listinfo/harfbuzz" rel="noreferrer" target="_blank">https://lists.freedesktop.org/mailman/listinfo/harfbuzz</a><br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br><div class="gmail_signature">behdad<br><a href="http://behdad.org/" target="_blank">http://behdad.org/</a></div>
</div></div>