简体   繁体   中英

Change font style in terminal to a specified .ttf file

I am creating a terminal game which uses a specific font to display graphics. The problem is that it is inconvenient to manually have to switch font every time the game is started and stopped. The game should run on OS X and Linux and should mainly support xterm. Is there any hack which allows this to be automated?

No, there is no generally applicable way of doing this. Sorry.

I can think of a couple specific awful hacks that you could use to change the user's font in specific environments -- for instance, if the user is using macOS and running Terminal.app, you could use Applescript to alter the font. However this trick wouldn't work even if the user were using another terminal in macOS, let alone on Linux.

If you need a specific font, you should write your game to run as a graphical desktop application, rather than in a terminal.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM