当使用的字体不支持这种语言时,Label 控件如何正确显示日语字符? [英] How can a Label control display Japanese characters properly when the Font used doesn't support this language?

查看:11
本文介绍了当使用的字体不支持这种语言时,Label 控件如何正确显示日语字符?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

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

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

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

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

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆