[HarfBuzz] HarfBuzz glyph offsets
Simon Cozens
simon at simon-cozens.org
Wed Dec 23 18:33:48 PST 2015
On 24/12/2015 07:37, Jonathan Blow wrote:
> ​When I look at this diagram from the
> FreeType documentation:
>
> http://www.freetype.org/freetype2/docs/tutorial/step2.html
>
> It says that wherever the cursor is, add bearingX as an offset and draw
> the thing in the box.
No, it doesn't. That documentation doesn't tell you anything about how
to lay out text. It is explaining glyph metrics - telling you about how
various things inside a glyph are measured. In that diagram, it says
that the measurement between the origin and the left bit of black ink
inside the glyph is called bearingX. But most people don't need to care
about that!
> I am not able to conceive of any version of "render glyph" whose
> implementation does not involve adding horiBearingX
Can you show your code? What are you using to turn the glyph onto pixels
on the screen?
Normally people doing text layout don't do that bit themselves - they
use a third party rendering library to do it. *That* library needs to
care about sidebearings, but those of us working on the text layout
layer just need to worry about where the box starts and where the next
box is.
This is how offsets and bearings are different: an offset says "for
correct text rendering, you will need to shift this particular box a
bit." Within that (shifted) box, the text rendering layer will *still*
need to apply the correct bearings for the glyph that you've shifted -
but again, you don't need to care about that.
> But since there doesn't seem to be any real HB documentation anywhere
> that I can find, I don't really know.
I'm sorry about this. There is the beginnings of a user manual. (did you
build the docs when you built Harfbuzz?), and Khaled is working on
publishing it on the web. I am trying to complete it, but I am insanely
busy with life stuff at the moment. I should have more time in February.
More information about the HarfBuzz
mailing list