[SOLVED] How-to compute the font size to get a given terminal size with fbterm?
SlackwareThis Forum is for the discussion of Slackware Linux.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
How-to compute the font size to get a given terminal size with fbterm?
I have installed fbterm and need to use in a shell script the output of the command "fbterm -v", which gives information about display settings.
Unfortunately, redirection of the output to a file like one of these commands:
Code:
fbterm -v > output.txt
fbterm -v 2>&1 | tee output.txt
doesn't work (output.txt is empty), probably linked to the fact that running fbterm (mandatorily from an interactive tty) opens a /dev/pts/something as you can see here
I also thought about taking a "picture" of the screen after running "fbterm -v" but do not know an utility to do that (the ones I know work only under X).
Any help appreciated.
PS The initial title of this thread was :
How-to store the output of "fbterm -v"?
I have modified it to highlight the aim, as previous title was actually a way to reach it, and eventually another way will be used.
Last edited by Didier Spaier; 07-11-2014 at 03:37 PM.
Maybe you could start screen or tmux first, then use their built-in copy mode to copy the info you need, then paste it into a text editor.
For the screenshot idea, I have used fbgrab in the past, but all the links to it seem dead now.
There is also fbshot http://www.sfires.net/fbshot/ which looks like it is from 2002...
@Loomx: thanks for the clue. Unfortunately, I can't use screen, because typing "Ctr+a h" would need an user input and all have to be done by a non interactive script.
Also, running fbterm inside screen also fails (running fbterm inside screen would be kind of running a terminal inside a terminal :-)
fbshot can take screenshots from a Linux frame buffer, but I need to get the output even when no frame buffer is used (i.e. with the "nomodeset" kernel parameter in the command line). Considering the name, I assume that the same applies to fbgrab.
Last edited by Didier Spaier; 07-08-2014 at 06:51 AM.
Not a dumb question, but this requires an interaction with the user (using a mouse), that is not acceptable in this case.
PS To clarify: this has to occur using Slint installer just before user is suggested to choose another keymap if need be (as in Slackware genuine installer). In the installers in http://slint.fr/testing we use fbterm but a test case has been found (using some specific hardware) where the "guess" of the display resolution set by fbterm fails, leading to a too big font size. To avoid that situation we need to know the resolution it actually sets, as reported by fbterm -v, then kill fbterm and re-launch it with the good font size set by the script (however that seems a bit convoluted, I admit. I'm open to simpler solutions that could be suggested :-)
Last edited by Didier Spaier; 07-08-2014 at 09:25 AM.
Reason: a test case s/have/has/ been found
Ah, I see. Thanks for the clarification. No idea how to solve it, though.
Slightly on-and-off-topic.
I can't use the VESA framebuffer because I'm using the NVidia driver, and I seem to remember they interfere with each other. Or at least, that used to happen.
I dont use fbterm either. I did a little searching but I fear I found nothing of real value.
I do have a suggestion, however. If I am understanding correctly, fbterm is actually programmed to make sure its output is not being redirected, which is somewhat appropriate when invoked normally, but wildly inappropriate when used with the switch in question. So I would suggest you use the source. Find the check, and neuter it. You could disable it entirely, probably the quickest and easiest solution, or for a cleaner solution just bypass the check when this particular switch is used.
@ml4711: thanks, but unfortunately we're not in an xterm during Slackware's installation.
@Arkerless: thanks for the suggestion, I'll try that and see what I come up with.
Actually resize also works in a console and in fbterm!
Yes, but to display then terminal size only, of course. But I need to know the current resolution to compute the "good" font size (i.e. the biggest font size that will allow to display, say, at least 30 lines and 85 columns).
Maybe someone could add to fbterm an option to set the terminal size and compute the font size accordingly, like this:
Code:
fbterm --terminal-size <COLUMNS>x<LINES>
Of course that should work with and without a frame buffer...
Any volunteer?
I could try... If only I was able to code in C++ and knew VESA, VBE, EDID and the like...
Last edited by Didier Spaier; 07-08-2014 at 01:55 PM.
Yes, but to display then terminal size only, of course. But I need to know the current resolution to compute the "good" font size (i.e. the biggest font size that will allows to display, say, at least 30 lines and 85 columns).
OK, I see.
Then use fbset to get the size in pixels, before You call fbterm
Promising, but... fbset fails if there is no frame buffer device.
So, I am wondering: can I force usage of a frame buffer during installation?
One of the most generic drivers is vesafb, but it works only for devices compliant to at least VESA 2.0 (not VESA 1.2), so no luck for very old cards.
There is also vga16fb (but can we use only 16 colors?).
I tried a command line with "video=vga16fb nomodeset" appended, I'm not sure that the syntax be correct (I should better read modedb.txt in the kernel's documentation) but anyway I end up with a VESA VGA frame buffer device, maybe because vesafb is built in in the huge kernel's configuration (I have to check the generic's and the installer's configurations). I still can modprobe vga16fb and then end up with two frame buffer devices, but I could set the environment variable FRAMEBUFFER to tell fbterm which one it should use. Anyhow blacklisting all other frame buffer modules to prevent handovers would be an extreme measure, I think. I just hope that modprobing vga16fb when any other frame buffer module is loaded has no bad consequence...
It's late here, so I'll investigate further tomorrow (actually, later today :-).
Last edited by Didier Spaier; 07-08-2014 at 06:08 PM.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.