How to get terminal size or font size in pixels?

后端 未结 4 1899
执念已碎
执念已碎 2021-01-13 03:58

I\'ve seen some posts and answers about how to get the terminal size in numbers of columns and rows. Can I get the terminal size, or equivalently, the size of the font used

4条回答
  •  萌比男神i
    2021-01-13 04:33

    So, you already know how to get terminal size (here) in characters.

    I'm afraid it is not possible. TTY is a text terminal and doesn't have control of where it is running. So if your console program is executed in the terminal, you can't know where is it displaying.

    However, you can use graphical mode to take control of fonts, display, etc. But why terminal? You can use GUI for that.

提交回复
热议问题