summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--library/fontdatabase.cpp17
1 files changed, 16 insertions, 1 deletions
diff --git a/library/fontdatabase.cpp b/library/fontdatabase.cpp
index 899d5cf..c7a5211 100644
--- a/library/fontdatabase.cpp
+++ b/library/fontdatabase.cpp
@@ -43,26 +43,26 @@ static QString fontFamily( const QString& key )
int u0 = key.find('_');
int u1 = key.find('_',u0+1);
int u2 = key.find('_',u1+1);
QString family = key.left(u0);
//int pointSize = key.mid(u0+1,u1-u0-1).toInt();
//int weight = key.mid(u1+1,u2-u1-1).toInt();
//bool italic = key.mid(u2-1,1) == "i";
// #### ignores _t and _I fields
return family;
}
#endif
-QValueList<FontFactory> *FontDatabase::factoryList = 0;
+QValueList<FontFactory> *FontDatabase::factoryList = 0;
/*!
\class FontDatabase fontdatabase.h
\brief The FontDatabase class provides information about available fonts.
Most often you will simply want to query the database for the
available font families().
Use FontDatabase rather than QFontDatabase when you may need access
to fonts that are not normally available. For example, if the
freetype library and the Qtopia freetype plugin are installed,
TrueType fonts will be available to your application. Font renderer
plugins have greater resource requirements than system fonts so they
@@ -83,47 +83,53 @@ FontDatabase::FontDatabase()
if ( !factoryList )
loadRenderers();
}
/*!
Returns a list of names of all the available font families.
*/
QStringList FontDatabase::families() const
{
#ifndef QT_NO_FONTDATABASE
return QFontDatabase::families();
#else
+
+#ifndef QWS
+ QStringList list;
+ return list;
+#else
QStringList list;
QDict<void> familyDict;
QDiskFont *qdf;
for ( qdf=qt_fontmanager->diskfonts.first(); qdf!=0;
qdf=qt_fontmanager->diskfonts.next()) {
QString familyname = qdf->name;
if ( !familyDict.find( familyname ) ) {
familyDict.insert( familyname, (void *)1 );
list.append( familyname );
}
}
QDir dir(fontDir(),"*.qpf");
for (int i=0; i<(int)dir.count(); i++) {
QString familyname = fontFamily(dir[i]);
if ( !familyDict.find( familyname ) ) {
familyDict.insert( familyname, (void *)1 );
list.append( familyname );
}
}
return list;
#endif
+#endif
}
#ifdef QT_NO_FONTDATABASE
/*!
Returns a list of standard fontsizes.
*/
QValueList<int> FontDatabase::standardSizes()
{
static int s[]={ 8, 9, 10, 11, 12, 14, 16, 18, 20, 22, 24, 26, 28,
36, 48, 72, 0 };
static bool first = TRUE;
static QValueList<int> sList;
@@ -135,24 +141,28 @@ QValueList<int> FontDatabase::standardSizes()
}
return sList;
}
#endif
/*!
Load any font renderer plugins that are available and make the fonts
that the plugins can read available.
*/
void FontDatabase::loadRenderers()
{
+#ifndef QWS
+ return;
+#else
+
#ifndef QT_NO_COMPONENT
if ( !factoryList )
factoryList = new QValueList<FontFactory>;
QValueList<FontFactory>::Iterator mit;
for ( mit = factoryList->begin(); mit != factoryList->end(); ++mit ) {
qt_fontmanager->factories.setAutoDelete( false );
qt_fontmanager->factories.removeRef( (*mit).factory );
qt_fontmanager->factories.setAutoDelete( true );
(*mit).interface->release();
(*mit).library->unload();
delete (*mit).library;
@@ -174,31 +184,35 @@ void FontDatabase::loadRenderers()
FontFactory factory;
factory.library = lib;
factory.interface = iface;
factory.factory = factory.interface->fontFactory();
factoryList->append( factory );
qt_fontmanager->factories.append( factory.factory );
readFonts( factory.factory );
} else {
delete lib;
}
}
#endif
+#endif
}
/*!
\internal
*/
void FontDatabase::readFonts( QFontFactory *factory )
{
+#ifndef QWS
+return;
+#else
// Load in font definition file
QString fn = fontDir() + "fontdir";
FILE* fontdef=fopen(fn.local8Bit(),"r");
if(!fontdef) {
QCString temp=fn.local8Bit();
qWarning("Cannot find font definition file %s - is $QTDIR set correctly?",
temp.data());
return;
}
char buf[200]="";
char name[200]="";
char render[200]="";
@@ -221,14 +235,15 @@ void FontDatabase::readFonts( QFontFactory *factory )
QDiskFont * qdf=new QDiskFont(factory,name,isitalic[0]=='y',
weight,size,flags,filename);
qt_fontmanager->diskfonts.append(qdf);
#if QT_VERSION >= 232
QFontDatabase::qwsAddDiskFont( qdf );
#endif
}
}
}
fgets(buf,200,fontdef);
}
fclose(fontdef);
+#endif
}