Athan's Q3F Beta2 HUD Editting TUTORIAL - General Text Alignment

Introduction

This document aims to inform you of the methods of aligning text in q3f2 HUDs so you can get any text you customise 'Just So'.

Alignment Point

The concept of the alignment point is very important to correctly aligning text in q3f2 HUDs. This is the point around which the text is aligned.

This is, by default, defined as the x,y co-ordinate in the itemDef's rect keyword. However, it can further be modified by the textalignx and textaligny keywords.

If you have a 'rect 0 0 40 16' in the itemDef then any text will be aligned around the top left corner of the menuDef containing the itemDef.

If, instead, you want the text to be aligned around the middle of the itemDef area you'd need to use:

    textalignx 20
    textaligny 8
    
These shift the alignment point 20 pixels right and 8 pixels down from the position in the itemDef rect.

Specifying Alignment Around the Alignment Point

You specify how text is aligned around the Alignment Point using the textalign keyword. Possible values are:

In the examples above "|" represents the Alignment Point.

Important NOTE

On some types of item, notably the team score/ping/count numbers any textalignx or textaligny value will be applied TWICE to the text actually drawn in it, but only once if you test it with a 'text "foo"' line in the same itemDef. I'd advise NOT using textalignx/y unless you really need to, just move the itemDef rect within the menuDef as needed instead.


Neil Charley, aka Athan - q3f@gurus.tf