[HarfBuzz] HarfBuzz API design
Behdad Esfahbod
behdad at behdad.org
Wed Aug 19 18:06:22 PDT 2009
On 08/19/2009 08:42 PM, Martin Sevior wrote:
> Hi Behdad,
> Thanks very much for this.
Hi Martin,
> One issue that we've talked about is highlighting selected text. Is
> there some way to change the font colour/background and draw between
> clusters after shaping? The draw should keep the shaped characters at
> the offsets they would have had the draw been over the complete set of
> text.
The right way to do this indeed is to not reshape the selected text. The
cluster mapping should give you the clusters you need to highlight. The main
problem however is what to do when only part of a cluster is selected. For
now, what one can do (and indeed what GTK+/Pango do) is to distribute the
cluster width evenly among the characters comprising it. OpenType does
provide some further information about how wide individual components of a
ligature are. That information is exposed by HarfBuzz using the
OpenType-specific API. As I was saying in reply to Adam, I'm waiting to see
how other systems handle this before adding a generic API for that.
> We're implementing a work around that involves drawing selected text
> twice in AbiWord.
That's actually not that bad.
> I didn't see selections mentioned in your API but they're an important
> part of interactive text manipulation. It would be great if they could
> be addressed in a high level API.
Yes, that's something I do have in mind. However, the shaper is way lower
than when actual selection and rendering happens, so it's natural to expect
the higher level to have to walk the clusters manually. At least for now.
Cheers,
behdad
> Cheers
>
> Martin
More information about the HarfBuzz
mailing list