本页内容

FontInfo QML Type

提供有关特定字体查询如何得到解决的信息。更多...

Import Statement: import QtQuick
Since: Qt 6.9

属性

详细说明

FontInfo 提供有关 Qt 字体选择系统针对字体查询所匹配的实际字体的信息。

它对应于 C++ 中的 `QFontInfo ` 类。

FontInfo {
    id: fontInfo
    font.family: "Arial"
}

Text {
    text: fontInfo.family === "Arial"
        ? "System has 'Arial' font"
        : "System does not have 'Arial' font"
}

另请参阅 FontMetrics 和TextMetrics 。

属性文档

bold : bool [read-only]

如果 weight() 返回的值大于 Font.Normal,则该属性为 true;否则返回 false。

另请参阅 ` weight ` 和 `QFontInfo::bold()`。

family : string [read-only]

该属性保存匹配字体的字族。

另请参阅 QFontInfo::family()。

fixedPitch : bool [read-only]

该属性存储匹配字体的固定字距值。

另请参阅 QFontInfo::fixedPitch()。

font : font

该属性存储了将由FontInfo 解析的字体。

italic : bool [read-only]

该属性存储匹配字体的斜体值。

另请参阅 ` QFontInfo::italic()`。

pixelSize : int [read-only]

该属性存储匹配字体的像素大小。

另请参阅 QFontInfo::pixelSize()。

pointSize : real [read-only]

该属性存储匹配字体的点大小。

另请参阅 QFontInfo::pointSizeF()。

style : enum [read-only]

该属性保存匹配字体的样式。

常量描述
Font.StyleNormal包含没有斜体倾斜度的常规字形。
Font.StyleItalic包含专为表示斜体文本而设计的字形。
Font.StyleOblique包含具有斜体外观的字形,通常并非专门设计,而是通过在字体家族的常规字形上应用倾斜效果生成的。

另请参阅 QFontInfo::style()。

styleName : real [read-only]

该属性存储数学字体的样式名称(或“子字体”)。

另请参阅 ` QFontInfo::styleName()`。

variableAxes : list [read-only]

该属性存储匹配字体所支持的变量轴。该列表由QFontVariableAxis 对象组成,这些对象具有以下属性:tag 、name 、minimumValue 、maximumValue 以及defaultValue 。

另请参阅 QFontInfo::variableAxes() 和QFontVariableAxis 。

weight : int [read-only]

该属性存储匹配字体的字重。

另请参阅 bold 和QFontInfo::weight()。

© 2026 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.