Text Alignment in a Custom Text Window

Started by Bavolis, Thu 28/02/2019 05:08:27

Previous topic - Next topic

Bavolis

It's a beginner question because I have not worked with text windows before and I have a little hiccup I can't solve. I've searched for an answer and found a couple that seemed close, but didn't address my problem. As you can see in the screenshot, the text is a little too close to the left side and slightly favoring the bottom. In theory, if the two vertical line borders are the same size (both square) and the corner pins are all the same size (square), what would be throwing it off? The only thing that seems to move the text for me is to add padding, but it's still off-center. The background image is 250x80, as mentioned in the AGS resources.




Khris

#1
The horizontal issue is pretty much unavoidable, since AGS has no "justified" setting. Left aligned text will always slightly lean left due to words not being broken up.
(Having said that, the AGS engine could in theory determine the width of the left aligned text and still center it within the GUI.)

The vertical issue is probably in part due to the fact that letters don't have a fixed height. I'd have expected the text to favor the top though, due to letters like y and g needing space below the baseline.

A simple way to at least kind of fix this is to add/remove padding to/from the border sprites.

Maybe at some point we will get a nice way to customize Character.Say(), like we have with dialogs. And a truly reliable GetTextWidth().  :P

Cassiebsg

A note on the vertical problem. I've seen this being mentioned here before, and there's a post explaining what you can do to fix it.
It involves editing the ttf font and changing the baselines and up/lows before importing... but I can't think of a more specific term to search the forum than "font" and that gives 80 hits (and as far as I know, there's only thread mentioning the problem)...

Maybe you can think of a more specific term to search.  ;)
There are those who believe that life here began out there...

Crimson Wizard

Regarding font, try adjusting "VerticalOffset" property for your speech font. This was added as a temporary way to solve these issues.

Bavolis

Thanks for the quick help everyone! I'll try these tricks to get my text in order. :)

SMF spam blocked by CleanTalk