OSX: How can an application running in Terminal.app change the font size of its window?

862 Views Asked by At

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

There are 1 best solutions below

5
On BEST ANSWER

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.