I still don't understand why my code didn't work. I believe it means that the width of the '-' measured separately is different than it's width when included in a string. Perhaps something to do with intercharacter spacing?
I ended up trying what I didn't want to do, just to get the code working for now until I find a better solution. Turns out it wasn't as ugly as I thought it would be.
The reason your code doesn't work is because you have not calculated the proper X coordinates and alignments for the different types of numbers you need to print/display.
There is a simple example of how to align text at
https://forum.lazarus.freepascal.org/index.php/topic,42224.msg294497.html#msg294497Based on what you stated in your post, you need to calculate the maximum width a number can take. From what you've shown that seems to be a number such as <999,999,999>. Calculate the width of "9>" subtract from that the width of "9", that will give you the width of ">" including the inter character spacing. With that you can calculate the X coordinate of all numbers and the X coordinate of where the ">" should always go. Using the width of ">" and "-", you can calculate the X coordinate where the "-" should go. Using SetTextAlign TA_RIGHT will make things reasonably simple.
Another way of doing it is using GetCharacterPlacement (I don't have an example handy). Using that API, you can control the position of every character and the intercharacter spacing. I've occasionally used it to convert a proportional font into a fixed font, particularly for numbers since, they are much nicer looking (and readable) in proportional fonts than they are in the typical fixed fonts. (Hex dumps look much better that way .)
Sadly, I only know how to do these things using the Windows API but, I am sure there are forum members who can show you the "Lazarus" way of doing it.
HTH.