OSX:在Terminal.app中运行的应用程序如何更改其窗口的字体大小? [英] OSX: How can an application running in Terminal.app change the font size of its window?

查看:118
本文介绍了OSX:在Terminal.app中运行的应用程序如何更改其窗口的字体大小?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Terminal.app窗口中运行的应用程序如何更改其窗口的字体大小?没有解决方案(例如对applescript的系统调用等)太奇怪了!

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!

推荐答案

这样做相对简单;唯一真正的警告是,如果您希望窗口大小与窗口的比例保持一致,则可能需要调整窗口大小,因为字体大小似乎会影响到它.

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.

从Bash调用的Applescript :

#!/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

这显示了最基本的示例,该示例适用于Terminal窗口中当前活动的任何内容. Applescript非常适合这种类型的事情,但是,如果字体大小需要大量的印刷操作,那么您可能需要考虑一些不同的东西.

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.

如果您对其他终端窗口调整感兴趣,请在 此处 a> .

If you're interested in additional Terminal window adjustments I've listed some others here.

这篇关于OSX:在Terminal.app中运行的应用程序如何更改其窗口的字体大小?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆