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"
}

另请参阅 FontMetricsTextMetrics

属性文档

bold : bool [read-only]

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

另请参阅 weightQFontInfo::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]

该属性包含匹配字体的权重。

另请参阅 boldQFontInfo::weight()。


© 2025 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.