[HarfBuzz] Setting initial cluster value

Khaled Hosny khaledhosny at eglug.org
Sat Jun 25 16:51:28 UTC 2016


On Sat, Jun 25, 2016 at 12:00:55PM -0400, Kelvin Ma wrote:
> On Sat, Jun 25, 2016 at 8:57 AM, Khaled Hosny <khaledhosny at eglug.org> wrote:
> 
> > On Fri, Jun 24, 2016 at 10:06:07PM -0400, Kelvin Ma wrote:
> > > How do you set the initial cluster value? So that harfbuzz will start
> > > counting from some number like 25 instead of 0.
> >
> > Use hb_buffer_add(), or just do 25 + cluster in your code.
> >
> > >                                                 Also what’s the point of
> > > *item_offset* and *item_length* in the buffer_add functions?
> >
> > It is explained in the documentation:
> >
> > http://behdad.github.io/harfbuzz/harfbuzz-Buffers.html#hb-buffer-add-codepoints
> >
> >
> So you have to add the text to the buffer one letter at a time? That could
> get very slow with python loops and function calls

Use the other method then.

> > >                                                               Don’t you
> > need
> > > context to be ignored if the boundaries of the text you want to shape
> > fall
> > > inside a cluster? Like in the string 'af[fluency s]tate' where only the
> > > 'fluency s' is supposed to be shaped?
> >
> > Depends on why you are shaping “fluency s” alone, if it is because of,
> > say, font change, then you need HarfBuzz to know the context otherwise
> > you get broken Arabic shaping.
> 
> Well font change would produce a separate run that wouldn’t know about the
> other runs so context can only be within a same-direction, same-font run.

This is wrong, font change shouldn’t break Arabic shaping, so you have
to pass the context even in this case.

> But would adding the context & using the start and finish indexes cause
> latin ligatures like fi to get shaped when they shouldn’t be is what I’m
> asking?

No, they won’t, but why you would want to do that?

Regards,
Khaled


More information about the HarfBuzz mailing list