1834351 Members
1952 Online
110066 Solutions
New Discussion

Shell script font

 
machaya chivaviro_2
Occasional Advisor

Shell script font

I have done a shell script. I need to change font on certain lines that I output and print them. Need to have a font of 12 on line field , with the other getting 16 and 20. How do i do that.
3 REPLIES 3
RAC_1
Honored Contributor

Re: Shell script font

You can do very little about it.
check man page of tput
There is no substitute to HARDWORK
Bill Hassell
Honored Contributor

Re: Shell script font

For terminal output, the tput command will give you access to the terminfo database and the Curses library. For instance, this:

print "$(tput bold) this is bold$(tput sgr0) this is normal"

will demonstrate the bold or enhanced font on the screen. HOWEVER, terminals do not have different font sizes. You might be using a graphics display such as Xwindows but in a terminal window (such as hpterm, xterm or dtterm), only one font size is allowed as there are terminal characteristics such as COLUMNS and ROWS that would be rendered meaningless with multiple fonts.

To see the list of enhancements that are available to tput, check the (very long) man page fpr terminfo. The attached script will demonstrate the most common terminal enhancements.

Now if your goal is to control printing, the task is possible but quite non-portable. Thdere are hundreds of printer models just from HP and controlling the font (and weight, pitch, interline spacing,etc) requires a technical reference manual for the specific printer. You change fonts with escape sequences but these codes depend a lot on the choice of font, whether the font is proportional and the version of PCL for the printer. For non-HP printers, similar codes exist, or there will be a page description language such as Postscript which will more difficult to write the codes.


Bill Hassell, sysadmin
Howard Marshall
Regular Advisor

Re: Shell script font

This is a very simple thing to do.

From your script, instead of displaying to the std out, create a file with the .html extension and write in the font control tag items. Then view and print the file from a web browser.

Like the others have said though, printing something to the screen or a terminal or terminal emulator in a different font size isn't going to work. You may be able to do something with one of the X windows scripting languages but I am not sure as I don't use them.