Unicode has plenty of symbols in addition to the ordinary ASCII. I've been browsing thru them at http://www.iam.uni-bonn.de/~alt/html/unicode_3.html and would like to use some in my Qt programs.

Qt Code:
  1. #include <QApplication>
  2. #include <QFont>
  3. #include <QFontInfo>
  4. #include <QLabel>
  5.  
  6. int main( int argc, char **argv )
  7. {
  8. QApplication app( argc, argv );
  9.  
  10. QFont f = app.font();
  11. QFontInfo fi(f);
  12. QLabel *lab = new QLabel;
  13. QChar sym1(0xba, 0x25); // filled rightpointing triangle http://www.iam.uni-bonn.de/~alt/html/unicode_63.html
  14. QChar sym2(0x00, 0x22); // upside-down "A" http://www.iam.uni-bonn.de/~alt/html/unicode_56.html
  15.  
  16. QFontMetrics fm(f);
  17.  
  18. QString txt = "QFont: " + f.toString() + "\n" +
  19. "QFontInfo: " + fi.family() + " " + QString::number(fi.pointSize()) + "\n" +
  20. "Substitute list: " + QFont::substitutions().join(", ") +
  21. "\n\nNext" + sym1 + sym2 +
  22. " widths:" + QString::number(fm.width(sym1)) +
  23. " " + QString::number(fm.width(sym2));
  24. lab->setText(txt);
  25. lab->show();
  26.  
  27. return app.exec();
  28. }
To copy to clipboard, switch view to plain text mode 

The above program shows the default font and the font actually used. After the word "Next" is inserted two symbols (a filled triangle and and upside-down "A"). This works fine when run on my Ubuntu 8.10 system.

A friend though, tested the same program on Debian Lenny, and there the two special characters were not shown.

Using qtconfig-qt4, we have both set the default font to "DejaVu Sans 9", and that is displayed on the first line when we run the program.
The QFontInfo object differs though: it displays the same "DejaVu Sans 9" font on the machine where the symbols shows correctly, but becomes "Bitstream Charter 9" on the other.

I don't think the problem is that the bitstream font lacks the special characters as I tried with that font as the default on my machine and the special symbols still shows.

My questions are:
1) Why does the QFontInfo-object on the Debian Lenny-machine pick another font, when DejaVu Sans is installed (i.e. it was available from the dropdown-menu in qtconfig-qt4 and he has the same files under /usr/share/fonts/truetype/ttf-dejavu as I have)
2) Why doesn't the symbols show up on the Debian Lenny machine (There are no problems inserting such symbols in an openoffice-document).

The "width" of the invisible symbols, as displayed by the program above, is non-zero. The substitute-lists are the same.