[HarfBuzz] harfbuzz coordinate system

Jonathan Kew jonathan at jfkew.plus.com
Fri Oct 29 15:19:57 PDT 2010


On 29 Oct 2010, at 01:55, Martin Hosken wrote:

> Dear Behdad,
> 
>> I think I'm going to make that change, especially since everytime I hooked up
>> HarfBuzz to another system, it worked the first try except for a missing
>> negation sign for y_offset.
> 
> I don't think it matters too much which way you jump on this one so long as:
> 
> 1. You clearly state the directionality in lots of places in the documentation and code.
> 
> 2. You make it clear where the different y directionalities are used. For example, what should a call to a font metrics function return? If it is as per a font with y increasing up the page, then where in the code does the y directionality switch?
> 
> I sympathise with the quandary: font designers think in terms of y going up the page, while graphics programmers think of y increasing down the page.

Yes, there are arguments either way.

Personally, I'd recommend that harfbuzz keeps y increasing upwards, as I think that is the "natural" way to deal with text -- in the context of horizontal, left-to-right (or indeed right-to-left) text, I'd instinctively think of a positive y-displacement as raising a glyph.

I'm certainly aware of the potential for y-direction bugs in higher-level text+graphics systems, having both made and fixed such errors personally, but I don't think flipping harfbuzz's coordinate system will particularly prevent this. Whichever way you do it, mistakes will be made, and not noticed until people test fonts that actually use y-displacements.

So FWIW, my preference would be to keep the y-axis pointing up. I think that's "right" for a text-centric API, and I don't think making a change will really gain anything.

JK




More information about the HarfBuzz mailing list