[HarfBuzz] How to increase harfbuzz numerical precision

Kelvin Ma kelvinsthirteen at gmail.com
Tue Jun 28 23:09:18 UTC 2016


Helps to get users of your library if you don’t act like everyone trying to
learn it is already an expert on all the hidden intricacies of it.


P.S. font_get_ppem() returns zero for every font. Maybe I am using it wrong
but I wouldn’t know, I didn’t write the thing.

hb_font = hb.font_create(hb_face)
hb.font_set_scale(hb_font, projection['fontsize'], projection['fontsize'])
hb.ot_font_set_funcs(hb_font)
print(hb.font_get_ppem(hb_font))

>>> (x_ppem=0, y_ppem=0)

On Tue, Jun 28, 2016 at 7:01 PM, Behdad Esfahbod <behdad at behdad.org> wrote:

> On Tue, Jun 28, 2016 at 6:56 PM, Kelvin Ma <kelvinsthirteen at gmail.com>
> wrote:
>
>> No, i’m asking why harfbuzz has the concept of multiple fonts per face,
>> if that concept is useless in practice.
>>
>
> Helps if you ask without baking your own presumptions into the question.
> hb_font_t exists to hold all "configuration" needed.  Adding that to
> hb_face_t would have made the face unusable from multiple threads.
>
> Such configuration is mainly the scale, and indeed, many clients shape
> with one font all the time.  But there are other stuff.  ppem is the other
> one.  When "OpenType GX" variation fonts become a thing, the variation
> parameters will also be set on hb_font_t.
>
>
>> On Tue, Jun 28, 2016 at 6:54 PM, Behdad Esfahbod <behdad at behdad.org>
>> wrote:
>>
>>> You can't have both.  Pick which you like.
>>>
>>> On Tue, Jun 28, 2016 at 6:43 PM, Kelvin Ma <kelvinsthirteen at gmail.com>
>>> wrote:
>>>
>>>> so that’s the only way huh…
>>>> doesn’t that kind of defeat the purpose of hb.font_create() and having
>>>> many scaled versions of the same font? You would only ever need one font of
>>>> each face, scaled to the UPEM, if the fontsize was to be applied externally
>>>> after shaping already occurred.
>>>>
>>>> On Tue, Jun 28, 2016 at 5:51 PM, Behdad Esfahbod <behdad at behdad.org>
>>>> wrote:
>>>>
>>>>> HarfBuzz coordinates work in a int32 space.  You are free to set
>>>>> whatever scales you want on the font.  For example, use 6 or 8 or 10 or 16
>>>>> bits of sub-pixel precision by multiplying your scale by a number.
>>>>>
>>>>> On Tue, Jun 28, 2016 at 4:57 PM, Kelvin Ma <kelvinsthirteen at gmail.com>
>>>>> wrote:
>>>>>
>>>>>> It appears that harfbuzz rounds all decimals to integers when giving
>>>>>> glyph advances and offsets. This is causing some ugly misalignment problems
>>>>>> in arabic shaping, as well as latin cursive fonts. (see pictures)
>>>>>>
>>>>>> [image: Inline image 1]
>>>>>>
>>>>>> [image: Inline image 2]
>>>>>>
>>>>>> [image: Inline image 3]
>>>>>> How do I get harfbuzz to preserve the floats?
>>>>>>
>>>>>> _______________________________________________
>>>>>> HarfBuzz mailing list
>>>>>> HarfBuzz at lists.freedesktop.org
>>>>>> https://lists.freedesktop.org/mailman/listinfo/harfbuzz
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> behdad
>>>>> http://behdad.org/
>>>>>
>>>>
>>>>
>>>
>>>
>>> --
>>> behdad
>>> http://behdad.org/
>>>
>>
>>
>
>
> --
> behdad
> http://behdad.org/
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/harfbuzz/attachments/20160628/8b23f2d4/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Selection_051.png
Type: image/png
Size: 14685 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/harfbuzz/attachments/20160628/8b23f2d4/attachment-0003.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Selection_053.png
Type: image/png
Size: 28797 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/harfbuzz/attachments/20160628/8b23f2d4/attachment-0004.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Selection_052.png
Type: image/png
Size: 19958 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/harfbuzz/attachments/20160628/8b23f2d4/attachment-0005.png>


More information about the HarfBuzz mailing list