[Qt-interest] QFont::defaultFamily() takes ridiculous share of CPU time, but only on Windows

Philipp Münzel mailing-lists at philippmuenzel.de
Thu Apr 7 20:13:22 CEST 2011


Hey Atlant,

this was a good idea that put me on the right track.
Apparantly, I'm printing some character that the "Inconsolata" font doesn't have. Then defaultFamily() gets called to print this character from another, similar-looking font family.

Apparently, there is complicated stuff going on on Windows to find a matching font. But if I say 
    mono_8.setStyleHint(QFont::TypeWriter);
the matching font is known beforehand.

That speeded up the rendering on Windows incredibly !

I wonder why on Linux Qt was smart enough to guess a Monospace replacement font without me setting the hint.

So thanks for the valueable input.

Regards,
Philipp


On 07.04.2011 15:33 "Atlant Schmidt" <aschmidt at dekaresearch.com> wrote:
> Philipp:
> 
> > How and why gets QFont::defaultFamily() called
> > in the scenario described above?
> 
>   Perhaps your Linux machine has the "Inconsolata" font
>   and your Windows machine doesn't, so Qt spends a lot
>   of time deciding which fall-back font to use?
> 
>                           


More information about the Qt-interest-old mailing list