LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 10-15-2011, 03:14 PM   #1
Xeratul
Senior Member
 
Registered: Jun 2006
Location: UNIX
Distribution: FreeBSD
Posts: 2,164

Rep: Reputation: 189Reputation: 189
X11: bash script to convert Pixels to Characters?


Hello,

If you would like to use xterm with given geometry, you shall use "-g".

X11 says:
Quote:
Geometry Specifications
One of the advantages of using window systems instead of hardwired terminals is that applications don't have to be restricted to a particular size or location on the screen. Although the layout of windows on a display is controlled by the window manager that the user is running (described below), most X programs accept a command line argument of the form -geometry WIDTHxHEIGHT+XOFF+YOFF (where WIDTH, HEIGHT, XOFF, and YOFF are numbers) for specifying a preferred size and location for this application's main window.

The WIDTH and HEIGHT parts of the geometry specification are usually measured in either pixels or characters, depending on the application. The XOFF and YOFF parts are measured in pixels and are used to specify the distance of the window from the left or right and top and bottom edges of the screen, respectively. Both types of offsets are measured from the indicated edge of the screen to the corresponding edge of the window. The X offset may be specified in the following ways:
Thus one shall convert from pixels to characters , if for instance you got used the xrandr to get the max pixels of your monitor/screen.

Would you eventually this very basic calculation from pixels to characters, for xterm ?

Thank you in advance.
 
Old 10-15-2011, 03:56 PM   #2
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910
Quote:
Would you eventually this very basic calculation from pixels to characters, for xterm ?
Even if there was a verb in your final question I still wouldn't quite
understand what you're asking?



Cheers,
Tink
 
Old 10-15-2011, 07:15 PM   #3
theNbomr
LQ 5k Club
 
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,397
Blog Entries: 2

Rep: Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908
Xterm's geometry parameter is already expressed in terms of character cells, which is the only sensible case for xterm. Since you cannot really know how big each character cell is, you cannot reliably calculate the window size in pixels. But, it sounds like you want to know how to calculate the size in characters, which is unnecessary.

--- rod.
 
Old 10-16-2011, 01:08 PM   #4
Xeratul
Senior Member
 
Registered: Jun 2006
Location: UNIX
Distribution: FreeBSD
Posts: 2,164

Original Poster
Rep: Reputation: 189Reputation: 189
Quote:
Originally Posted by theNbomr View Post
Xterm's geometry parameter is already expressed in terms of character cells, which is the only sensible case for xterm. Since you cannot really know how big each character cell is, you cannot reliably calculate the window size in pixels. But, it sounds like you want to know how to calculate the size in characters, which is unnecessary.

--- rod.
I would like actually to start xterm with fullscreen geometry... calculated.

Code:
xterm -g $maxxx$maxy+0+0
after the use of xrandr to get the maxx and maxy variables....

regards
 
Old 10-16-2011, 02:14 PM   #5
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910
In that case just divide the numbers produced by xrandr by the
width and height in pixels of the font you chose?



Cheers,
Tink

Last edited by Tinkster; 10-16-2011 at 02:15 PM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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

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



Similar Threads
Thread Thread Starter Forum Replies Last Post
ImageMagick - how to convert green pixels to red? BrianK Linux - General 3 03-13-2017 07:39 AM
non-ascii characters in bash script and unicode igor.R Linux - Newbie 31 12-29-2012 03:45 AM
bash script to remove first characters from every line (00) Linux - General 8 08-01-2011 10:28 AM
Bash Script to get the first characters of a string onesikgypo Programming 12 11-14-2008 09:57 AM
inserting special characters into mysql with bash script ihopeto Linux - Newbie 1 12-05-2006 12:46 PM


All times are GMT -5. The time now is 01:56 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration