Share via


LanguageFontGroup 类

定义

为各种用例的给定语言或脚本提供一组字体建议。

public ref class LanguageFontGroup sealed
/// [Windows.Foundation.Metadata.Activatable(Windows.Globalization.Fonts.ILanguageFontGroupFactory, 65536, Windows.Foundation.UniversalApiContract)]
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.MTA)]
class LanguageFontGroup final
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.MTA)]
/// [Windows.Foundation.Metadata.Activatable(Windows.Globalization.Fonts.ILanguageFontGroupFactory, 65536, "Windows.Foundation.UniversalApiContract")]
class LanguageFontGroup final
[Windows.Foundation.Metadata.Activatable(typeof(Windows.Globalization.Fonts.ILanguageFontGroupFactory), 65536, typeof(Windows.Foundation.UniversalApiContract))]
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.MTA)]
public sealed class LanguageFontGroup
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.MTA)]
[Windows.Foundation.Metadata.Activatable(typeof(Windows.Globalization.Fonts.ILanguageFontGroupFactory), 65536, "Windows.Foundation.UniversalApiContract")]
public sealed class LanguageFontGroup
function LanguageFontGroup(languageTag)
Public NotInheritable Class LanguageFontGroup
继承
Object Platform::Object IInspectable LanguageFontGroup
属性

Windows 要求

设备系列
Windows 10 (在 10.0.10240.0 中引入)
API contract
Windows.Foundation.UniversalApiContract (在 v1.0 中引入)

示例

// 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

注解

LanguageFontGroup 为特定语言或脚本提供一组字体建议。 给定 LanguageFontGroup 建议的不同字体(作为单独的 LanguageFontGroup 属性公开)对应于不同的用例。

每个 LanguageFontGroup 属性返回一个 LanguageFont 对象,该对象提供该特定字体建议的详细信息。 这些详细信息包括字体系列以及字体粗细、样式和拉伸属性。

权重/样式/拉伸属性对于某些用例非常重要,但对于其他用例则不重要。 例如,针对各种 UI 用法类别的字体建议可能使用同一字体系列中的字体,但粗细 (不同,例如,Segoe UI Semilight for UITextFont,而 Segoe UI Regular for UICaptionFont) 。 但对于某些用例,粗细/样式/拉伸属性可能始终指示“常规”字体 (常规粗细、正常样式、正常拉伸) 。 在这些情况下,应用可能需要应用其他适合应用场景的粗细/样式/拉伸格式。 有关其他信息,请参阅每个 LanguageFontGroup 属性的备注。

对于某些语言和脚本,LanguageFontGroup 可能不会为每个用例提供字体建议。 例如,Windows 中没有为每个脚本提供固定宽度字体。 有关其他信息,请参阅每个 LanguageFontGroup 属性的备注。

注意

如果你的应用将此类中使用的语言标记传递给任何 国家/地区语言支持 函数,则它必须首先通过调用 ResolveLocaleName 来转换标记。

从 开始: LanguageFontGroup 类返回字体组数据,以匹配为其开发应用的目标操作系统。 因此,如果将 Windows 8 应用更新为Windows 8.1,则应用中使用的字体可能会更改,并且你可能需要调整 UI 布局。

构造函数

LanguageFontGroup(String)

为给定语言或脚本创建 LanguageFontGroup 对象。

属性

DocumentAlternate1Font

获取一种字体,建议作为附加选项在 DocumentHeadingFontModernDocumentFontTraditionalDocumentFont 提供的建议之外的文档中使用。

DocumentAlternate2Font

获取一种字体,建议作为附加选项在 DocumentHeadingFontModernDocumentFontTraditionalDocumentFont 提供的建议之外的文档中使用。

DocumentHeadingFont

获取建议在文档标题中使用的字体。

FixedWidthTextFont

获取建议用于显示固定宽度字符的字体。

ModernDocumentFont

获取一种字体,该字体建议用于遵循新式样式约定的典型文档正文文本。

TraditionalDocumentFont

获取一种字体,该字体建议用于遵循传统样式约定的典型文档正文文本。

UICaptionFont

获取建议用于特殊 UI 元素(如标题)的字体,这些元素以小于典型 UI 正文文本的大小显示。

UIHeadingFont

获取建议用于特殊 UI 元素(如标题)的字体,这些元素以比典型 UI 正文文本稍大一些的大小显示。

UINotificationHeadingFont

获取建议用于特殊 UI 元素(如通知或其他应用消息中的标题)的字体,这些元素以 UI 正文文本大小显示或仅稍大一些,但需要与 UI 正文文本区分开来。

UITextFont

获取建议用于典型 UI 正文文本的字体。

UITitleFont

获取建议用于特殊 UI 元素的字体,该字体设置为比典型 UI 正文文本大得多的大小。

适用于

另请参阅