LanguageFont LanguageFont LanguageFont LanguageFont Class

Provides data related to a particular font recommendation for a given language.

Syntax

Declaration

public sealed class LanguageFontpublic sealed class LanguageFontPublic NotInheritable Class LanguageFontpublic sealed class LanguageFont

Remarks

A LanguageFont object provides data giving a font recommendation for a particular language and for particular usage cases. LanguageFont objects are obtained from a LanguageFontGroup object, which is constructed for a particular language or script. Each LanguageFontGroup object provides different LanguageFont objects for different usage cases.

Depending on the usage case, font weight/style/stretch attributes provided in the LanguageFont may or may not be significant: for some usage cases, a "regular" font (regular weight, normal style, normal stretch) may always be returned. Applications may want to apply other weight/style/stretch formatting in those cases. See the remarks on the different usage cases for LanguageFontGroup.

The ScaleFactor property provides a multiplier that can be applied to a nominal font size. See the ScaleFactor property topic for additional information.

The fonts referenced by a LanguageFont are always fonts that ship as part of Windows. There is no way for an end user or developer to customize these values. It is safe to assume that the font will be present on every Windows 8 system.

Examples

// Get the recommended Japanese fonts for traditional documents and modern documents.
var fonts = new Windows.Globalization.Fonts.LanguageFontGroup('ja-JP');
var traditionalDocumentFont = fonts.traditionalDocumentFont;
var modernDocumentFont = fonts.modernDocumentFont;

// Obtain two properties of the traditional document font.
var traditionalDocumentFontFontFamily = traditionalDocumentFont.fontFamily;   // "MS Mincho"
var traditionalDocumentFontScaleFactor = traditionalDocumentFont.scaleFactor; // 100

// Obtain two properties of the modern document font.
var modernDocumentFontFontFamily = modernDocumentFont.fontFamily;             // "Meiryo"
var modernDocumentFontScaleFactor = modernDocumentFont.scaleFactor;           // 90
// Get the recommended Japanese fonts for traditional documents and modern documents.
var fonts = new Windows.Globalization.Fonts.LanguageFontGroup("ja-JP");
var traditionalDocumentFont = fonts.TraditionalDocumentFont;
var modernDocumentFont = fonts.ModernDocumentFont;

// Obtain two properties of the traditional document font.
var traditionalDocumentFontFontFamily = traditionalDocumentFont.FontFamily;   // "MS Mincho"
var traditionalDocumentFontScaleFactor = traditionalDocumentFont.ScaleFactor; // 100

// Obtain two properties of the modern document font.
var modernDocumentFontFontFamily = modernDocumentFont.FontFamily;             // "Meiryo"
var modernDocumentFontScaleFactor = modernDocumentFont.ScaleFactor;           // 90

Properties summary

Gets the family name of the font.

Gets the FontStretch property of the font.

Gets the FontStyle property of the font.

Gets the weight of the font (FontWeight ).

The weight of the font is the lightness or heaviness of the strokes.

Gets a recommended font size scaling factor for the font.

The factor can be used to adjust relative sizes when two or more fonts are used for different runs within the same text element.

Properties

  • FontFamily
    FontFamily
    FontFamily
    FontFamily

    Gets the family name of the font.

    public string FontFamily { get; }public string FontFamily { get; }Public ReadOnly Property FontFamily As stringpublic string FontFamily { get; }

    Property Value

    • string
      string
      string
      string

      The font family name.

  • FontStretch
    FontStretch
    FontStretch
    FontStretch

    Gets the FontStretch property of the font.

    public FontStretch FontStretch { get; }public FontStretch FontStretch { get; }Public ReadOnly Property FontStretch As FontStretchpublic FontStretch FontStretch { get; }

    Property Value

  • FontStyle
    FontStyle
    FontStyle
    FontStyle

    Gets the FontStyle property of the font.

    public FontStyle FontStyle { get; }public FontStyle FontStyle { get; }Public ReadOnly Property FontStyle As FontStylepublic FontStyle FontStyle { get; }

    Property Value

  • FontWeight
    FontWeight
    FontWeight
    FontWeight

    Gets the weight of the font (FontWeight ).

    The weight of the font is the lightness or heaviness of the strokes.

    public FontWeight FontWeight { get; }public FontWeight FontWeight { get; }Public ReadOnly Property FontWeight As FontWeightpublic FontWeight FontWeight { get; }

    Property Value

  • ScaleFactor
    ScaleFactor
    ScaleFactor
    ScaleFactor

    Gets a recommended font size scaling factor for the font.

    The factor can be used to adjust relative sizes when two or more fonts are used for different runs within the same text element.

    public double ScaleFactor { get; }public double ScaleFactor { get; }Public ReadOnly Property ScaleFactor As doublepublic double ScaleFactor { get; }

    Property Value

    • double
      double
      double
      double

      The recommended font size scaling factor.

    Remarks

    The ScaleFactor property provides a multiplier that can be applied to a nominal font size. Scale factors are intended to be used within a single LanguageFontGroup usage case so that text in different languages and scripts (that is, using different recommended fonts) will appear at complementary sizes. Scale factors within a single LanguageFontGroup usage case may be compared, but it is not appropriate to compare scale factors between different LanguageFontGroup usage cases.

    For example, suppose a user interface heading element is nominally set at 36 pt. Suppose further that instances of that element are displayed side-by-side in Korean and English. An application can construct LanguageFontGroup objects for Korean and for English, and then obtain the UIHeadingFont LanguageFont for each language. The LanguageFont for English might have a scale factor of 1.0, while the LanguageFont for Korean might have a scale factor of 0.96. If the English text is set at 36 pt and the Korean text is set at 34.56 pt (= 36 × 0.96), then the two text elements will appear better side-by-side than if both had been displayed at 36 pt.

    For most LanguageFontGroup usage cases, the scale factor is chosen to make the size and weight of the different fonts more compatible with one another. For the FixedWidthTextFont usage case, however, the scale factor is chosen to make the widths of characters in different fixed-width fonts more compatible with one another.

Device family

Windows 10 (introduced v10.0.10240.0)

API contract

Windows.Foundation.UniversalApiContract (introduced v1)

Attributes

Windows.Foundation.Metadata.ContractVersionAttribute
Windows.Foundation.Metadata.DualApiPartitionAttribute
Windows.Foundation.Metadata.MarshalingBehaviorAttribute

Details

Assembly

Windows.Globalization.Fonts.dll