Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change font size in console application using C

Tags:

c

How can I change the font size of a printed font using c?

 printf ("%c", map[x][y]);

I want to print an array larger than all the other text in the program. Is there a way to just make that statement print larger?

like image 812
Guardian Avatar asked Mar 09 '13 22:03

Guardian


People also ask

How do I change font size in console C?

You change the console window, by opening it, and then right clicking on the top bar of the window, and choosing either "Properties" or "Default". They both have the same settings for both color and font, but any change you make will be temporary, (one time only), if you choose "Properties".

How do I change font size in CLI?

Right Click the top bar of the Command Prompt Window (i.e. Right Click the words "Command Prompt" on the top left) and select Properties. There you can change Font, Size, Color and other options. Please let us know the results and if you need further assistance. Was this reply helpful?

How do I increase font size in AWS console?

To change the font size of AWS CloudShell, click on the gear icon in the upper right corner of the AWS Console. Note: The gear icon is actually called the preferences button. This will show the preferences panel.

How do I change the font size in R console?

Go to the menu in RStudio and click on Tools and then Global Options. Select the Appearance tab on the left. Again buried in the middle of things is the font size. Change this to 14 or 16 to start with and see what it looks like.


2 Answers

Although teppic's answer to use system() will work, it is rather intensively heavy-handed to call an external program just to do that. As for David RF' answer, it is hard-coded for a specific type of terminal (probably a VT100-compatible terminal type) and won't support the user's actual terminal type.

In C, you should use terminfo capabilities directly:

#include <term.h>

/* One-time initialization near the beginning of your program */
setupterm(NULL, STDOUT_FILENO, NULL);

/* Enter bold mode */
putp(enter_bold_mode);

printf("I am bold\n");

/* Turn it off! */
putp(exit_attribute_mode);

Still, as teppic notes, there is no support for changing the font size. That's under the user's control.

like image 120
Celada Avatar answered Oct 22 '22 16:10

Celada


If you are under some unix, you can try to activate and deactivate bold text:

printf("\033[1m%c\033[0m", map[x][y]);
like image 33
David Ranieri Avatar answered Oct 22 '22 15:10

David Ranieri