[Interest] Multi language/font display in qt4

Simone cjb.sw.nospam at gmail.com
Sun Feb 2 20:53:27 CET 2014


Hello newly,
I solved my problems for displaying chinese characters. I simple put a chinese font in the fontdir of the system, and all works! I'm impressed, i am able to display chinese characters without too much efforts.

Now i have the problem of the Input Method.
Now i don't use any input methods, and i don't know minimally what i need and how it works.

How I can handle complex combinations of characters like normal typing in korean or chinese?
How input method work with QWS (non X11 system) and what is the best solution?

Thanks
Simone




> Il giorno 26/gen/2014, alle ore 14:04, Simone <cjb.sw.nospam at gmail.com> ha scritto:
> 
> Thank you Oliver,
> One thing, i saw that exactly the same application i can run on windows and see also chinese fonts (with dejavu sans as application font). On my embedded target with the same font chinese chars are not displayed (i can see an empty white square).
> 
> Why?
> Isn't working with the same logic on windows?
> 
> Bye
> Simone
> 
> 
> 
> 
> 
>>> Il giorno 26/gen/2014, alle ore 13:43, Till Oliver Knoll <till.oliver.knoll at gmail.com> ha scritto:
>>> 
>>> Am 26.01.2014 um 12:57 schrieb Simone <cjb.sw.nospam at gmail.com>:
>>> 
>>> ...
>>> Are you sure of that?
>>> I read some article about fontconfig and seems that there is a solution, but i have not understood how it work.
>> 
>> Basically your problem is the following:
>> 
>> * If the character to be displayed is in the "Latin 1" Unicode range, then use font A
>> 
>> * Else (character is in "Asian language" Unicode range): use font B
>> 
>> I am pretty sure that there is no Qt API which would let you define such a "Unicode range"-dependent font.
>> 
>> So either you could try to get hold of some underlying (fontconfig) API which might (?) provide such a feature, or you would pre-process each text before you pass it to Qt to render it as (HTML) text.
>> 
>> That is, you would iterate over each character and whenever the Unicode range changes, you would set the font accordingly. Something like the following could work:
>> 
>> <span font="A">Latin 1 text followed by </span><span font="B">asian characters.</span>
>> 
>> Depending on the Qt API used to display text (e.g. QLabel::setText) that  HTML formatting is then evaluated/considered.
>> 
>> Cheers,
>> Oliver
>> _______________________________________________
>> Interest mailing list
>> Interest at qt-project.org
>> http://lists.qt-project.org/mailman/listinfo/interest



More information about the Interest mailing list