PDA

View Full Version : Font in simulator and S60 device don't look the same



Erazem
20th August 2010, 14:22
Hi everyone,

I have an issue which I am not able to overcome. It's about fonts in Qt simulator and S60 device.

What I'm doing is drawing a text on a QPainter with drawText method. I set fonts with setFont method and I specify Series 60 Sans font. The code looks something like this:


void MyElement::paint( QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget ) {
painter->setFont( QFont( "Series 60 Sans", 36, QFont::Bold ) );
painter->drawText( 0,0, "Dear John" );
}

The thing is that what I see in Qt Simulator is completely different than what I see on device. What I can notice is that fonts have completely different sizes, different ascend, descend ...

I assume fonts are not the same, at least I am leaning in that direction.
I'm using N96 mini to test on S60 device with fonts installed on it,
and I installed fonts on my PC, font version on PC is: Series 60 Sans Regular (TrueType). version 4.04, Monotype.

Is this behavior normal or at least expectable? Or what am I doing wrong?
If fonts are incorrect, where can I get correct ones? I tried S60 SDKs nothing helps. And if it is important, I'm using Windows XP SP2 and Nokia Qt SDK 1.0.

Any help would be appritiated, otherwise it's time to visit mental institution.

cloaked_and_coastin
20th August 2010, 15:26
As far as the size and shape of fonts (what characters look like on desktop vs target), I've noticed that it helps to set the QWS_DISPLAY variable. Now with that said, I'm not familiar with the S60 environment. I run on an embedded linux platform and we have a run script that exports serveral Qt variables, before we "call" the executable. This is how we set the QWS_DISPLAY variable:

export QWS_DISPLAY="LinuxFb:/dev/fb4:mmWidth=95:mmHeight=53.8"

the mmWidth and mmHeight variables are what makes the difference for us. If you look in the vendor's documentation of your display, they may give you the PHYSICAL dimensions and the ACTIVE dimensions. Try the ACTIVE dimensions. Hope this helps.

Erazem
20th August 2010, 20:57
After hiting the wall with my head, for few hours, constantly...

I read some other posts and I found next one:
http://www.qtcentre.org/threads/26993-font-size-difference-in-embedded-QT

To summarize, it seems that point size on PC and pixel size of QFont on S60 are in 4:3 ratio.
Modifying fonts in example below solves the problem:


QFont font( "Series 60 Sans", 36, QFont::Normal );
font.setPixelSize( font.pointSize()*4/3 );

Thank you plambert