I'm writing a terminal game build on ncurses
.
I should ensure the window in suitable size.
How to adjust terminal window display 20 lines when running the process?
I think it should be use some C API. Thanks
Asked
Active
Viewed 230 times
1

LoranceChen
- 2,453
- 2
- 22
- 48
1 Answers
0
You can use
int resizeterm(int lines, int columns);
to properly resize the terminal in ncurses.
Edit
The OP wants to change the font of Terminal so
It's not really possible to adjust the terminal font using an ncurses. That's beyond the scope of ncurses. however if you're on mac :-) and this is where things become less portable, you can write a helper shell script that invokes applescript for mac os x ... .Have a look at OSX: How can an application running in Terminal.app change the font size of its window?

Ahmed Masud
- 21,655
- 3
- 33
- 58
-
thanks.I have attempt it. Sorry for it only limit input area but adjust font size to filling whole terminal window. I'm on macOS and use zsh and setting TERM as xterm-256color, is the function relative to terminal type? – LoranceChen Feb 27 '18 at 03:37
-
It's not really possible to adjust the terminal font using an ncurses. That's beyond the scope of ncurses. however if you're on mac :-) and this is where things become less portable, you can write a helper shell script that invokes applescript for mac os x ... .Have a look at https://stackoverflow.com/questions/31778041/osx-how-can-an-application-running-in-terminal-app-change-the-font-size-of-its – Ahmed Masud Feb 27 '18 at 03:50
-
The script is works well! besides, do you have any idea to fit terminal just 20 lines? – LoranceChen Feb 27 '18 at 04:01