[HarfBuzz] Can I only reshape broken clusters?

Behdad Esfahbod behdad at behdad.org
Fri Jul 1 04:10:40 UTC 2016


On Thu, Jun 30, 2016 at 9:06 PM,  <kelvinsthirteen at gmail.com> wrote:
>
>
>> On Jun 30, 2016, at 11:41 PM, Behdad Esfahbod <behdad at behdad.org> wrote:
>>
>> No, it wouldn't be safe necessarily.  That's exactly what the
>> unsafe-to-break API is about, but that's not finished yet.  For now,
>> you have to reshape the entire new string.
>
> That’s O(n^2) in terms of the amount of shaping that has to be done per paragraph based on the length of the paragraph text, and not workable in practice

What Pango (and possibly other systems) does is to shape the full
paragraph, then find line-break location, then reshape the
just-decided line but continue with the rest of the paragraph as if
the shaping wouldn't change the width much.

>>> On Thu, Jun 30, 2016 at 8:31 PM, Kelvin Ma <kelvinsthirteen at gmail.com> wrote:
>>> If I have the string A = 'affifibcd' and the master list of shaped glyphs
>>>
>>> [a 0] [ffi 1] [fi 4] [b 6] [c 7] [d 8]
>>>
>>> and I wanted to shape the substring A[2:] ('fifibcd'), could I simply take
>>> my preshaped glyphs after the cluster at or above (ceiling) i = 2 and only
>>> reshape the segment A[2:6]?
>>>
>>> So I would reuse the glyphs
>>>
>>> [fi 4] [b 6] [c 7] [d 8]
>>>
>>> and reshape the segment A[2:6] = 'fifi' to get
>>>
>>> [fi 2] [fi 4]
>>>
>>> and add them together (dropping the last glyph in the reshaped segment) to
>>> get
>>>
>>> [fi 2]  [fi 4] [b 6] [c 7] [d 8]
>>>
>>> ?
>>> Would this be the same result as reshaping the entire segment A[2:]? Would
>>> this still work for RTL text, or a substring that’s on the left-hand side of
>>> the parent string like A[:5] = 'affif'?
>>>
>>> _______________________________________________
>>> HarfBuzz mailing list
>>> HarfBuzz at lists.freedesktop.org
>>> https://lists.freedesktop.org/mailman/listinfo/harfbuzz
>>>
>>
>>
>>
>> --
>> behdad
>> http://behdad.org/



-- 
behdad
http://behdad.org/


More information about the HarfBuzz mailing list