当使用的字体不支持这种语言时,标签控件如何正确显示日文字符?

How can a Label control display Japanese characters properly when the Font used doesn#39;t support this language?(当使用的字体不支持这种语言时,标签控件如何正确显示日文字符?)
本文介绍了当使用的字体不支持这种语言时,标签控件如何正确显示日文字符?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个以 .Net 4.5 作为目标框架的 Windows 窗体应用程序.

I am working on a Windows Forms application, with .Net 4.5 as target framework.

我注意到的一件事是,如果我在 Label 控件上显示日语文本,而标签 (Arial) 的 Font 不支持日语字符,那么 >标签可以成功显示那些字符.

One thing I have noticed that if I display text in Japanese language on Label control while Font of label (Arial) is not supporting Japanese characters, then too Label can successfully display those characters.

如果我在为其分配日文文本之前和之后检查标签的字体属性,它会显示Arial".只是,所以字体可能不会动态变化.

If I check font property of the label before and after assigning Japanese text to it, it shows me "Arial" only, so probably fonts are not dynamically changing.

Label 有哪些内部功能可以实现这一点?

What internal functionality Label have which enables it to achieve this?

推荐答案

关于字体回退
系统功能,绑定到 国际字体管理.它自动选择用户在应用程序中选择的字体以外的字体,以表示正在使用的字体无法处理的字形.
另请参阅:国际字体枚举和选择

About Font fallback
System feature, tied to the International Font Management. It automates the selection of a font other than the font selected by the user in an application, to represent glyphs that the font in use can't handle.
See also: International Font Enumeration and Selection

可以在系统注册表中找到一系列预定义的替代字体:

A selection of predefined font substitutes can be found in the System Registry:

HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindows NTCurrentVersionFontLinkSystemLink

此处报告了与 RichTextBox/RichEdit 控件相关的示例和一些注释:
某些键会更改我的 RichTextBox 字体

An example and some notes, in relation to the RichTextBox/RichEdit control, are reported here:
Some keys change my RichTextBox font

控件是使用 EM_SETLANGOPTIONS 集创建的到 IMF_AUTOFONT 选项.
预定义的行为,当当前字体无法显示 Unicode 子集时,它是自动字体回退.文本选择报告字体替换参考.

The control is created with EM_SETLANGOPTIONS set to the IMF_AUTOFONT option.
The predefined behaviour, when an Unicode subset cannot be displayed by the current font, it's an automatic font fallback. The text selection reports the font substitute reference.

可以使用 Unicode 选择替代字体当默认映射不返回直接匹配时,子集位域.

任何字体替换都与当前系统语言和可用的已安装字体有关.系统专门安装了许多字体来支持此功能.后备字体通常被标记为隐藏".在系统字体存储库中(Windows 中为 WindowsFonts).这些可以标记为可用/可枚举,使用工具栏按钮或上下文菜单中的 Show 命令.
(Arial Unicode 就是其中之一).

Any font subsitution is in relation with the current system language and the available installed fonts. A number of fonts is specifically installed by the System to support this feature. The fallback font are usually marked as "Hidden" in the System Font repository (WindowsFonts in Windows). These can be marked as usable/enumerable, using the Show command in the toolbar button or contextual menu.
(Arial Unicode is among these).

另见:

国际字体和文本显示
关于多语言用户界面
使用字体回退
Uniscribe

这篇关于当使用的字体不支持这种语言时,标签控件如何正确显示日文字符?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

DispatcherQueue null when trying to update Ui property in ViewModel(尝试更新ViewModel中的Ui属性时DispatcherQueue为空)
Drawing over all windows on multiple monitors(在多个监视器上绘制所有窗口)
Programmatically show the desktop(以编程方式显示桌面)
c# Generic Setlt;Tgt; implementation to access objects by type(按类型访问对象的C#泛型集实现)
InvalidOperationException When using Context Injection in ASP.Net Core(在ASP.NET核心中使用上下文注入时发生InvalidOperationException)
LINQ many-to-many relationship, how to write a correct WHERE clause?(LINQ多对多关系,如何写一个正确的WHERE子句?)