tkinter 在 x window 下的字体设置格式

本文介绍了XFontDescriptors的格式,包括字体家族、权重、斜体、大小及字符集等字段的具体含义,并提供了示例。适用于X服务器、Windows和Macintosh平台。

X Font Descriptors #

X Font Descriptors are strings having the following format (the asterisks represent fields that are usually not relevant. For details, see the Tk documentation, or an X manual):

-*-family-weight-slant-*--*-size-*-*-*-*-charset

The font family is typically something like TimesHelveticaCourier orSymbol.

The weight is either Bold or Normal. Slant is either R for “roman” (normal), Ifor italic, or O for oblique (in practice, this is just another word for italic).

Size is the height of the font in decipoints (that is, points multiplied by 10). There are usually 72 points per inch, but some low-resolution displays may use larger “logical” points to make sure that small fonts are still legible. Thecharacter set, finally, is usually ISO8859-1 (ISO Latin 1), but may have other values for some fonts.

The following descriptor requests a 12-point boldface Times font, using the ISO Latin 1 character set:  #这个就是编码格式

-*-Times-Bold-R-*--*-120-*-*-*-*-ISO8859-1

If you don’t care about the character set, or use a font like Symbol which has a special character set, you can use a single asterisk as the last component:

-*-Symbol-*-*-*--*-80-*

A typical X server supports at least TimesHelveticaCourier, and a few more fonts, in sizes like 8, 10, 12, 14, 18, and 24 points, and in normal, bold, and italic (Times) or oblique (HelveticaCourier) variants. Most servers also support freely scaleable fonts. You can use programs like xlsfonts andxfontsel to check which fonts you have access to on a given server.

This kind of font descriptors can also be used on Windows and Macintosh. Note that if you use Tk 4.2, you should keep in mind that the font family must be one supported by Windows (see above).

 

一般用法这样 -*-文泉驿等宽微米黑-*-*-*--*-420-* 

 

转载于:https://www.cnblogs.com/yemeng/p/5679239.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值