Altair Jones
Altair Jones

Reputation: 914

Qt font OS X and FontBook

I noticed this problem using Qt libraries, but, to be honest, than I found that is a global OS X issue. I have a music font, say the classic Petrucci.ttf or Marl.ttf... As I put characters using QPainter::drawText() function, I can see only standard letters.

Also this happens using asian fonts or other symbolic fonts. The same Qt code compiled on Windows can render the fonts in a correct way. So, for instance, the letter "a" is a note or a pause, or a clef...

In Mac, letter "a" remains an "a".

The strange thing is that if I open the font in the Font Book, the font is rendered correctly. So I also tried to use it on OpenOffice, Pages or TextEdit. Always on Mac symbolic fonts are rendered normally, typed letters remain letters.

Do you have any suggestions??

Thanks...

Upvotes: 3

Views: 253

Answers (1)

Altair Jones
Altair Jones

Reputation: 914

OK, one answer I found is to check the entire font map and grab the unicode value of the range of interest. For example, for the font I'm using is 0xf021-0xf0fb, so, you can draw a non text symbol like this:

char c = 0xf021;
QString str = QString( QChar( c ) ); 
painter.drawText( 10, 10, str );

Upvotes: 1

Related Questions