[Qt-interest] QFont - Sans Serif and Monospace for all Plattforms

Kluger, Peter Peter.Kluger at SIMPACK.de
Tue Oct 11 17:32:47 CEST 2011


 Hi,

 monospace seems to be a valid font in linux, nor sure if for every distribution,
But at least OpenSUSE, RHEL and Ubuntu.

Microsoft usually has at least 2 default "monospace" fonts: Lucida Console and Consolas,
both Sans Serif.

I would have like to avoid an ifdef which is what i do now using setFamily("Lucida Console") for
Windows and setFamily("Monospace") for UNIX, but was hoping i could tell QFont i wanted
A fixed pitch sized and sans serif font which is automatically tries to match it
Respective to the OS.



-----Original Message-----
From: suzuki toshiya [mailto:mpsuzuki at hiroshima-u.ac.jp]
Sent: Tuesday, October 11, 2011 5:09 PM
To: Kluger, Peter
Cc: qt-interest at qt.nokia.com
Subject: Re: [Qt-interest] QFont - Sans Serif and Monospace for all Plattforms

Hi,

Please let me ask a stupid question, Microsoft Windows bundles some monospaced San Serif fonts? If there is no, which feature (sans serif or monospace) should be prioritized?

I think, why "Monospace" works on Linux is, umm, an occasion.
In the fontconfig configuration file, there is a list of monospaced fonts available on GNU/Linux, like,

<!--
  Monospace faces
 -->
        <alias>
                <family>Bitstream Vera Sans Mono</family>
                <family>DejaVu Sans Mono</family>
                <family>Courier</family>
                <family>Courier New</family>
                <family>Andale Mono</family>
                <family>Luxi Mono</family>
                <family>Cumberland AMT</family>
                <family>Nimbus Mono L</family>
                <family>NSimSun</family>
                <family>FreeMono</family>
                <default><family>monospace</family></default>
        </alias>
You can find that this list includes Serif fonts, like, Courier, Nimbus Mono L, NSimSun (oops! not free font!). Thus, on GNU/Linux without Vera Sans Mono nor DejaVu Sans Mono, "Monospace" magic won't work either.

Regards,
mpsuzuki

Kluger, Peter wrote:
> Hi all,
>
>  i have a question regarding Fonts, is there any sophisticated way to
> ensure Qt uses a Monospace/Sans Serif Font for all Plattforms (especially Windows and Unix).
> It seems like QFont::setFamily("Monospace") does the magic for Linux
> but its Still with Serif for Windows.
>
> Couldn't find anything in the documentation, hope someone here can help.
>
> Thanks in advance,
>  Peter
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at qt.nokia.com
> http://lists.qt.nokia.com/mailman/listinfo/qt-interest



More information about the Qt-interest-old mailing list