[Interest] Qt and fixed width/pitch font

Jan Kundrát jkt at flaska.net
Mon Aug 13 21:49:52 CEST 2012


On 08/01/12 17:55, Carl Schumann wrote:
> So I tried QFont::setFixedPitch(true).

The following works for me:

// Ask for a fixed-width font. The problem is that these names wary 
across platforms,
// but the following works well -- at first, we come up with a made-up 
name, and then
// let the Qt font substitution algorithm do its magic.
QFont font(QString::fromAscii("x-trojita-terminus-like-fixed-width"));
font.setStyleHint(QFont::TypeWriter);

With kind regards,
Jan

-- 
Trojita, a fast e-mail client -- http://trojita.flaska.net/




More information about the Interest mailing list