How to show Unicode characters on MS Windows?
I need to show Unicode characters in a QLabel. This code works fine on Debian, but on Windows I just get a square.
FWIW, the browser does show this character when used in a webpage, and I can copy/paste it in Wordpad, so I guess it's not a font issue.
What am I missing?
Code:
#include <QtGui/QApplication>
#include <QLabel>
int main(int argc, char *argv[])
{
QLabel label
(QChar(10269));
// â (U+281D) is points 1,3,4,5 in Braille label.show();
return app.exec();
}
Re: How to show Unicode characters on MS Windows?
Hi, I think this is font issue, try to install Dejavu Sans and set font using
Code:
label.
setFont(QFont("Dejavu Sans"));
Re: How to show Unicode characters on MS Windows?
Quote:
Originally Posted by
Surendil
Hi, I think this is font issue, try to install Dejavu Sans and set font using
Code:
label.
setFont(QFont("Dejavu Sans"));
Oh, that works!! Thanks! :-)
Should I just add that line as is, or should it only apply to the Windows build?
In the latter case, what would be the correct method to do it?
Re: How to show Unicode characters on MS Windows?
Hmm I think it would be better to apply this only to Windows build (you said in Linux it works well). You may wrap this code with:
Code:
#ifdef Q_OS_WIN32
label.
setFont(QFont("Dejavu Sans"));
#endif
Look at http://doc.qt.io/qt-4.8/QtGlobal for platform preprocessor definitions and don't forget to include Dejavu (or any other font you want use for Braille) into your distribution package for Windows.
Re: How to show Unicode characters on MS Windows?
Thanks for your pointer :)
Quote:
Originally Posted by
Surendil
don't forget to include Dejavu (or any other font you want use for Braille) into your distribution package for Windows.
That must be done in the installer, right?
I just began developing my app, and didn't explore yet the available options (Nullsoft Scriptable Install System, Inno Setup, WiX...).
Re: How to show Unicode characters on MS Windows?
I believe that Windows 7 includes Braille characters in its Segoe UI Symbol font, but that earlier versions do not. So you have some Windows versions that require a third party font, and others that don't :( There are some free fonts containing just the Braille patterns: http://www.alanwood.net/unicode/font...raillepatterns
Re: How to show Unicode characters on MS Windows?
Quote:
Originally Posted by
ChrisW67
I believe that Windows 7 includes Braille characters in its Segoe UI Symbol font, but that earlier versions do not. So you have some Windows versions that require a third party font, and others that don't :(
Thanks for your comment.
DejaVu Sans is actually doing the trick (tested on both Windows 7 and Windows XP).