Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

Done May we have a %@WIDTH[] that is like %@LENGTH[] but is display width instead of character count

Jul
533
10
I hear there is an internal function for this, but no one’s ever asked for it to be exposed before.

I’m doing advanced cosmetic things with ANSI and emoji. One thing I’m doing is double height text. You have to wrap the double height text yourself. And part of wrapping accurately is measuring the width. If my emoji get "undercounted" as 1 when they take up 2 columns of screen, my line overruns. There’s no easy way to get past .... The hard way is examining each character (oh please, nooooooo! i can do that in Python but i think doing it in TCC would be a bit cumbersome)

Back in the old old days when all characters were single-width, one could have 100% control over alignment using %@LEN[]

But now that we have chars that are double-width but have a %@LEN[] of 1.....

I could reallllllllllly use a function that returns the actual width. And i have a feeling once this is around, others will start using it. It’s the only way to have accuracy with dynamic screen placement if emoji are involved, unfortunately.

I do have my own %@WIDTH[] function, but it can’t get this part right. All it does is strips the ansi, so at least my ANSI color formatting codes aren’t counted as length for alignment purposes. But it can’t detect/count emoji as 2. So I’m still getting undercounts, though I am only off by as many emoji that are used, so usually only off by 1, but that’s disasterous when you wrap lines and don’t want to! haha :)
 
There are quite a few internal variables that give you rows (%_rows) and columns (%_columns) as well as pixel widths (%_xpixels, %_ypixels), but I'm not clear on what you are doing or what you are looking for.
 
There are quite a few internal variables that give you rows (%_rows) and columns (%_columns) as well as pixel widths (%_xpixels, %_ypixels), but I'm not clear on what you are doing or what you are looking for.
I’m aware of the internal variables.
 
Rexx said there’s already an internal that does this, but nobody’s ever wanted it exposed before.

1) I’m starting to wonder if any one on planet earth in the history of humanity has ever aligned dynamic text with emoji using
TCC before

2) and hoping I don’t have to process strings one byte at a time in TCC because last time i did that, the text came out at about 1/1000ᵗʰ of echo speed or slower....
 
Back
Top