Author Topic: Controlling terminal fonts  (Read 2805 times)

0 Members and 1 Guest are viewing this topic.

Offline Binder News

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 785
  • Rating: +46/-3
  • Zombie of Tomorrow
    • View Profile
Controlling terminal fonts
« on: October 25, 2011, 09:13:45 pm »
Hey all! After a long time of no activity here, I am finally back, with a question.
How can I, FROM INSIDE A C/C++ PROGRAM, change the font of the terminal (this is on Linux)?

Thanks,
Binder News
Spoiler For userbars:







Hacker-in-training!   Z80 Assembly Programmer     Axe Programmer
C++ H4X0R             Java Coder                           I <3 Python!

Perdidisti ludum     Cerebrum non habes

"We are humans first, no matter what."
"Fame is a vapor, popularity an accident, and riches take wings. Only one thing endures, and that is character."
Spoiler For Test Results:





Offline BalancedFury

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 722
  • Rating: +29/-2
    • View Profile
Re: Controlling terminal fonts
« Reply #1 on: October 25, 2011, 09:16:13 pm »
Right click on the white bar inside a black screen, and click properties.
I hope this helps
Antonio Nam = DualBLDR = Tony Arthur... U choose!





JOIN THE PETITION TO ADD THIS EMOTICON!!
[|:{P ------->


Yo dawg I herd u lost the game game so I coded the game game in your calc so you can lose the game game while you code your code about losing the game game.

Offline alberthrocks

  • Moderator
  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 876
  • Rating: +103/-10
    • View Profile
Re: Controlling terminal fonts
« Reply #2 on: October 25, 2011, 09:26:34 pm »
No, this is not possible. You can change the color, change lines, etc. but NOT the font. (If there's such a thing, it's dependent on a specific terminal emulator.)

However, if you're talking about printing underline/bold/(italics??) text, then yes it is possible! :)
For bold, you would do this:
Code: [Select]
printf("\033[1mBold text is awesome!\033[0m");Those are escapes for the ANSI standard terminal formatting. Take a peek here for more options:
http://pueblo.sourceforge.net/doc/manual/ansi_color_codes.html

EDIT: You can also see the results live without compiling any C/C++!
Simply type this into your terminal:
Code: [Select]
echo -e "\033[1mBold text is awesome"'!'"\033[0m" # The -e enables escapes
# OR... yes, it IS printf you're seeing below!
printf "\033[0mBold text is awesome"'!'"\033[0m" # I'm not too sure if the shell's printf supports printf(); formatting, aka printf("number %i", var); check your local man pages for details.
« Last Edit: October 25, 2011, 09:31:01 pm by alberthrocks »
Withgusto Networks Founder and Administrator
Main Server Status: http://withg.org/status/
Backup Server Status: Not available
Backup 2/MC Server Status: http://mc.withg.org/status/


Proud member of ClrHome!

Miss my old signature? Here it is!
Spoiler For Signature:
Alternate "New" IRC post notification bot (Newy) down? Go here to reset it! http://withg.org/albert/cpuhero/

Withgusto Networks Founder and Administrator
Main Server Status: http://withg.org/status/
Backup Server Status: Not available
Backup 2/MC Server Status: http://mc.withg.org/status/

Activity remains limited due to busyness from school et al. Sorry! :( Feel free to PM, email, or if you know me well enough, FB me if you have a question/concern. :)

Don't expect me to be online 24/7 until summer. Contact me via FB if you feel it's urgent.


Proud member of ClrHome!

Spoiler For "My Projects! :D":
Projects:

Computer/Web/IRC Projects:
C______c: 0% done (Doing planning and trying to not forget it :P)
A_____m: 40% done (Need to develop a sophisticated process queue, and a pretty web GUI)
AtomBot v3.0: 0% done (Planning stage, may do a litmus test of developer wants in the future)
IdeaFrenzy: 0% done (Planning and trying to not forget it :P)
wxWabbitemu: 40% done (NEED MOAR FEATURES :P)

Calculator Projects:
M__ C_____ (an A____ _____ clone): 0% done (Need to figure out physics and Axe)
C2I: 0% done (planning, checking the demand for it, and dreaming :P)

Offline Binder News

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 785
  • Rating: +46/-3
  • Zombie of Tomorrow
    • View Profile
Re: Controlling terminal fonts
« Reply #3 on: October 25, 2011, 09:39:38 pm »
Okay. Thanks. I wanted to port Block Dude to the terminal, and wanted to use my own font, but I guess I'll have to use the default character set. Thanks.
Spoiler For userbars:







Hacker-in-training!   Z80 Assembly Programmer     Axe Programmer
C++ H4X0R             Java Coder                           I <3 Python!

Perdidisti ludum     Cerebrum non habes

"We are humans first, no matter what."
"Fame is a vapor, popularity an accident, and riches take wings. Only one thing endures, and that is character."
Spoiler For Test Results: