<div dir="ltr"><div class="gmail_default" style="font-size:small">The most frustrating thing about sending mail to a mailing list asking a question is that everyone treats you like a junior programmer.</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<span class=""><br>
> I am not able to conceive of any version of "render glyph" whose<br>
> implementation does not involve adding horiBearingX<br>
<br>
</span>Can you show your code? What are you using to turn the glyph onto pixels<br>
on the screen?<br>
<br>
Normally people doing text layout don't do that bit themselves - they<br>
use a third party rendering library to do it. *That* library needs to<br>
care about sidebearings, but those of us working on the text layout<br>
layer just need to worry about where the box starts and where the next<br>
box is.<br></blockquote><div><br></div><div><div class="gmail_default" style="font-size:small;display:inline">"*That* library" is my code that I am talking about.</div></div><div><div class="gmail_default" style="font-size:small;display:inline"><br></div></div><div><div class="gmail_default" style="font-size:small">​The first time I encounter a glyph that has not been rendered, I allocate space for it in a texture map in a reasonably-tightly-packed way according to the metrics given by FT, use FT_Load_Glyph(..., FT_LOAD_RENDER) to rasterize the glyph, copy the rasterized data into the texture map, then flag the texture as dirty so it will be uploaded to the GPU next time I use it.</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">In order to do this kind of thing, one only allocates space for the rectangular area in the glyph that actually uses any pixels, because packing empty space is dumb and wasteful. So when rendering glyphs, what one thinks of as "the glyph" is the actual rectangle that actually contains pixels in it. The bearing is then just the delta from the cursor position to the place at which you actually want to draw the glyph.</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">In other words, it is an offset. "Bearings" and "offsets" are Exactly. The. Same. Thing. The difference is just that the "bearing" is constant per glyph but HB's "offset" which I guess is due to kerning (and whatever else) varies per instance of a glyph. That is the only difference. You only think they aren't the same thing if you are hiding implementation details from yourself (which for many people is fine, if you don't need to think about lower-level code, great, go to town).</div><br></div></div></div></div>