summaryrefslogtreecommitdiff
authorzecke <zecke>2002-11-06 21:46:09 (UTC)
committer zecke <zecke>2002-11-06 21:46:09 (UTC)
commit86a2bf4747f46a9915dffac376b888faa5400ec8 (patch) (unidiff)
tree247946d61e915e1c238ce87a7ee14f014fc6e804
parent7a0e2678368c1cbb036085aaa594801e93e0b1c1 (diff)
downloadopie-86a2bf4747f46a9915dffac376b888faa5400ec8.zip
opie-86a2bf4747f46a9915dffac376b888faa5400ec8.tar.gz
opie-86a2bf4747f46a9915dffac376b888faa5400ec8.tar.bz2
Some ugly ifdefs inside fontdatabase for now :(
This temp. helps the x11 port
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
@@ -47,18 +47,18 @@ static QString fontFamily( const QString& key )
47 //int pointSize = key.mid(u0+1,u1-u0-1).toInt(); 47 //int pointSize = key.mid(u0+1,u1-u0-1).toInt();
48 //int weight = key.mid(u1+1,u2-u1-1).toInt(); 48 //int weight = key.mid(u1+1,u2-u1-1).toInt();
49 //bool italic = key.mid(u2-1,1) == "i"; 49 //bool italic = key.mid(u2-1,1) == "i";
50 // #### ignores _t and _I fields 50 // #### ignores _t and _I fields
51 return family; 51 return family;
52} 52}
53#endif 53#endif
54 54
55QValueList<FontFactory> *FontDatabase::factoryList = 0;
56 55
56QValueList<FontFactory> *FontDatabase::factoryList = 0;
57/*! 57/*!
58 \class FontDatabase fontdatabase.h 58 \class FontDatabase fontdatabase.h
59 \brief The FontDatabase class provides information about available fonts. 59 \brief The FontDatabase class provides information about available fonts.
60 60
61 Most often you will simply want to query the database for the 61 Most often you will simply want to query the database for the
62 available font families(). 62 available font families().
63 63
64 Use FontDatabase rather than QFontDatabase when you may need access 64 Use FontDatabase rather than QFontDatabase when you may need access
@@ -87,16 +87,21 @@ FontDatabase::FontDatabase()
87/*! 87/*!
88 Returns a list of names of all the available font families. 88 Returns a list of names of all the available font families.
89*/ 89*/
90QStringList FontDatabase::families() const 90QStringList FontDatabase::families() const
91{ 91{
92#ifndef QT_NO_FONTDATABASE 92#ifndef QT_NO_FONTDATABASE
93 return QFontDatabase::families(); 93 return QFontDatabase::families();
94#else 94#else
95
96#ifndef QWS
97 QStringList list;
98 return list;
99#else
95 QStringList list; 100 QStringList list;
96 QDict<void> familyDict; 101 QDict<void> familyDict;
97 QDiskFont *qdf; 102 QDiskFont *qdf;
98 for ( qdf=qt_fontmanager->diskfonts.first(); qdf!=0; 103 for ( qdf=qt_fontmanager->diskfonts.first(); qdf!=0;
99 qdf=qt_fontmanager->diskfonts.next()) { 104 qdf=qt_fontmanager->diskfonts.next()) {
100 QString familyname = qdf->name; 105 QString familyname = qdf->name;
101 if ( !familyDict.find( familyname ) ) { 106 if ( !familyDict.find( familyname ) ) {
102 familyDict.insert( familyname, (void *)1 ); 107 familyDict.insert( familyname, (void *)1 );
@@ -110,16 +115,17 @@ QStringList FontDatabase::families() const
110 if ( !familyDict.find( familyname ) ) { 115 if ( !familyDict.find( familyname ) ) {
111 familyDict.insert( familyname, (void *)1 ); 116 familyDict.insert( familyname, (void *)1 );
112 list.append( familyname ); 117 list.append( familyname );
113 } 118 }
114 } 119 }
115 120
116 return list; 121 return list;
117#endif 122#endif
123#endif
118} 124}
119 125
120#ifdef QT_NO_FONTDATABASE 126#ifdef QT_NO_FONTDATABASE
121/*! 127/*!
122 Returns a list of standard fontsizes. 128 Returns a list of standard fontsizes.
123*/ 129*/
124QValueList<int> FontDatabase::standardSizes() 130QValueList<int> FontDatabase::standardSizes()
125{ 131{
@@ -139,16 +145,20 @@ QValueList<int> FontDatabase::standardSizes()
139#endif 145#endif
140 146
141/*! 147/*!
142 Load any font renderer plugins that are available and make the fonts 148 Load any font renderer plugins that are available and make the fonts
143 that the plugins can read available. 149 that the plugins can read available.
144*/ 150*/
145void FontDatabase::loadRenderers() 151void FontDatabase::loadRenderers()
146{ 152{
153#ifndef QWS
154 return;
155#else
156
147#ifndef QT_NO_COMPONENT 157#ifndef QT_NO_COMPONENT
148 if ( !factoryList ) 158 if ( !factoryList )
149 factoryList = new QValueList<FontFactory>; 159 factoryList = new QValueList<FontFactory>;
150 160
151 QValueList<FontFactory>::Iterator mit; 161 QValueList<FontFactory>::Iterator mit;
152 for ( mit = factoryList->begin(); mit != factoryList->end(); ++mit ) { 162 for ( mit = factoryList->begin(); mit != factoryList->end(); ++mit ) {
153 qt_fontmanager->factories.setAutoDelete( false ); 163 qt_fontmanager->factories.setAutoDelete( false );
154 qt_fontmanager->factories.removeRef( (*mit).factory ); 164 qt_fontmanager->factories.removeRef( (*mit).factory );
@@ -178,23 +188,27 @@ void FontDatabase::loadRenderers()
178 factoryList->append( factory ); 188 factoryList->append( factory );
179 qt_fontmanager->factories.append( factory.factory ); 189 qt_fontmanager->factories.append( factory.factory );
180 readFonts( factory.factory ); 190 readFonts( factory.factory );
181 } else { 191 } else {
182 delete lib; 192 delete lib;
183 } 193 }
184 } 194 }
185#endif 195#endif
196#endif
186} 197}
187 198
188/*! 199/*!
189 \internal 200 \internal
190*/ 201*/
191void FontDatabase::readFonts( QFontFactory *factory ) 202void FontDatabase::readFonts( QFontFactory *factory )
192{ 203{
204#ifndef QWS
205return;
206#else
193 // Load in font definition file 207 // Load in font definition file
194 QString fn = fontDir() + "fontdir"; 208 QString fn = fontDir() + "fontdir";
195 FILE* fontdef=fopen(fn.local8Bit(),"r"); 209 FILE* fontdef=fopen(fn.local8Bit(),"r");
196 if(!fontdef) { 210 if(!fontdef) {
197 QCString temp=fn.local8Bit(); 211 QCString temp=fn.local8Bit();
198 qWarning("Cannot find font definition file %s - is $QTDIR set correctly?", 212 qWarning("Cannot find font definition file %s - is $QTDIR set correctly?",
199 temp.data()); 213 temp.data());
200 return; 214 return;
@@ -225,10 +239,11 @@ void FontDatabase::readFonts( QFontFactory *factory )
225 QFontDatabase::qwsAddDiskFont( qdf ); 239 QFontDatabase::qwsAddDiskFont( qdf );
226#endif 240#endif
227 } 241 }
228 } 242 }
229 } 243 }
230 fgets(buf,200,fontdef); 244 fgets(buf,200,fontdef);
231 } 245 }
232 fclose(fontdef); 246 fclose(fontdef);
247#endif
233} 248}
234 249