TextNode Position

Hi all,

I’m having a bit of trouble getting a TextNode to vertically align exactly as I’m expecting it to. As a test, I created a TextNode parented to render2d and am trying to place text in the top-left corner of the screen. The horizontal alignment works perfectly with the x component of the position set to -1. However, with the z component set to +1, the text always appears about one line above the top of the screen on the vertical axis. I tried this using different scales, including 1.0, and the result is similar.

Does anyone know what accounts for this?

The Z origin of the text is located at the baseline. Don’t hesitate to use bounds :

def vertAlign(OST,align):
    # align = 0: top, 1: center, 2:bottom
    z=[ 1-b[1][2], -(b[1]+b[0])[2]*.5, -b[0][2]-1]

OTvert=OnscreenText("vertical ALIGNMENT\nexperiment",scale=.1)