Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

I want to know a strange thing

19 views
Skip to first unread message

gamo

unread,
Dec 13, 2020, 9:56:28 AM12/13/20
to

I want to know the aproximate proportios of a text cursor
in a xterm. Have I to explain more?

Thanks, as usual.



--
http://gamo.sdf-eu.org/
"What happens in EuroVegas it remains in EuroVegas"

Grant Taylor

unread,
Dec 13, 2020, 1:55:32 PM12/13/20
to
On 12/13/20 7:56 AM, gamo wrote:
> I want to know the aproximate proportios of a text cursor
> in a xterm. Have I to explain more?

It will probably be font and size dependent.

Take a screen shot and measure the cursor in a graphics program.



--
Grant. . . .
unix || die

gamo

unread,
Dec 13, 2020, 6:50:39 PM12/13/20
to
El 13/12/20 a las 19:55, Grant Taylor escribió:
> On 12/13/20 7:56 AM, gamo wrote:
>> I want to know the aproximate proportios of a text cursor
>> in a xterm. Have I to explain more?
>
> It will probably be font and size dependent.
>
> Take a screen shot and measure the cursor in a graphics program.
>
>
>
Actually I try the magic number 2 to equalize lines size with cols size.
Seems only 'adequate'.
Thanks for your suggestion, but I'm using standard Ubuntu.

Eric Pozharski

unread,
Dec 14, 2020, 5:33:18 AM12/14/20
to
with <rr69c6$vk7$1...@gioia.aioe.org> gamo wrote:
> El 13/12/20 a las 19:55, Grant Taylor escribió:
>> On 12/13/20 7:56 AM, gamo wrote:

>>> I want to know the aproximate proportios of a text cursor in a
>>> xterm. Have I to explain more?
>> It will probably be font and size dependent.
>> Take a screen shot and measure the cursor in a graphics program.
> Actually I try the magic number 2 to equalize lines size with cols
> size. Seems only 'adequate'. Thanks for your suggestion, but I'm
> using standard Ubuntu.

And here comes your XY-problem. I've found this inside xterm(1):

GetWinSizeChars (18)
Report the size of the text area in characters as
numbers.

GetWinSizePixels (14)
Report xterm window in pixels as numbers.

When (if ever) you get these pairs then you can divide items from second
pair by items of first pair thus achieving area of a character what,
effectevily, is area of the cursor. Now, these are mentioned in
*WindowOps. However, my reading is these two are *control sequences*,
and they (control sequences) can be 'abused in a script'.

Now, I have no idea what these sequences are, where to get them from,
how to get anything back from a terminal, because Term::ReadKey is my
limited experience dealing with terminals (it does everything I ever
needed from terminal). You are on your own now.

OTOH, it's not clear what exactly you are trying to achieve, but it
feels like starting xterm with approriate geometry and/or font is what
you need instead.

--
Torvalds' goal for Linux is very simple: World Domination
Stallman's goal for GNU is even simpler: Freedom

Eli the Bearded

unread,
Dec 14, 2020, 4:59:31 PM12/14/20
to
In comp.lang.perl.misc, Eric Pozharski <why...@pozharski.name> wrote:

Why clpm? comp.windows.x or comp.os.linux.x seem better.

> And here comes your XY-problem. I've found this inside xterm(1):
>
> GetWinSizeChars (18)
> Report the size of the text area in characters as
> numbers.
>
> GetWinSizePixels (14)
> Report xterm window in pixels as numbers.
>
> When (if ever) you get these pairs then you can divide items from second
> pair by items of first pair thus achieving area of a character what,
> effectevily, is area of the cursor.

$ xwininfo -id $WINDOWID | grep -E 'Width|Height|geometry'
Width: 643
Height: 576
-geometry 104x44+82-23
$

This window is 104 characters wide by 44 characters tall. The height
and width info includes padding and scroll bars, probably includes
window decoration, which is mostly title bar for me. But it puts a
definite maximum size for the cursor as 6 pixels wide and 13 tall.
I suspect 6x12 is the real number.

I also know I'd get a different value with some other font choices.

If you can start up xterms of different sizes, you can easily test how
much width and height grow with each additional row and column. The
xterm will take care of exporting the WINDOWID variable for you.

Elijah
------
does not actively select a font for xterm, just gets the default

gamo

unread,
Dec 14, 2020, 5:40:30 PM12/14/20
to
El 14/12/20 a las 22:59, Eli the Bearded escribió:
Thank you all very much. The central thing is as you confirm,
the horizontal-vertiocal ratio for a char is almost 2:1 lines to cols.
Despite there are now wide monitors that use xterm capabilities
way more than pure console terminals (expected num keypads).


my $cols = `tput cols`;
my $lines = `tput lines`;

Thanks.

Eli the Bearded

unread,
Dec 14, 2020, 7:10:50 PM12/14/20
to
In comp.lang.perl.misc, gamo <ga...@telecable.es> wrote:
> Thank you all very much. The central thing is as you confirm,
> the horizontal-vertiocal ratio for a char is almost 2:1 lines to cols.

That is the standard ratio one should assume with programatically
generated ASCII art. Two pixels tall and one pixel wide (or multiples
there of) become one character cell in the ASCII version. This is
how you should expect pre-scale input if you use my pgmtoascii tool:

https://qaz.wtf/netpbm/pgmtoascii

But if you are going to make an actual bit map out of the text, say
with texttopnm:

https://qaz.wtf/netpbm/texttopnm

Then use the dimensions of the font for more exact results. I have three
historical IBM console fonts here, one 8x16, one 9x14, and one 9x16.

https://qaz.wtf/netpbm/fonts.tar.gz

All *about* two tall to one wide, but only one exactly so.

ObPerl: pgmtoascii and texttopnm are both Perl scripts. Both do assume
you have a reasonable netpbm or pbmplus library of programs installed
to work with them.

Elijah
------
noticed today pgmtoascii is very nearly 21 years old

Keith Thompson

unread,
Dec 14, 2020, 7:34:30 PM12/14/20
to
gamo <ga...@telecable.es> writes:
[...]
> Thank you all very much. The central thing is as you confirm,
> the horizontal-vertiocal ratio for a char is almost 2:1 lines to
> cols. Despite there are now wide monitors that use xterm capabilities
> way more than pure console terminals (expected num keypads).
>
> my $cols = `tput cols`;
> my $lines = `tput lines`;

What do wide monitors have to do with this? The size in pixels for a
character depends on the font. A font in which characters are twice as
tall as their width tends to be reasonably legible.

In the xterm I'm typing this in, for example, each character cell is 10
pixels wide and 21 pixels tall, and it looks good to me. 20x20 cells,
for example, would look badly distorted.

--
Keith Thompson (The_Other_Keith) Keith.S.T...@gmail.com
Working, but not speaking, for Philips Healthcare
void Void(void) { Void(); } /* The recursive call of the void */

Eli the Bearded

unread,
Dec 14, 2020, 8:37:37 PM12/14/20
to
In comp.lang.perl.misc, Keith Thompson <Keith.S.T...@gmail.com> wrote:
> In the xterm I'm typing this in, for example, each character cell is 10
> pixels wide and 21 pixels tall, and it looks good to me. 20x20 cells,
> for example, would look badly distorted.

What makes you say that?

Elijah
------
maybe it is cultural

Randal L. Schwartz

unread,
Dec 15, 2020, 4:23:12 AM12/15/20
to
>>>>> "EtB" == Eli the Bearded <*@eli.users.panix.com> writes:

EtB> noticed today pgmtoascii is very nearly 21 years old

Wow. Wow wow. I hadn't seen NETPBM referenced in years. I remember
being tortured that I didn't have "stereo pipes" in /bin/sh, and then
realized how I could do that with the right fd redirects. Scary.

print "Just another Perl hacker,";

--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<mer...@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/Dart consulting, Technical writing, Comedy, etc. etc.
Still trying to think of something clever for the fourth line of this .sig
0 new messages