Qt-interest Archive, October 2001
Re: Fixed width fonts in Qt3
Message 1 in thread
Hi,
After a little bit of investigation, I found that
QFontDatabase::isFixedPitch() always returns false even in Qt-2.3.1 (not just
Qt3). However, QFontInfo::fixedPitch() returns the right value in Qt-2.3.1
but not in Qt3. I guess the Qt code has changed; I will try to delve into it
later this week.
Ravi
PS: My test program:
#include <qapplication.h>
#include <qfont.h>
#include <qfontinfo.h>
#include <qfontdatabase.h>
#include <qlabel.h>
int main(int argc, char* argv[])
{
QApplication app( argc, argv );
QFontDatabase fdb;
QStringList families = fdb.families();
for ( QStringList::Iterator f = families.begin(); f != families.end();
++f ) {
QString family = *f;
//qDebug( family );
QStringList styles = fdb.styles( family );
for ( QStringList::Iterator s = styles.begin(); s != styles.end();
++s ) {
QString style = *s;
QFontInfo info(fdb.font(family,style,10));
//if (fdb.isFixedPitch(family,style))
if (info.fixedPitch())
{qDebug( family );
QString dstyle = "\t" + style + " (";
QValueList<int> smoothies = fdb.smoothSizes( family, style );
for ( QValueList<int>::Iterator points = smoothies.begin();
points != smoothies.end(); ++points ) {
dstyle += QString::number( *points ) + " ";
}
dstyle = dstyle.left( dstyle.length() - 1 ) + ")";
qDebug( dstyle );
} // FP
}
}
return 0;
}
On Friday 28 September 2001 19:19, Ravikiran Rajagopal wrote:
> Hello,
> QFontDatabase::isFixedPitch() always returns false regardless of the font
> supplied. I am using Qt 3 beta 5 on an updated RH7.1 system. I looked at
> the code in QFontDatabase.cpp and could not find the place where this
> attribute in QtFontFamily is set, except in the constructor where it is set
> to FALSE. I tested this with a small application (ripped from the
> QFontDatabase documentation) and found that the isFixedPitch() always
> returns false. The same occurs with or without Xft. I do have "Lucida
> Console" and "Courier New" fonts both of which are definitely fixed pitch
> fonts, and I can see them in QFontDialog. The program that failed to find
> fixed pitch fonts:
> ---------------------------------------------------------------------------
> #include <qapplication.h>
> #include <qfont.h>
> #include <qfontdatabase.h>
> #include <qlabel.h>
>
> int main(int argc, char* argv[])
> {
> QApplication app( argc, argv );
> QFontDatabase fdb;
> QStringList families = fdb.families();
> for ( QStringList::Iterator f = families.begin(); f != families.end();
> ++f ) {
> QString family = *f;
> //qDebug( family );
> QStringList styles = fdb.styles( family );
> for ( QStringList::Iterator s = styles.begin(); s != styles.end();
> ++s ) {
> QString style = *s;
> if (fdb.isFixedPitch(family,style))
> {qDebug( family );
> QString dstyle = "\t" + style + " (";
> QValueList<int> smoothies = fdb.smoothSizes( family, style );
> for ( QValueList<int>::Iterator points = smoothies.begin();
> points != smoothies.end(); ++points ) {
> dstyle += QString::number( *points ) + " ";
> }
> dstyle = dstyle.left( dstyle.length() - 1 ) + ")";
> qDebug( dstyle );
> } // FP
> }
> }
> return 0;
> }
> ---------------------------------------------------------------------------
> On a related note, the program above always ends with:
> Mutex destroy failure: Device or resource busy
>
> Any ideas where the font problem lies?
>
> Ravi
Message 2 in thread
On Tuesday 02 October 2001 00:10, you wrote:
> Hi,
> After a little bit of investigation, I found that
> QFontDatabase::isFixedPitch() always returns false even in Qt-2.3.1 (not
> just Qt3). However, QFontInfo::fixedPitch() returns the right value in
> Qt-2.3.1 but not in Qt3. I guess the Qt code has changed; I will try to
> delve into it later this week.
>
> Ravi
>
> PS: My test program:
>
> #include <qapplication.h>
> #include <qfont.h>
> #include <qfontinfo.h>
> #include <qfontdatabase.h>
> #include <qlabel.h>
>
> int main(int argc, char* argv[])
> {
> QApplication app( argc, argv );
> QFontDatabase fdb;
> QStringList families = fdb.families();
> for ( QStringList::Iterator f = families.begin(); f != families.end();
> ++f ) {
> QString family = *f;
> //qDebug( family );
> QStringList styles = fdb.styles( family );
> for ( QStringList::Iterator s = styles.begin(); s != styles.end();
> ++s ) {
> QString style = *s;
> QFontInfo info(fdb.font(family,style,10));
> //if (fdb.isFixedPitch(family,style))
> if (info.fixedPitch())
> {qDebug( family );
> QString dstyle = "\t" + style + " (";
> QValueList<int> smoothies = fdb.smoothSizes( family, style );
> for ( QValueList<int>::Iterator points = smoothies.begin();
> points != smoothies.end(); ++points ) {
> dstyle += QString::number( *points ) + " ";
> }
> dstyle = dstyle.left( dstyle.length() - 1 ) + ")";
> qDebug( dstyle );
> } // FP
> }
> }
> return 0;
> }
>
I tested with the code above using Qt 2.3.0 and Qt 3b6 using the fontdatabase
to tell what is fixed pitch (using fdb.isFixedPitch(family,style) ) and to me
Qt 3b6 seems to do a better job than what it did before. It does return true
for the fonts it should here.
I have attached the output of what I got on a stock SuSE 7 system
--
[ signature omitted ]
Clean
Normal (6 8 10 12 13 14 15 16)
Clean
Italic (8 12)
Clean
Bold (8 10 12 13 14 15 16)
Console
Normal (8 12 15)
Courier [Adobe]
Normal (8 9 10 11 12 14 16 18 20 22 24 26 28 36 48 72)
Courier [Adobe]
Italic (8 9 10 11 12 14 16 18 20 22 24 26 28 36 48 72)
Courier [Adobe]
Oblique (8 10 11 12 13 14 16 18 19 24 32)
Courier [Adobe]
Bold (8 9 10 11 12 14 16 18 20 22 24 26 28 36 48 72)
Courier [Adobe]
Bold Italic (8 9 10 11 12 14 16 18 20 22 24 26 28 36 48 72)
Courier [Adobe]
Bold Oblique (8 10 11 12 13 14 16 18 19 24 32)
Courier [Bitstream]
Normal (8 9 10 11 12 14 16 18 20 22 24 26 28 36 48 72)
Courier [Bitstream]
Italic (8 9 10 11 12 14 16 18 20 22 24 26 28 36 48 72)
Courier [Bitstream]
Bold (8 9 10 11 12 14 16 18 20 22 24 26 28 36 48 72)
Courier [Bitstream]
Bold Italic (8 9 10 11 12 14 16 18 20 22 24 26 28 36 48 72)
Courier [Cronyx]
Normal (12 13 16 19)
Courier [Cronyx]
Oblique (12 13 16 19)
Courier [Cronyx]
Bold (12 13 16 19)
Courier [Cronyx]
Bold Oblique (12 13 16 19)
Ethiomx16f
Normal (12 20 29)
Fangsong Ti
Normal (12 15)
Fixed [Adobe&cbs&yasuoka]
Normal (12 39)
Fixed [Cronyx]
Normal (10 12 14 20 23)
Fixed [Cronyx]
Bold (12 16)
Fixed [Eten]
Normal (12 15 23)
Fixed [Etl]
Normal (12 13 15 23 38)
Fixed [Etl]
Italic (12 15)
Fixed [Etl]
Bold (12 15)
Fixed [Etl]
Bold Italic (12 15)
Fixed [Hku]
Normal (12 15)
Fixed [Jis]
Normal (12 15 23)
Fixed [Misc]
Normal (7 8 9 10 11 12 13 14 15 16 17 18 19 20 23)
Fixed [Misc]
Bold (12 13 14 16)
Fixed [Sony]
Normal (12 15 16 23)
Fixed [Tibmdxa]
Normal (12 15 23)
Fixed [Watanabe]
Normal (12 30 45)
Gothic [Daewoo]
Normal (12 16)
Gothic [Jis]
Normal (12 17)
Ledfixed
Normal (12)
Lucidatypewriter
Normal (8 10 11 12 13 14 16 18 19 24 25 32)
Lucidatypewriter
Bold (8 10 11 12 13 14 16 18 19 24 25 32)
Lucidux Mono
Normal (8 9 10 11 12 14 16 18 20 22 24 26 28 36 48 72)
Lucidux Mono
Oblique (8 9 10 11 12 14 16 18 20 22 24 26 28 36 48 72)
Mincho
Normal (12 16 23)
Nil [Cronyx]
Normal (2 12)
Nil [Misc]
Normal (2 12)
Song Ti
Normal (12 15 23)
Song [Cbs]
Normal (12 24 40)
Song [Cc]
Normal (12 40 48)
Song [Guobiao]
Normal (12 15)
Terminal [Bitstream]
Normal (12 19)
Terminal [Bitstream]
Bold (12 19)
Terminal [Dec]
Normal (12 14)
Terminal [Dec]
Bold (12 14)
Unifont
Normal (12 16)
Videotext
Normal (11 12 17 23 34 46)
adobe-courier
Normal (8 10 12 14 18 24)
adobe-courier
Oblique (8 10 12 14 18 24)
adobe-courier
Bold (8 10 12 14 18 24)
adobe-courier
Bold Oblique (8 10 12 14 18 24)
bitstream-terminal
Normal (14)
bitstream-terminal
Bold (14)
console
Normal (8 16)
dec-terminal
Normal (14)
dec-terminal
Bold (14)
lucidatypewriter
Normal (8 10 12 14 18 19 24)
lucidatypewriter
Bold (8 10 12 14 18 19 24)
misc-fixed
Normal (7 8 9 10 11 12 13 14 20)
misc-fixed
Bold (12 13 14)
unifont
Normal (16)
Message 3 in thread
On Wednesday 03 October 2001 04:19, Espen Sand wrote:
[snip]
> I tested with the code above using Qt 2.3.0 and Qt 3b6 using the
> fontdatabase to tell what is fixed pitch (using
> fdb.isFixedPitch(family,style) ) and to me Qt 3b6 seems to do a better job
> than what it did before. It does return true for the fonts it should here.
>
> I have attached the output of what I got on a stock SuSE 7 system
Did you try this with Xft enabled?
Ravi