Qt同时使用多种字体 [英] Qt Use Multiple Fonts at the Same Time
问题描述
- FontA:包含拉丁语,希腊语,Cryllic字符
- FontB:包含韩文字符
- FontC:包含日文,汉字
这些字体没有重叠。
我想设置我的应用程序,使所有这些字体一次使用,因为来自不同语言的字符可能在我的软件中出现在相同的上下文中。
如果在FontA中找到一个字符,请使用它。否则,请查看FontB,如果发现使用它。如果找到FontC,请使用它,否则不执行任何操作。
如何设置Qt功能?
(我的环境是嵌入式linux,Qt 4.8)
PS:我尝试过QFont :: insertSubstitution,但是如果FontA不是安装在系统上,这样在我的情况下并没有真正的帮助。
PPS:将这些字体合并为一个字体是不成问题的,因为它们是专有字体。
尝试使用这种方法:如何(正确地)在Qt-Embedded中输出多语言文本?
它同时支持许多语言(西里尔文,欧洲,泰国,日本等)。
- 将Droid字体(不需要,也适用于其他字体)放入目录Qt可以找到它,
- 导出特殊环境变量:
export QWS_NO_SHARE_FONTS = 1
- 使用
-fn运行应用程序Droid Sans
参数
I have three fonts i want to use in my software:
- FontA: contains Latin, Greek, Cryllic characters
- FontB: contains Korean characters
- FontC: contains Japanese, Chinese characters
These fonts have no overlap.
I want to setup my application such that all of these fonts are used at once since characters from different languages may appear in the same context in my software.
If a character is found in FontA, use it. Otherwise, look at FontB, if found use it. Look at FontC as last resort, if found, use it, otherwise do nothing.
How can i setup Qt to function that way?
(My environment is embedded linux, Qt 4.8)
P.S.: I tried QFont::insertSubstitution, but it is used in case FontA is not installed on the system so that doesn't really help in my case.
P.P.S.: Merging these fonts into a single font is out of the question since they are proprietry fonts.
Try to use this approach: How to (properly) output multilingual text in Qt-Embedded?
It works with lots of languages simultaneously (Cyrillic, European, Thai, Japanese, etc).
- Put Droid Fonts (not necessary, it should work with other fonts too) into a directory where Qt can find it,
- Export special environment variable:
export QWS_NO_SHARE_FONTS=1
- Run your application with
-fn "Droid Sans"
parameter
这篇关于Qt同时使用多种字体的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!