[HarfBuzz] assert in hb_buffer_add_utf

Dejan Kovacevic dejan at d-type.com
Fri Nov 15 10:08:44 PST 2013


I *think* thins might be happening simply becasue in icu-le-hb the buffer is created in the LayoutEngine constructor and destroyed in destructor.  At the end of each layoutChars call, the buffer size is set to 0 by calling hb_buffer_set_length(fHbBuffer, 0). But between consecutive layoutChars calls the same buffer is used. My assumption is (I could be wrong though) that in some cases the buffer's content_type will be HB_BUFFER_CONTENT_TYPE_GLYPHS from the previous call. This then causes assert to fail when hb_buffer_add_utf16 is called before the next shaping call.

But so far I did not observe any other ill effects. As I said, the shaping process seems to work fine.

> -----Original Message----- 
> From: "Dejan Kovacevic" <dejan at d-type.com> 
> To: "Behdad Esfahbod" <behdad at behdad.org>, harfbuzz at lists.freedesktop.org 
> Date: 11/15/13 12:28 
> Subject: Re: [HarfBuzz] assert in hb_buffer_add_utf 
> 
> Yes, it appears icu-le-hb hits it. Other than that, seems to work fine (but will be doing some more testing later)...
> 
> > -----Original Message----- 
> > From: "Behdad Esfahbod" <behdad at behdad.org> 
> > To: "Dejan Kovacevic" <dejan at d-type.com>, harfbuzz at lists.freedesktop.org 
> > Date: 11/15/13 12:18 
> > Subject: Re: [HarfBuzz] assert in hb_buffer_add_utf 
> > 
> > On 13-11-15 12:13 PM, Dejan Kovacevic wrote:
> > > The hb_buffer_add_utf function starts with the following assert (hb-buffer.cc: line 1289):
> > > 
> > >   assert (buffer->content_type == HB_BUFFER_CONTENT_TYPE_UNICODE ||
> > >       (!buffer->len && buffer->content_type == HB_BUFFER_CONTENT_TYPE_INVALID));
> > > 
> > > I have observed that buffer->content_type can also be HB_BUFFER_CONTENT_TYPE_GLYPHS, in which case the assert fails. Not sure if this is by design.
> > 
> > That's exactly why the assert is there.  If you use the buffer correctly the
> > assert will never be hit.  Do you have a use case that is asserting currently?
> > 
> > -- 
> > behdad
> > http://behdad.org/
> 
> 
> _______________________________________________
> HarfBuzz mailing list
> HarfBuzz at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/harfbuzz





More information about the HarfBuzz mailing list