PDA

View Full Version : Qt and Arabic = Question marks!


mohannad
2010-05-01, 04:40
Hi

Ive been playing around with some Qt UI screens in Qt creator and wanted to try Arabic text in a text label (I need this for the application im working on). Now on my computer (Windows 7) the Arabic text displays fine in Qt Creator, however when I build and run the application on my n900 (using MADDE) I get a whole bunch of question marks instead of the Arabic characters.

Does anybody know what could be causing this? Do I need to download a special character set to display Arabic characters in Qt apps?

Any help would be appreciated.

Thanks

mohannad
2010-05-01, 09:54
Another strange thing that I just noticed is that when I restart Qt creator and open the UI screen with the Arabic text label, the Arabic text that was being displayed normally before is now just a bunch of question marks (just like on the n900).

vhs
2010-05-01, 16:40
Have you installed the Arabic fonts on the N900?
The normal procedure in QT is
>Use tr() around strings to translate while coding.
>Run lupdate to get ts file
>Open the ts file in linguist and type in the translation strings.
>Run lrealease to get qm file.
>Copy qm file to target + install fonts.
>Run the app and set the translator in the app.

This is the generic QT way of doing it - don't know if it is different in maemo.

abuelmagd
2010-10-23, 17:45
I'm having the same issue as mohannad. I am certain the N900 already has at least one arabic font installed. I know that because the arabic websites display properly. Is there a way for me to see which fonts are available by default on the n900?

Thanks

abuelmagd
2010-10-23, 18:39
I resolved my issue by figuring out which fonts are pre-installed:
Akhbar MT OTS:style=Regular
Univers OTS Arabic :style=Regular
Tanseek Pro Arabic:style=Regular

You will just need to set the font parameter of your label or button to one of those fonts (I only installed and tested Akhbar MT on my machine).
The arabic displays properly in the editor mode and in the parameter sections in the GUI side of things but on the form itself I see weird boxes. This is all irrelevant to me because what I care about is that on the N900 everything shows up perfectly.

For those who have a similar problem that is not related to Arabic they can find a list of fonts pre-installed on the N900 in Appendix B of the following document: http://sw.nokia.com/id/ade5f355-88e3-4af1-b6b1-26770246c0ff/Web_Design_Guidelines_for_the_Nokia_N900_v1_0_en.p df

dov
2010-10-23, 19:18
Qt on Maemo appears to make use of fontconfig (just like Gtk) as you can verify by:

ldd /usr/lib/libQtGui.so

Thus you can use the normal fontconfig programs to figure out what fonts you have installed. E.g.

fc-list

You can change the configuration of the default fonts like sans and serif by changing the fontconfig config files, and you should then be able to use arabic in any programs. See:

http://www.fontconfig.org/wiki/

Btw, I tested gtk by running the following program from the command line:

#!/usr/bin/python
# -*- Encoding: utf-8 -*-

import gtk,hildon

w = hildon.Window()
w.add(gtk.Label(u'سلام'))
w.show_all()
gtk.main()

which I ran by doing the following from the xterm:

python saalam.py

and it showed the arabic just fine. But again, that is Gtk and not Qt.