问题
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
回答1:
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?
来源:https://stackoverflow.com/questions/49000659/how-to-make-terminal-resize-to-20-lines-in-c