font QML Value Type

QFont font 型は、 の特性を持つフォント値を指すQFont

詳細説明

font 型のプロパティのデフォルトは、アプリケーションのデフォルトfont です。

最もよく使われるプロパティは以下のとおりです:

pointSizepixelSize の両方が指定 さ れてい る と き は、pixelSize が用い ら れます。

以下のプロパティも使用できます:

    Text {
        font.family: "Helvetica"
        font.pointSize: 13
        font.bold: true
    }

fontstructured value 型なので、JavaScript オブジェクトで構築することもできます:

    readonly property font myFont: ({
        family: "Helvetica",
        pointSize: 13,
        bold: true
    })

C++と統合する場合、C++からQMLに渡された QFont の値は自動的にfont の値に変換されることに注意してください。

この値型はQtQuick のインポートによって提供されます。

フォントのウェイトの数値はCSSの仕様に従い、100は極端に軽く、900は極端に太くなります。以下の値が使えます:

定数説明
Font.Thin100
Font.ExtraLight200
Font.Light300
Font.Normal400
Font.Medium500
Font.DemiBold600
Font.Bold700
Font.ExtraBold800
Font.Black900

大文字小文字は以下の値をサポートしています:

定数説明
Font.MixedCase大文字小文字の変更は適用されません。
Font.AllUppercaseテキストがすべて大文字で表示されるように変更します。
Font.AllLowercaseテキストがすべて小文字で表示されるように変更します。
Font.SmallCapsテキストを小文字で表示します。
Font.Capitalize各単語の最初の文字を大文字としてテキストをレンダリングするように変更します。

ヒント設定の設定は、"NativeRendering "レンダリングタイプを使用している場合にのみ効果があります。このプロパティは以下の値をサポートしています:

定数説明
Font.PreferDefaultHintingターゲットプラットフォームのデフォルトのヒンティングレベルを使用します。
Font.PreferNoHinting可能であれば、グリフの輪郭をヒンティングせずにテキストをレンダリングする。
Font.PreferVerticalHinting可能であれば、水平方向にはヒンティングなしでテキストをレンダリングするが、垂直方向にはグリフをピクセルグリッドに揃える。
Font.PreferFullHinting可能であれば、水平方向と垂直方向の両方にヒンティングを付けてテキストをレンダリングする。

関連項目: QML 値の型

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