C - How to change font size in Ncurses?

I do not believe it is possible. The terminal is not for such things. It is meant for displaying text in sometimes varying colors. If you want to change the font size, you would need to open a window and draw to it (That might not actually be the correct term. Graphics aren't my forte). If this is what you want to do, I suggest looking into sdl. It is fairly simple to set up and is easy (IMO) to use. And because I know stackoverflow doesn't like flamewars, I am by no means saying it is the best. Im sure there are plenty of alternatives that are just as good. I just have not used them


If the text is being displayed in an xterm then it can be changed. Edit .Xresources and add (probably at the top):

xterm*font: *-fixed-*-*-*-20-*
xterm*geometry: 80x24+5+5

This specifies a font size of 20 with a 80x24 charactor xterminal window located in the upper left of the display (widthxheight+xoffset+yoffset)

I was unable to use a font larger than 20. I start the application from a terminal window with the command line below on Ubuntu 14.04 with XFCE GUI.

xterm -e my_c_app

Well, it can be done if you are running on Windows command windows. I did that.

Ncurses will use your console windows settings: colors, size and typeface. This works, but it is a somewhat basic mode of use. If needed you can even change the character attributes by program, before initializing ncurses terminal.

I tried with monospaced typefaces without any problems, tried even with proportional typefaces. It works also, but here visual quality is lesser due to the "entangling" of some characters, because ncurses keeps spacing in monospace mode.

I didn't try (yet) to change the character mode "in flight", but believe that this is possible. But i think that you can use only one mode/size for a time, that is: you cannot mix typefaces / sizes at the same screen.

Tags:

C

Fonts

Ncurses