Italic angle and origin coordinates

I’m trying to draw a rectangle of a glyph bounding box. When doing so for Italics, I found very weird behavior when it comes to the coordinate origin.

A path from x 0 y 0 to x 0 y 250:

A path from x 0 y 0 to x 0 y 100:

It seems that for italic angle x = 0 is at half the xHeight?!

I get that the editor only shows this as arbitrary value and the hmtx and LSB there that gets compiled are based on the outlines/bounds, which would be tedious to work with in when drawing glyphs. But why is italic x 0 not at the baseline or somewhere more… I don’t know… sensible? How does half xHeight make sense? Am I missing something entirely here?

Yes, correct. The italic slant origin is at half x-height, at least in Glyphs.

The idea to have the same horizontal position when having upright and italic next to each other.
You can define your own slant position but I not seen a case that was needed.

Okay, I guess it’s arbitrary.

My use case was drawing a (skewed) box around the glyph that matches it’s horizontal metrics and vertical extrema (I want to visually compare metrics changes). Maybe it’s useful to someone in the future, the x position origin offset is there in the transformation matrix:

# Create a new path
rectangle_path = GSPath()

# Create nodes for the rectangle (clockwise from bottom-left)
rectangle_path.nodes = [
	GSNode((x, y), GSLINE),                   # Bottom-left
	GSNode((x + width, y), GSLINE),           # Bottom-right
	GSNode((x + width, y + height), GSLINE),  # Top-right
	GSNode((x, y + height), GSLINE)           # Top-left
]

# Close the path
rectangle_path.closed = True

# Skew the rectangle, offset to the left to match 0,0 origin
rectangle_path.applyTransform([
	1, # x scale factor
	0, # x skew factor
	math.tan(math.radians(italicAngle)), # y skew factor
	1, # y scale factor
	-math.tan(math.radians(italicAngle))*xHeight/2, # x position
	0  # y position
])