Thread Tools Display Modes
Prev Previous Post   Next Post Next
06/08/24, 02:07 PM   #1
Vilkasmanga
AddOn Author - Click to view addons
Join Date: Dec 2023
Posts: 17
Perhaps the silliest question for this week?

Disclaimer: I'm in the weeds, I've looked high, low, and lower. This is an annoyance that has become a thing ...

The Goal:

I'm trying to print info to the chat window in an aligned fashion. I think I am fighting a proportional font issue that prevents me from being able to line things up. At least, that's what I'm telling myself at the moment. Am I wrong?

The code:
Code:
d(string.format("Bottom test 1: Count (%2d): %10s = %-40s!", 1, 22, "Hello"));
d(string.format("Bottom test 2: Count (%2d): %10s = %-40s!", 2, 32, "Hello There"));
d(string.format("Bottom test 3: Count (%2d): %10s = %-40s!", 3, 42, "           ii Well Hello There"));
The output:


Notice that the end of each string (marked by the ! character) is staggered, roughly by the length of the string preceding it. The exclamation points should be lining up?


The problem (as I understand it):

sprintf should be left justifying the three varying length texts (Hello, Hello There, etc.) and the exclamation point at the end should be in alignment with the one above. But, and hopefully this is obvious in the post, the string in the %-40s section isn't behaving as expected.

What is odd to me is that the second %10s strings (22,32,42) seem to be working okay though, granted, they are just numbers so maybe there isn't a lot of variance and this string definition is misbehaving like the 3rd, just not as obviously.

Either way, the question: Is there a way to properly format/align this type of output?

I've mined zo_strformat, lua's various controls, the wiki and source wherever I could find it - and am trying to avoid opening a whole new window layer where I can control the font ("avoid" is code for "I've tried 2 or 3 different examples/approaches, each resulting in a dismal failure and so I'm really hoping the solution isn't that complicated?")

Last edited by Vilkasmanga : 06/08/24 at 02:54 PM.
  Reply With Quote
 

ESOUI » Developer Discussions » General Authoring Discussion » Perhaps the silliest question for this week?


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off