# [Cairo] Re: [xsvg] cairo_text_extents ?

Bill Spitzak spitzak at d2.com
Wed Nov 26 10:57:00 PST 2003

```On Tuesday 25 November 2003 09:13 pm, John Ellson wrote:

> I recommend the diagrams in the freetype tutorial for understanding the
> different measures:
>
>     http://freetype.sourceforge.net/freetype2/docs/tutorial/step2.html

First of all, there appears to always be a box aligned with an axis. This box
can always be described by 4 numbers. Therefore there should be exactly 4
numbers describing the box, any more or less and it is obviously wrong. There
is also an "advance" which can be 1 or 2 numbers, depending on whether
y_advance is defined to be zero.

1. From the diagram assumme the origin is 0,0. Then bearingX and xMin are
identical. I think we can conclude that the left edge of the box must be a
coordinate (ie increasing it moves the edge right).

2. I think to be consistent a vertical edge must also be stored as a
coordinate. To match Cairo coordinates, this probably should be the bottom
edge. The problem with this is that the coordinate will usually be negative,
but this is also true of the left edge for many modern typefaces.

3. The width is alternately stored as width or xMax. Storing it as width has
the advantage of allowing you to use unsigned to insist that it is positive.
But in my experience the xMax is much more useful, so I would recommend that.

4. For consistency the top should then be a yMax.

I have gotten zero response to my proposal that there be two matricies, so
that the y_advance can be defined as zero, and the user can choose exaclty
what coordinate system the metricies are returned in. Has anybody read it? Is
it a stupid idea, or why isn't anybody saying anything?

In my opinion the zero-y_advance idea will work, so imagine the second
drawing of vertical text rotated sideways so the "advance" is in the x
direction, and X and Y and width and height have been swapped in all the
names, and yMin and yMax have been swapped. It is then identical except
bearingY is in the opposite direction.

Anyway my current recommendation is:

xmin, ymin, xmax, ymax, x_advance

--
,~,~,~,~ ~ ~ ~ ~
/\_       _|_========___         Bill Spitzak
~~~/\/\\~~~~~~\____________/~~~~~~~~ spitzak at d2.com

```