That depends on whether you want left or right justified text but in the centre of the window or if you just want centre justified text.
Centre justified is the easiest - you just have to change the anchor code.
DEFINE STYLE "own" "arial", 1.5,
2, 0
2 will be centre justified with the anchor at the top of the text (height wise).
5 will be centre justified with the anchor in the centre of the text (height wise).
8 will be centre justified with the anchor at the bottom of the text (height wise).
If you want to keep the left or right justification then you will have to find the length of the text string as you have already done.
Barry.
One of the forum moderators.
Versions 6.5 to 27
i7-10700 @ 2.9Ghz, 32GB ram, GeForce RTX 2060 (6GB), Windows 10
Lenovo Thinkpad - i7-1270P 2.20 GHz, 32GB RAM, Nvidia T550, Windows 11