<div dir="ltr">Simon,<div><br></div><div>You are confusing a few different things! The width reported by glyph extents is the ink width. That's different from advance width because even without kerning, adjacent glyphs typically don't touch each other.</div><div><br></div><div>You need the advance width, and you can get that using hb_font_get_glyph_h_advance().</div><div><br></div><div>Also, don't try to second-guess the shaper, ever! Even if you turn kern feature off, other things might be happening that change the advance width, so never assume that it's the default advance width even if kern feature is off.</div><div><br></div><div>behdad</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Sep 4, 2015 at 3:32 AM, Simon Cozens <span dir="ltr"><<a href="mailto:simon@simon-cozens.org" target="_blank">simon@simon-cozens.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">So I'm using Harfbuzz to shape stuff and put it out to PDF. When you<br>
output a string in PDF, you are expected to kern it manually, or else<br>
each glyph will be placed one after the other with no kerning:<br>
<br>
No kerning: Td (VAVAVOOM) Tj<br>
Kerning: Td[(V) 153 (A) 122 (V) ... ]TJ<br>
<br>
The numeric values in the TJ array are the distances to go back after<br>
the glyph is painted. In other words, this is the unkerned X advance<br>
minus the kerned X advance.<br>
<br>
I had assumed that the unkerned glyph advance was the width of the<br>
character, but that's not the case:<br>
<br>
$ hb-shape --features='-kern' --show-extents<br>
/Library/Fonts/SuperClarendon.ttc 'VAV'<br>
[V=0+900<38,761,824,-761>|A=1+900<38,761,824,-761>|V=2+900<38,761,824,-761>]<br>
<br>
(This is not an OT/FT difference.)<br>
<br>
If I want to support OpenType kerning, and I need to compute the<br>
distance-to-go-back, do I really have to shape everything twice and then<br>
compare the x advances, or is there a smarter way to do it?<br>
_______________________________________________<br>
HarfBuzz mailing list<br>
<a href="mailto:HarfBuzz@lists.freedesktop.org">HarfBuzz@lists.freedesktop.org</a><br>
<a href="http://lists.freedesktop.org/mailman/listinfo/harfbuzz" rel="noreferrer" target="_blank">http://lists.freedesktop.org/mailman/listinfo/harfbuzz</a><br>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature">behdad<br><a href="http://behdad.org/" target="_blank">http://behdad.org/</a></div>
</div>