自定义字体是否可以在另一台设备中使用

Will a Custom font be available in another Device

我正在用pyqt5做一个软件。我使用了 Consolas 字体,但我需要先下载并安装它,所以我的问题是该程序是否可以在另一个没有安装字体的设备上正常工作?

缺少字体是一个已知问题,如果字形不存在,QFont 会使用回退:

来自 QFont - Detailed description(强调我的)

When you create a QFont object you specify various attributes that you want the font to have. Qt will use the font with the specified attributes, or if no matching font exists, Qt will use the closest matching installed font.

[...]

The font matching algorithm works as follows:

  1. The specified font families (set by setFamilies() ) are searched for.

  2. If not found, then if set the specified font family exists and can be used to represent the writing system in use, it will be selected.

  3. If not, a replacement font that supports the writing system is selected. The font matching algorithm will try to find the best match for all the properties set in the QFont . How this is done varies from platform to platform.

  4. If no font exists on the system that can support the text, then special “missing character” boxes will be shown in its place.

Note

If the selected font, though supporting the writing system in general, is missing glyphs for one or more specific characters, then Qt will try to find a fallback font for this or these particular characters. This feature can be disabled using NoFontMerging style strategy.

参见: