问题
How can an application running in a Terminal.app window change its window's font size? No solution (such as a system call to applescript, etc) too odd!
回答1:
It's relatively simple to do this; the only real caveat is that you might need to adjust the window size if you want it to remain consistent with it's proportions, since the font size seems to affect it.
Applescript called from Bash:
#!/bin/bash
osascript <<EOF
tell application "System Events"
tell process "Terminal"
set frontmost to true
end tell
end tell
tell application "Terminal"
set font size of first window to "11"
delay 1.0
set font size of first window to "14"
end tell
EOF
This shows about the most basic example which should work for anything currently active within a Terminal
window. Applescript is ideal for this type of thing, however, if the font sizing requires a lot of typographic manipulation then you might need to consider something different.
If you're interested in additional Terminal window adjustments I've listed some others here.
来源:https://stackoverflow.com/questions/31778041/osx-how-can-an-application-running-in-terminal-app-change-the-font-size-of-its