Change font type and setting from a C/C++ program in Linux environment

Change font type and setting from a C/C++ program in Linux environment

Post by Van H L » Fri, 01 Mar 2002 05:42:41



Hi all,

Sorry if this is not a right place to post such question.
I was just wondering if there is any way to change stdout messages'
font type and setting from a C/C++ program in Linux environment? Any
help or pointer to help is greatly appreciated.
Thanks
VAn

 
 
 

Change font type and setting from a C/C++ program in Linux environment

Post by Donovan Rebbech » Sat, 02 Mar 2002 00:34:59



> Hi all,

> Sorry if this is not a right place to post such question.
> I was just wondering if there is any way to change stdout messages'
> font type and setting from a C/C++ program in Linux environment? Any
> help or pointer to help is greatly appreciated.

You've got limited capacity to do this, most terminals don't support different
fonts. You can change colors easily though. You probably should read up on
the terminal libraries. Take a look at the curses manpage.

--
Donovan

 
 
 

Change font type and setting from a C/C++ program in Linux environment

Post by Van H L » Sun, 03 Mar 2002 06:25:51


On Thu, 28 Feb 2002 15:34:59 +0000 (UTC), Donovan Rebbechi



>> Hi all,

>> Sorry if this is not a right place to post such question.
>> I was just wondering if there is any way to change stdout messages'
>> font type and setting from a C/C++ program in Linux environment? Any
>> help or pointer to help is greatly appreciated.

>You've got limited capacity to do this, most terminals don't support different
>fonts. You can change colors easily though. You probably should read up on
>the terminal libraries. Take a look at the curses manpage.

Thanks for the tip, Donovan. I have one more question:
Although it is hard to change to another font, how about using the
same font but set it BOLD instead of regular? Is there anyway to do it
in Linux terminal?

Thanks
--VAn

 
 
 

Change font type and setting from a C/C++ program in Linux environment

Post by Donovan Rebbech » Sun, 03 Mar 2002 06:57:36



> On Thu, 28 Feb 2002 15:34:59 +0000 (UTC), Donovan Rebbechi


>>> Hi all,

>>> Sorry if this is not a right place to post such question.
>>> I was just wondering if there is any way to change stdout messages'
>>> font type and setting from a C/C++ program in Linux environment? Any
>>> help or pointer to help is greatly appreciated.

>>You've got limited capacity to do this, most terminals don't support different
>>fonts. You can change colors easily though. You probably should read up on
>>the terminal libraries. Take a look at the curses manpage.

> Thanks for the tip, Donovan. I have one more question:
> Although it is hard to change to another font, how about using the
> same font but set it BOLD instead of regular? Is there anyway to do it
> in Linux terminal?

Yes, you should be able to set it to bold. Again, this is dependent on the
terminal type, but almost all terminals should support bold font.

You could do this using either ncurses or libtermcap. I suggest the latter,
it's simpler, and probably more portable. Documentation for this is in
man 5 termcap, and info:/termcap

libtermcap is basically an interface to the /etc/termcap database. It lets
you do things like query a terminal, and figure out what the sequence is
for bold. (md gives you the string for bold mode, me gives you the one for
"normal mode". See man 5 termcap)

Because the behaviour is dependent on terminal type, your safest bet is to
use termcap, rather than "guess" about terminal codes.

#include <stdio.h>
int main()
{

         printf ("\E[1mhello world\E[0m\n");

Quote:}                    

--
Donovan
 
 
 

Change font type and setting from a C/C++ program in Linux environment

Post by Dave Blak » Sun, 03 Mar 2002 07:39:41





>>> Sorry if this is not a right place to post such question.  I
>>> was just wondering if there is any way to change stdout
>>> messages' font type and setting from a C/C++ program in Linux
>>> environment? Any help or pointer to help is greatly
>>> appreciated.
>>You've got limited capacity to do this, most terminals don't
>>support different fonts. You can change colors easily though.
>>You probably should read up on the terminal libraries. Take a
>>look at the curses manpage.
> Thanks for the tip, Donovan. I have one more question: Although
> it is hard to change to another font, how about using the same
> font but set it BOLD instead of regular? Is there anyway to do
> it in Linux terminal?

If you want ANY control over your output environment in a
terminal setting, you need to use an abstraction layer. Terminals
come in all shapes and sizes, and you cannot use <b>BOLD</b> in a
terminal that doesn't have <b>BOLD</b>

There are two conceptual ways to use abstraction layers -
terminfo and termcap.

Termcap is the old way, mostly deprecated and dependent on
terminfo.

Terminfo consists of a database of terminal types. You basically
lookup what codes correspond to what terminal attributes you
want to give text, and then send them to the terminal. Slang
libraries use terminfo, and the ncurses package is developed
along with terminfo. Use of one of these libraries is preferred.

In any case, ncurses comes with copious examples and
documentation, so you should be able, rather quickly, to
give output text any color or boldness you like.

http://www.veryComputer.com/

If you run into problems the included documentation doesn't
address (which I think is pretty uncommon), you can ask here,
sometimes Thomas*ey, the ncurses maintainer, is reading.

--
Dave Blake

 
 
 

Change font type and setting from a C/C++ program in Linux environment

Post by Roger Leig » Sun, 03 Mar 2002 08:10:42



> > Thanks for the tip, Donovan. I have one more question:
> > Although it is hard to change to another font, how about using the
> > same font but set it BOLD instead of regular? Is there anyway to do it
> > in Linux terminal?

> Yes, you should be able to set it to bold. Again, this is dependent on the
> terminal type, but almost all terminals should support bold font.

> You could do this using either ncurses or libtermcap. I suggest the latter,
> it's simpler, and probably more portable. Documentation for this is in
> man 5 termcap, and info:/termcap

> libtermcap is basically an interface to the /etc/termcap database. It lets
> you do things like query a terminal, and figure out what the sequence is
> for bold. (md gives you the string for bold mode, me gives you the one for
> "normal mode". See man 5 termcap)

> Because the behaviour is dependent on terminal type, your safest bet is to
> use termcap, rather than "guess" about terminal codes.

Isn't termcap deprecated?  Some distributions, such as Debian, do not
even have a real termcap (it's a terminfo wrapper).  terminfo is
AFAICS the modern replacement for termcap.

--
Roger Leigh
                ** Registration Number: 151826, http://counter.li.org **
                Need Epson Stylus Utilities? http://gimp-print.sourceforge.net/
                GPG Public Key: 0x25BFB848 available on public keyservers

 
 
 

Change font type and setting from a C/C++ program in Linux environment

Post by Donovan Rebbech » Sun, 03 Mar 2002 14:51:22




>> > Thanks for the tip, Donovan. I have one more question:
>> > Although it is hard to change to another font, how about using the
>> > same font but set it BOLD instead of regular? Is there anyway to do it
>> > in Linux terminal?

>> Yes, you should be able to set it to bold. Again, this is dependent on the
>> terminal type, but almost all terminals should support bold font.

>> You could do this using either ncurses or libtermcap. I suggest the latter,
>> it's simpler, and probably more portable. Documentation for this is in
>> man 5 termcap, and info:/termcap

>> libtermcap is basically an interface to the /etc/termcap database. It lets
>> you do things like query a terminal, and figure out what the sequence is
>> for bold. (md gives you the string for bold mode, me gives you the one for
>> "normal mode". See man 5 termcap)

>> Because the behaviour is dependent on terminal type, your safest bet is to
>> use termcap, rather than "guess" about terminal codes.

> Isn't termcap deprecated?  Some distributions, such as Debian, do not
> even have a real termcap (it's a terminfo wrapper).  terminfo is
> AFAICS the modern replacement for termcap.

terminfo is also less portable. For example, I just looked at the manpages
for NetBSD and Linux and curses is very different on these two platforms.

--
Donovan

 
 
 

Change font type and setting from a C/C++ program in Linux environment

Post by Thomas Dicke » Sun, 03 Mar 2002 22:11:28



> terminfo is also less portable. For example, I just looked at the manpages
> for NetBSD and Linux and curses is very different on these two platforms.

not really (you're making an incomplete comparison).  ncurses works fine on
both platforms, but the *BSD platforms have varying configurations (NetBSD in
particular has not-invented-here syndrome, preferring to evolve the BSD curses
into something more/less compatible with X/Open curses than to use ncurses).

Point in fact:  the 1.5.2 NetBSD curses is broken (leaves the terminal in raw
mode after exit).

termcap likewise is not really compatible - even among the *BSD's there are
differences (owing mainly to the fact that the termcap interface was never
well-defined, and applications rely on undocumented features).  Between Linux
and *BSD's, there is the added incompatibility between the allowed size of
termcap entries (even true of real Unix stuff such as SCO).

--

http://dickey.his.com
ftp://dickey.his.com

 
 
 

Change font type and setting from a C/C++ program in Linux environment

Post by Van H L » Fri, 08 Mar 2002 05:13:05


Hi all,

I'd like to thank all of your input. They are very valuable. Donovan,
Dave,  Roger, and Thomas are particularly helpful. I've found the
solytion in termcap, terminfo and other that you pointed out.

Thanks again.
Best.





>>>> Sorry if this is not a right place to post such question.  I
>>>> was just wondering if there is any way to change stdout
>>>> messages' font type and setting from a C/C++ program in Linux
>>>> environment? Any help or pointer to help is greatly
>>>> appreciated.

>>>You've got limited capacity to do this, most terminals don't
>>>support different fonts. You can change colors easily though.
>>>You probably should read up on the terminal libraries. Take a
>>>look at the curses manpage.

>> Thanks for the tip, Donovan. I have one more question: Although
>> it is hard to change to another font, how about using the same
>> font but set it BOLD instead of regular? Is there anyway to do
>> it in Linux terminal?

>If you want ANY control over your output environment in a
>terminal setting, you need to use an abstraction layer. Terminals
>come in all shapes and sizes, and you cannot use <b>BOLD</b> in a
>terminal that doesn't have <b>BOLD</b>

>There are two conceptual ways to use abstraction layers -
>terminfo and termcap.

>Termcap is the old way, mostly deprecated and dependent on
>terminfo.

>Terminfo consists of a database of terminal types. You basically
>lookup what codes correspond to what terminal attributes you
>want to give text, and then send them to the terminal. Slang
>libraries use terminfo, and the ncurses package is developed
>along with terminfo. Use of one of these libraries is preferred.

>In any case, ncurses comes with copious examples and
>documentation, so you should be able, rather quickly, to
>give output text any color or boldness you like.

>http://www.veryComputer.com/

>If you run into problems the included documentation doesn't
>address (which I think is pretty uncommon), you can ask here,
>sometimes Thomas*ey, the ncurses maintainer, is reading.

 
 
 

Change font type and setting from a C/C++ program in Linux environment

Post by Van H L » Fri, 08 Mar 2002 05:21:31


Hi Thomas,

I just went through the termcap man page and quite frankly, I am more
confused than ever. Maybe because i am a kind of slow person. Could
you point out how I can set to bold font from a C program in Linux, an
example, perhaps?

Thanks.




>> terminfo is also less portable. For example, I just looked at the manpages
>> for NetBSD and Linux and curses is very different on these two platforms.

>not really (you're making an incomplete comparison).  ncurses works fine on
>both platforms, but the *BSD platforms have varying configurations (NetBSD in
>particular has not-invented-here syndrome, preferring to evolve the BSD curses
>into something more/less compatible with X/Open curses than to use ncurses).

>Point in fact:  the 1.5.2 NetBSD curses is broken (leaves the terminal in raw
>mode after exit).

>termcap likewise is not really compatible - even among the *BSD's there are
>differences (owing mainly to the fact that the termcap interface was never
>well-defined, and applications rely on undocumented features).  Between Linux
>and *BSD's, there is the added incompatibility between the allowed size of
>termcap entries (even true of real Unix stuff such as SCO).

 
 
 

1. Newbie: Help setting environment for C/C++ programming

 Hi all,

Please tell me where I can find info on configuring my Linux system
(RedHat 6.0 -- from the 'LinuxAnswers' magazine). I'm just starting
with Linux (and currently have about 32hrs experience, built on some
ancient general Unix knowledge dating back 6 years)

The problem I'm facing is that I want to compile some tryout programs
in C and C++ but my environment apparently is not set up correctly.

C programs compile OK at the moment (I've added the C_INCLUDE_PATH and
LIBRARY_PATH environment settings to get gcc going).

What environment settings are required to do C++ compiles? I did a
CPLUS_INCLUDE_PATH setting to the directory containing files like
iostream.h, but now the ld is complaining about (if memory serves me
-- I'm not at home right now):

from 'main':
..reference to undefined symbol 'cin'...
..reference to undefined symbol 'cout'...
..reference to undefined symbol 'iostream<<'... (or something)
<snip>
..reference to undefined symbol 'cin'...

This looks like ld cannot find the default C++ libraries, but I don't
know where they are/should be either.

Where can I find this basic information? I've browsed several HOWTOs
and Info pages, but they do not appear to be very Newbie friendly.

TIA

Jean-Marc.

--
   /--- #include: <disclaim.std> ----------------/

 /ingbank.com            /                     /
/---------------------------------------------/

Sent via Deja.com http://www.deja.com/
Before you buy.

2. X11R6 And XFree86 3.0

3. pick script in The UNIX Programming Environment (The UNIX Programming Environment )

4. OT: NETWORK, WEB, DEVELOPERS ***

5. is it possible to set up sendmail in a change-rooted environment on linux?

6. Fonts problem while starting X.

7. How do I change the font in Gnome / AfterStep in an X Window environment

8. Windows 98 + FreeBSD 2.2.8 LAN (Help)

9. C++ programming and environments

10. advice for c++ programming environment

11. How to do C++ programming in unix environment??

12. SNiFF+ takeFive Starts Free University Distribution of Commercial C/C++ Programming Environment

13. Getting Environment Variables from CGI C++ Program