[Solved] Fonts in Qt
-
Hello -
I am trying to change the font of a QTextEdit to Courier. When I try setting it to Helvetica, it works. But when I set it to Courier, MS Shell Dlg 2, Utopia, DejaVuSansMono, etc the font looks the same for all.
The following are the fonts being built into the application per lib/fonts:
c0419bt_.pfb cursor.pfa DejaVuSerif.ttf helvetica_140_50.qpf helvetica_80_50.qpf l049013t.pfa VeraBI.ttf
c0582bt_.pfb DejaVuSans-BoldOblique.ttf fixed_120_50.qpf helvetica_140_75i.qpf helvetica_80_75i.qpf l049016t.pfa VeraIt.ttf
c0583bt_.pfb DejaVuSans-Bold.ttf fixed_70_50.qpf helvetica_140_75.qpf helvetica_80_75.qpf l049033t.pfa VeraMoBd.ttf
c0611bt_.pfb DejaVuSansMono-BoldOblique.ttf helvetica_100_50i.qpf helvetica_180_50i.qpf japanese_230_50.qpf l049036t.pfa VeraMoBI.ttf
c0632bt_.pfb DejaVuSansMono-Bold.ttf helvetica_100_50.qpf helvetica_180_50.qpf l047013t.pfa micro_40_50.qpf VeraMoIt.ttf
c0633bt_.pfb DejaVuSansMono-Oblique.ttf helvetica_100_75i.qpf helvetica_180_75i.qpf l047016t.pfa README VeraMono.ttf
c0648bt_.pfb DejaVuSansMono.ttf helvetica_100_75.qpf helvetica_180_75.qpf l047033t.pfa unifont_160_50.qpf VeraSeBd.ttf
c0649bt_.pfb DejaVuSans-Oblique.ttf helvetica_120_50i.qpf helvetica_240_50i.qpf l047036t.pfa UTBI____.pfa VeraSe.ttf
courbi.pfa DejaVuSans.ttf helvetica_120_50.qpf helvetica_240_50.qpf l048013t.pfa UTB_____.pfa Vera.ttf
courb.pfa DejaVuSerif-BoldOblique.ttf helvetica_120_75i.qpf helvetica_240_75i.qpf l048016t.pfa UTI_____.pfa
couri.pfa DejaVuSerif-Bold.ttf helvetica_120_75.qpf helvetica_240_75.qpf l048033t.pfa UTRG____.pfa
cour.pfa DejaVuSerif-Oblique.ttf helvetica_140_50i.qpf helvetica_80_50i.qpf l048036t.pfa VeraBd.ttfcour.pfa is the font for Courier, yet when I set the font to anything besides Helvetica, the font looks the same. Has anyone run into this before or does anyone have any idea what is going on? I'm at a loss.
Thanks,
Katelyn -
I think you "have to read this :":http://doc.qt.nokia.com/4.7/qwidget.html#font-prop
Especially this paragraph :
bq. The current style, which is used to render the content of all standard Qt widgets, is free to choose to use the widget font, or in some cases, to ignore it (partially, or completely). In particular, certain styles like GTK style, Mac style, Windows XP, and Vista style, apply special modifications to the widget font to match the platform's native look and feel. Because of this, assigning properties to a widget's font is not guaranteed to change the appearance of the widget. Instead, you may choose to apply a styleSheet.
Also the "QFont docs":http://developer.qt.nokia.com/doc/qt-4.7/qfont.html will explain this behaviour.
In short : Qt tries to solve font issues for you that are not set by your theme/OS.