how to modify font size and type from script


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users how to modify font size and type from script
# 1  
Old 02-07-2008
Question how to modify font size and type from script

I need to print different lines in different font types and sizes to the terminal window from csh script. I can easily change font color and print characters in bold or underline, but cannot figure out a way to change font. Any help is greatly appreciated.Smilie
# 2  
Old 02-07-2008
I am intrested to know

I am intrested to know how you change colour and change it bold ..or underline ??
# 3  
Old 02-07-2008
printing color/bold

To change the color from the script or the command line, you execute command in the following format: echo "<esc>[<color>m <string>", where
<esc> is an escape character (Ctrl+V), followed by a bracket [, followed by a color code (see below), followed by letter m, followed by a string to print. Color codes for foreground are as follows: 30 (black), 31 (red), 32 (green), 33 (yellow), 34 (blue), 35 (magenta), 36 (cyan), and 37 (gray). For backgrounds color codes are the same, except instead of 3, they start with 4. They can be mixed and matched. Bold is 1, underlined is 4. For csh shell, I actually had to use vi editor and enter Ctrl+V to have that character recorded, bracket follows right after, letter m is necessary after the color code to end the escape sequence. In other shells, \033 or \E can work instead of using Ctrl+V. Here is a complete example:
echo "<esc>[34m I am in blue" or echo "<esc>[1m I am in bold". I hope this helps.
# 4  
Old 02-08-2008
Actually you should read about ANSI colors.
To make a bold/standout/invert/underline/blink/... text you could use 'tput'.
The terminals could support different number of colors (I use PuTTY with 256 colors support). Support for bold/standout/blink/etc. depends on the terminal capabilities as well.
This is possible to switch to "alternative font". You should google for the characters sequence.
This is possible as well to display "upper half" and "lower half" of a letter (so you could get characters that are 2x larger).
All the time remember that it require terminal caps and you should not use it when you don't have that caps supported.
As for the colors: If the terminal can handle 16 colors then you should be able to use: <ESC>[XX;YY;ZZm sequence (<ESC> is \033 is 27 is \e and it is the escape character/sequence). Correct numbers could tell to use some color/caps. Ex. \033[48;5;187m is (possibly I mixed up this oneSmilie blue color bolded text on gray-yellow background on 256-colors terminal.
Some examples:
Forecolor Red: \033[31m
Forecolor Blue: \033[34m
Backcolor Yellow: \033[43m
Blink: $(tput blink)
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Red Hat

Increase Font size

Hi friends I want increase font size in linux can anybody help me plese Example:this is my in put Filesystem Size Used Avail Use% Mounted on /dev/mapper/VolGroup00-LogVol00 18G 2.5G 14G 15% / /dev/sda2 ... (1 Reply)
Discussion started by: vasuibm
1 Replies

2. UNIX for Dummies Questions & Answers

Increase Font size for text to type in CYGWIN

Please mention "How to increase font size for text to type commands in CYGWIN " ? (2 Replies)
Discussion started by: adirajup
2 Replies

3. Shell Programming and Scripting

Font Size

Hi All, Please can someone advise on how to change the font size of the output of a shell script. Best Regards, Shazin (2 Replies)
Discussion started by: Shazin
2 Replies

4. Solaris

True Type Font in Solaris

Hello, It is not related to scripting or unix command but it is related to Solaris environment setup. I'm a web developer, in my web application (J2EE using WebLogic 8.1) currently it's running in Windows. We are planning to have Disaster Server in Solaris host. In my application, we are... (1 Reply)
Discussion started by: luckybalaji
1 Replies

5. Shell Programming and Scripting

Specifying font type and color in a shell script

Hi, I am new to shell script. Can you please tell me, whether can we specify font type and color in a shell script? If so, how to do this? Thanks in advance. (4 Replies)
Discussion started by: Vani_Govind
4 Replies

6. UNIX for Dummies Questions & Answers

set font size

can any one tell me how to set the font size in unix? (14 Replies)
Discussion started by: sachin.gangadha
14 Replies

7. AIX

Modify Print Orientation, Font and Pitch

I need to be able to change the font, pitch, and orientation when printing a text flat file. Any suggestions appreciated. (2 Replies)
Discussion started by: mad_dog
2 Replies

8. Solaris

font size printing

hi all , i was just wondering if i can specify the font size when i am printing from solaris . i am using solaris 9 and hp laserjet 1230 . i dont want to change the global variable for the printer driver . i just want to print a file with small font and the others with normal fonts . ... (1 Reply)
Discussion started by: ppass
1 Replies

9. UNIX for Dummies Questions & Answers

Font size

Hello all I am a new linux user (Redhat 7) and I am trying to learn how to operate the system. I have a couple problems one the font size for all windows withing the OS are too small and even though I found a couple places to configure font size I can't find where to change the font size for the... (2 Replies)
Discussion started by: elhefe
2 Replies
Login or Register to Ask a Question