fix tricky regression noticed by Vyacheslav Tokarev on Google Reader.
[kdelibs.git] / khtml / test_regression_fontoverload.cpp
blob0e6b5253d6ef72261d294d846aae0a9da5539d2e
1 /**
2 * This file is part of the KDE project
4 * Copyright (C) 2003 Stephan Kulow (coolo@kde.org)
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Library General Public License for more details.
16 * You should have received a copy of the GNU Library General Public License
17 * along with this library; see the file COPYING.LIB. If not, write to
18 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19 * Boston, MA 02110-1301, USA.
23 #include "ecma/kjs_proxy.h"
25 #define QT_NO_FONTCONFIG 1
26 #define QT_NO_FREETYPE 1
27 #include <private/qfontengine_p.h>
28 #ifdef Q_WS_X11
29 # include <private/qfontengine_x11_p.h>
30 #endif
31 #include <QtGui/QFontDatabase>
32 #include <QtGui/QFont>
33 #include "khtml_settings.h"
34 #include <QtGui/QImage>
35 #include <assert.h>
36 #include <QtGui/QX11Info>
37 #include <QtGui/QPainter>
38 #include <fixx11h.h>
39 #include <QtGlobal>
41 #if QT_VERSION >= 0x040500
42 #define QT_45
43 #endif
45 struct MetricsInfo {
46 const char* name;
47 int ascent;
48 int descent;
49 int leading;
53 typedef QFixed QtFontDim;
55 static int dimToInt(QtFontDim dim) {
56 return dim.toInt();
60 static MetricsInfo compatMetrics[] = {
61 {"-Adobe-Courier-Medium-R-Normal--10-100-75-75-M-60-ISO10646-1", 8, 1, 2},
62 {"-Adobe-Courier-Medium-O-Normal--10-100-75-75-M-60-ISO10646-1", 8, 1, 2},
63 {"-Adobe-Courier-Bold-R-Normal--10-100-75-75-M-60-ISO10646-1", 8, 1, 2},
64 {"-Adobe-Courier-Bold-O-Normal--10-100-75-75-M-60-ISO10646-1", 8, 1, 2},
65 {"-Adobe-Courier-Medium-R-Normal--12-120-75-75-M-70-ISO10646-1", 10, 2, 2},
66 {"-Adobe-Courier-Medium-O-Normal--12-120-75-75-M-70-ISO10646-1", 10, 2, 2},
67 {"-Adobe-Courier-Bold-R-Normal--12-120-75-75-M-70-ISO10646-1", 10, 2, 2},
68 {"-Adobe-Courier-Bold-O-Normal--12-120-75-75-M-70-ISO10646-1", 10, 2, 2},
69 {"-Adobe-Courier-Medium-R-Normal--18-180-75-75-M-110-ISO10646-1", 14, 3, 3},
70 {"-Adobe-Courier-Medium-O-Normal--18-180-75-75-M-110-ISO10646-1", 14, 3, 3},
71 {"-Adobe-Courier-Bold-R-Normal--18-180-75-75-M-110-ISO10646-1", 14, 3, 3},
72 {"-Adobe-Courier-Bold-O-Normal--18-180-75-75-M-110-ISO10646-1", 14, 3, 3},
73 {"-Adobe-Courier-Medium-R-Normal--24-240-75-75-M-150-ISO10646-1", 19, 4, 4},
74 {"-Adobe-Courier-Medium-O-Normal--24-240-75-75-M-150-ISO10646-1", 19, 4, 4},
75 {"-Adobe-Courier-Bold-R-Normal--24-240-75-75-M-150-ISO10646-1", 19, 4, 4},
76 {"-Adobe-Courier-Bold-O-Normal--24-240-75-75-M-150-ISO10646-1", 19, 4, 4},
77 {"-Adobe-Times-Medium-R-Normal--8-80-75-75-P-44-ISO10646-1", 7, 1, 1},
78 {"-Adobe-Times-Medium-R-Normal--8-80-75-75-P-44-ISO10646-1", 7, 1, 1},
79 {"-Adobe-Times-Medium-R-Normal--8-80-75-75-P-44-ISO10646-1", 7, 1, 1},
80 {"-Adobe-Times-Medium-R-Normal--8-80-75-75-P-44-ISO10646-1", 7, 1, 1},
81 {"-Adobe-Times-Medium-R-Normal--8-80-75-75-P-44-ISO10646-1", 7, 1, 1},
82 {"-Adobe-Times-Medium-R-Normal--8-80-75-75-P-44-ISO10646-1", 7, 1, 1},
83 {"-Adobe-Times-Medium-R-Normal--8-80-75-75-P-44-ISO10646-1", 7, 1, 1},
84 {"-Adobe-Times-Medium-R-Normal--8-80-75-75-P-44-ISO10646-1", 7, 1, 1},
85 {"-Adobe-Times-Medium-R-Normal--8-80-75-75-P-44-ISO10646-1", 7, 1, 1},
86 {"-Adobe-Times-Medium-R-Normal--8-80-75-75-P-44-ISO10646-1", 7, 1, 1},
87 {"-Adobe-Times-Medium-R-Normal--8-80-75-75-P-44-ISO10646-1", 7, 1, 1},
88 {"-Adobe-Times-Medium-R-Normal--8-80-75-75-P-44-ISO10646-1", 7, 1, 1},
89 {"-Adobe-Times-Medium-R-Normal--8-80-75-75-P-44-ISO10646-1", 7, 1, 1},
90 {"-Adobe-Times-Medium-R-Normal--8-80-75-75-P-44-ISO10646-1", 7, 1, 1},
91 {"-Adobe-Times-Medium-R-Normal--8-80-75-75-P-44-ISO10646-1", 7, 1, 1},
92 {"-Adobe-Times-Medium-R-Normal--8-80-75-75-P-44-ISO10646-1", 7, 1, 1},
93 {"-Adobe-Helvetica-Medium-R-Normal--10-100-75-75-P-56-ISO10646-1", 10, 1, 2},
94 {"-Adobe-Helvetica-Medium-O-Normal--10-100-75-75-P-57-ISO10646-1", 10, 1, 2},
95 {"-Adobe-Helvetica-Bold-R-Normal--10-100-75-75-P-60-ISO10646-1", 10, 1, 2},
96 {"-Adobe-Helvetica-Bold-O-Normal--10-100-75-75-P-60-ISO10646-1", 10, 1, 2},
97 {"-Adobe-Helvetica-Medium-R-Normal--12-120-75-75-P-67-ISO10646-1", 11, 2, 2},
98 {"-Adobe-Helvetica-Medium-O-Normal--12-120-75-75-P-67-ISO10646-1", 11, 2, 2},
99 {"-Adobe-Helvetica-Bold-R-Normal--12-120-75-75-P-70-ISO10646-1", 11, 2, 2},
100 {"-Adobe-Helvetica-Bold-O-Normal--12-120-75-75-P-69-ISO10646-1", 11, 2, 2},
101 {"-Adobe-Helvetica-Medium-R-Normal--18-180-75-75-P-98-ISO10646-1", 16, 4, 3},
102 {"-Adobe-Helvetica-Medium-O-Normal--18-180-75-75-P-98-ISO10646-1", 16, 4, 3},
103 {"-Adobe-Helvetica-Bold-R-Normal--18-180-75-75-P-103-ISO10646-1", 16, 4, 3},
104 {"-Adobe-Helvetica-Bold-O-Normal--18-180-75-75-P-104-ISO10646-1", 16, 4, 3},
105 {"-Adobe-Helvetica-Medium-R-Normal--24-240-75-75-P-130-ISO10646-1", 22, 4, 4},
106 {"-Adobe-Helvetica-Medium-O-Normal--24-240-75-75-P-130-ISO10646-1", 22, 4, 4},
107 {"-Adobe-Helvetica-Bold-R-Normal--24-240-75-75-P-138-ISO10646-1", 22, 4, 4},
108 {"-Adobe-Helvetica-Bold-O-Normal--24-240-75-75-P-138-ISO10646-1", 22, 4, 4},
109 {"-Adobe-Courier-Medium-R-Normal--10-100-75-75-M-60-ISO10646-1", 8, 1, 2},
110 {"-Adobe-Courier-Medium-O-Normal--10-100-75-75-M-60-ISO10646-1", 8, 1, 2},
111 {"-Adobe-Courier-Bold-R-Normal--10-100-75-75-M-60-ISO10646-1", 8, 1, 2},
112 {"-Adobe-Courier-Bold-O-Normal--10-100-75-75-M-60-ISO10646-1", 8, 1, 2},
113 {"-Adobe-Courier-Medium-R-Normal--12-120-75-75-M-70-ISO10646-1", 10, 2, 2},
114 {"-Adobe-Courier-Medium-O-Normal--12-120-75-75-M-70-ISO10646-1", 10, 2, 2},
115 {"-Adobe-Courier-Bold-R-Normal--12-120-75-75-M-70-ISO10646-1", 10, 2, 2},
116 {"-Adobe-Courier-Bold-O-Normal--12-120-75-75-M-70-ISO10646-1", 10, 2, 2},
117 {"-Adobe-Courier-Medium-R-Normal--18-180-75-75-M-110-ISO10646-1", 14, 3, 3},
118 {"-Adobe-Courier-Medium-O-Normal--18-180-75-75-M-110-ISO10646-1", 14, 3, 3},
119 {"-Adobe-Courier-Bold-R-Normal--18-180-75-75-M-110-ISO10646-1", 14, 3, 3},
120 {"-Adobe-Courier-Bold-O-Normal--18-180-75-75-M-110-ISO10646-1", 14, 3, 3},
121 {"-Adobe-Courier-Medium-R-Normal--24-240-75-75-M-150-ISO10646-1", 19, 4, 4},
122 {"-Adobe-Courier-Medium-O-Normal--24-240-75-75-M-150-ISO10646-1", 19, 4, 4},
123 {"-Adobe-Courier-Bold-R-Normal--24-240-75-75-M-150-ISO10646-1", 19, 4, 4},
124 {"-Adobe-Courier-Bold-O-Normal--24-240-75-75-M-150-ISO10646-1", 19, 4, 4},
125 {"-Adobe-Times-Medium-R-Normal--8-80-75-75-P-44-ISO10646-1", 7, 1, 1},
126 {"-Adobe-Times-Medium-R-Normal--8-80-75-75-P-44-ISO10646-1", 7, 1, 1},
127 {"-Adobe-Times-Medium-R-Normal--8-80-75-75-P-44-ISO10646-1", 7, 1, 1},
128 {"-Adobe-Times-Medium-R-Normal--8-80-75-75-P-44-ISO10646-1", 7, 1, 1},
129 {"-Adobe-Times-Medium-R-Normal--8-80-75-75-P-44-ISO10646-1", 7, 1, 1},
130 {"-Adobe-Times-Medium-R-Normal--8-80-75-75-P-44-ISO10646-1", 7, 1, 1},
131 {"-Adobe-Times-Medium-R-Normal--8-80-75-75-P-44-ISO10646-1", 7, 1, 1},
132 {"-Adobe-Times-Medium-R-Normal--8-80-75-75-P-44-ISO10646-1", 7, 1, 1},
133 {"-Adobe-Times-Medium-R-Normal--8-80-75-75-P-44-ISO10646-1", 7, 1, 1},
134 {"-Adobe-Times-Medium-R-Normal--8-80-75-75-P-44-ISO10646-1", 7, 1, 1},
135 {"-Adobe-Times-Medium-R-Normal--8-80-75-75-P-44-ISO10646-1", 7, 1, 1},
136 {"-Adobe-Times-Medium-R-Normal--8-80-75-75-P-44-ISO10646-1", 7, 1, 1},
137 {"-Adobe-Times-Medium-R-Normal--8-80-75-75-P-44-ISO10646-1", 7, 1, 1},
138 {"-Adobe-Times-Medium-R-Normal--8-80-75-75-P-44-ISO10646-1", 7, 1, 1},
139 {"-Adobe-Times-Medium-R-Normal--8-80-75-75-P-44-ISO10646-1", 7, 1, 1},
140 {"-Adobe-Times-Medium-R-Normal--8-80-75-75-P-44-ISO10646-1", 7, 1, 1},
141 {"-Adobe-Helvetica-Medium-R-Normal--10-100-75-75-P-56-ISO10646-1", 10, 1, 2},
142 {"-Adobe-Helvetica-Medium-O-Normal--10-100-75-75-P-57-ISO10646-1", 10, 1, 2},
143 {"-Adobe-Helvetica-Bold-R-Normal--10-100-75-75-P-60-ISO10646-1", 10, 1, 2},
144 {"-Adobe-Helvetica-Bold-O-Normal--10-100-75-75-P-60-ISO10646-1", 10, 1, 2},
145 {"-Adobe-Helvetica-Medium-R-Normal--12-120-75-75-P-67-ISO10646-1", 11, 2, 2},
146 {"-Adobe-Helvetica-Medium-O-Normal--12-120-75-75-P-67-ISO10646-1", 11, 2, 2},
147 {"-Adobe-Helvetica-Bold-R-Normal--12-120-75-75-P-70-ISO10646-1", 11, 2, 2},
148 {"-Adobe-Helvetica-Bold-O-Normal--12-120-75-75-P-69-ISO10646-1", 11, 2, 2},
149 {"-Adobe-Helvetica-Medium-R-Normal--18-180-75-75-P-98-ISO10646-1", 16, 4, 3},
150 {"-Adobe-Helvetica-Medium-O-Normal--18-180-75-75-P-98-ISO10646-1", 16, 4, 3},
151 {"-Adobe-Helvetica-Bold-R-Normal--18-180-75-75-P-103-ISO10646-1", 16, 4, 3},
152 {"-Adobe-Helvetica-Bold-O-Normal--18-180-75-75-P-104-ISO10646-1", 16, 4, 3},
153 {"-Adobe-Helvetica-Medium-R-Normal--24-240-75-75-P-130-ISO10646-1", 22, 4, 4},
154 {"-Adobe-Helvetica-Medium-O-Normal--24-240-75-75-P-130-ISO10646-1", 22, 4, 4},
155 {"-Adobe-Helvetica-Bold-R-Normal--24-240-75-75-P-138-ISO10646-1", 22, 4, 4},
156 {"-Adobe-Helvetica-Bold-O-Normal--24-240-75-75-P-138-ISO10646-1", 22, 4, 4},
157 {0, 0, 0, 0}
160 static MetricsInfo* grabMetrics(QString name)
162 for (int pos = 0; compatMetrics[pos].name; ++pos)
163 if (name == QLatin1String(compatMetrics[pos].name))
164 return &compatMetrics[pos];
165 return 0;
168 class QFakeFontEngine : public QFontEngineXLFD
170 public:
171 QString name;
173 QFakeFontEngine( XFontStruct *fs, const char *name, int size );
174 ~QFakeFontEngine();
176 bool haveMetrics;
177 QtFontDim m_ascent, m_descent, m_leading;
178 bool ahem;
179 int pixS;
180 XFontStruct* xfs;
182 QtFontDim fallBackWidth() const {
183 QtFontDim fbw = xfs->min_bounds.width;
184 if (xfs->per_char) {
185 if (haveMetrics)
186 fbw = m_ascent; //### we really should get rid of these and regen..
187 else
188 fbw = xfs->ascent;
190 return fbw;
193 #ifdef QT_45
194 void recalcAdvances(QGlyphLayout *glyphs, QTextEngine::ShaperFlags flags) const
196 QFontEngineXLFD::recalcAdvances(glyphs, flags);
198 // Go through the glyhs with glyph 0 and fix up their x advance
199 // to make sense (or at least match Qt3)
200 QtFontDim fbw = fallBackWidth();
202 for (int c = 0; c < glyphs->numGlyphs; ++c) {
203 if (!glyphs->glyphs[c])
204 glyphs->advances_x[c] = fbw;
207 #else
208 void recalcAdvances(int len, QGlyphLayout *glyphs, QTextEngine::ShaperFlags flags) const
210 QFontEngineXLFD::recalcAdvances(len, glyphs, flags);
212 // Go through the glyhs with glyph 0 and fix up their x advance
213 // to make sense (or at least match Qt3)
214 QtFontDim fbw = fallBackWidth();
216 QGlyphLayout* g = glyphs + len;
217 while (g != glyphs) {
218 --g;
219 if (!g->glyph) {
220 g->advance.x = fbw;
224 #endif
226 Type type() const
228 if (ahem) {
229 return QFontEngine::Freetype;
230 } else
231 return QFontEngine::XLFD;
235 QtFontDim ascent() const
237 if (haveMetrics)
238 return m_ascent;
239 else
240 return QFontEngineXLFD::ascent();
243 QtFontDim descent() const
245 if (haveMetrics)
246 return m_descent;
247 else
248 return QFontEngineXLFD::descent();
251 QtFontDim leading() const
253 if (ahem)
254 return 0;
255 else if (haveMetrics)
256 return m_leading;
257 else
258 return QFontEngineXLFD::leading();
261 bool canRender( const QChar *string, int len );
264 //OK. This is evil. Since we don't use Xft, we hijack the FreeType painting hook in the X11 engine
265 //for ahem, as unfortunately the drawing is in the paint engine, and not the font engine in Qt4
266 class QPaintEngine;
267 class KDE_EXPORT QX11PaintEngine: public QPaintEngine
269 void drawFreetype(const QPointF &p, const QTextItemInt &si);
272 void QX11PaintEngine::drawFreetype(const QPointF &p, const QTextItemInt &si)
274 #ifdef QT_45
275 int cnt = si.glyphs.numGlyphs;
276 #else
277 int cnt = si.num_glyph;
278 #endif
281 if (!cnt) return;
283 QFakeFontEngine *eng = static_cast<QFakeFontEngine*>(si.fontEngine);
286 int x = int(p.x());
287 int y = int(p.y());
288 int pixS = int(eng->pixS);
289 int advance = pixS;
290 int ascent = dimToInt(eng->ascent());
291 int descent = dimToInt(eng->descent());
293 if (si.flags & QTextItem::RightToLeft)
295 x = x + advance * (cnt - 1);
296 advance = -advance;
299 for (int pos = 0; pos < cnt; ++pos)
301 QRect rect;
303 #ifdef QT_45
304 switch (si.chars[pos].unicode())
305 #else
306 switch (si.glyphs[pos].glyph)
307 #endif
309 case ' ':
310 rect = QRect();
311 break;
312 case 'p':
313 //Below the baseline, including it
314 rect = QRect(x, y, pixS, descent + 1);
315 break;
316 case 0xC9:
317 //Above the baseline
318 rect = QRect(x, y - ascent, pixS, ascent);
319 break;
320 default:
321 //Whole block
322 rect = QRect(x, y - ascent, pixS, pixS);
325 QPainter* p = painter();
326 p->fillRect(rect, p->pen().color());
328 x += advance;
333 QFakeFontEngine::QFakeFontEngine( XFontStruct *fs, const char *name, int size )
334 : QFontEngineXLFD( fs, name, 0)
336 xfs = fs;
337 pixS = size;
338 this->name = QLatin1String(name);
339 ahem = this->name.contains("ahem");
341 MetricsInfo* metrics = grabMetrics(name);
342 if (metrics)
344 haveMetrics = true;
345 m_ascent = metrics->ascent;
346 m_descent = metrics->descent;
347 m_leading = metrics->leading;
349 else
350 haveMetrics = false;
353 QFakeFontEngine::~QFakeFontEngine()
358 bool QFakeFontEngine::canRender( const QChar *, int )
360 return true;
363 static QString courier_pickxlfd( int pixelsize, bool italic, bool bold )
365 if ( pixelsize >= 24 )
366 pixelsize = 24;
367 else if ( pixelsize >= 18 )
368 pixelsize = 18;
369 else if ( pixelsize >= 12 )
370 pixelsize = 12;
371 else
372 pixelsize = 10;
374 return QString( "-adobe-courier-%1-%2-normal--%3-*-75-75-m-*-iso10646-1" ).arg( bold ? "bold" : "medium" ).arg( italic ? "o" : "r" ).arg( pixelsize );
377 static QString ahem_pickxlfd( int pixelsize )
379 return QString( "-misc-ahem-medium-r-normal--%1-*-100-100-c-*-iso10646-1" ).arg( pixelsize );
382 static QString helv_pickxlfd( int pixelsize, bool italic, bool bold )
384 if ( pixelsize >= 24 )
385 pixelsize = 24;
386 else if ( pixelsize >= 18 )
387 pixelsize = 18;
388 else if ( pixelsize >= 12 )
389 pixelsize = 12;
390 else
391 pixelsize = 10;
393 return QString( "-adobe-helvetica-%1-%2-normal--%3-*-75-75-p-*-iso10646-1" ).arg( bold ? "bold" : "medium" ).arg( italic ? "o" : "r" ).arg( pixelsize );
397 static QFontEngine* loadFont(const QFontDef& request)
399 QString xlfd;
400 QString family = request.family.toLower();
401 if ( family == "adobe courier" || family == "courier" || family == "fixed" ) {
402 xlfd = courier_pickxlfd( request.pixelSize, request.style == QFont::StyleItalic, request.weight > 50 );
404 else if ( family == "times new roman" || family == "times" )
405 xlfd = "-adobe-times-medium-r-normal--8-80-75-75-p-44-iso10646-1";
406 else if ( family == "ahem" )
407 xlfd = ahem_pickxlfd( request.pixelSize );
408 else
409 xlfd = helv_pickxlfd( request.pixelSize, request.style == QFont::StyleItalic, request.weight > 50 );
411 QFontEngine *fe = 0;
413 XFontStruct *xfs;
414 xfs = XLoadQueryFont( QX11Info::display(), xlfd.toLatin1() );
415 if (!xfs) // as long as you don't do screenshots, it's maybe fine
416 qFatal("we need some fonts. So make sure you have %s installed.", qPrintable(xlfd));
418 unsigned long value;
419 if ( !XGetFontProperty( xfs, XA_FONT, &value ) )
420 return 0;
422 char *n = XGetAtomName( QX11Info::display(), value );
423 xlfd = n;
424 if ( n )
425 XFree( n );
427 fe = new QFakeFontEngine( xfs, xlfd.toLatin1(),request.pixelSize );
428 return fe;
431 KDE_EXPORT
432 QFontEngine *QFontDatabase::loadXlfd(int /* screen */, int /* script */,
433 const QFontDef &request, int /* force_encoding_id */)
435 return loadFont(request);
438 extern "C" KDE_EXPORT int FcInit() {
439 /* Make sure Qt uses the Xlfd path, which we intercept */
440 return 0;
443 KDE_EXPORT bool QFontDatabase::isBitmapScalable( const QString &,
444 const QString &) const
446 return true;
449 KDE_EXPORT bool QFontDatabase::isSmoothlyScalable( const QString &,
450 const QString &) const
452 return true;
455 const QString &KHTMLSettings::availableFamilies()
457 if ( !avFamilies ) {
458 avFamilies = new QString;
459 *avFamilies = ",Adobe Courier,Arial,Comic Sans MS,Courier,Helvetica,Times,Times New Roman,Utopia,Fixed,Ahem,";
462 return *avFamilies;
466 bool KHTMLSettings::unfinishedImageFrame() const
468 return false;
471 KDE_EXPORT int QX11Info::appDpiY( int )
473 return 100;
476 KDE_EXPORT int QX11Info::appDpiX( int )
478 return 100;
481 KDE_EXPORT void QFont::insertSubstitution(const QString &,
482 const QString &)
486 KDE_EXPORT void QFont::insertSubstitutions(const QString &,
487 const QStringList &)
491 #include <kprotocolinfo.h>
492 bool KProtocolInfo::isKnownProtocol( const QString& _protocol )
494 return ( _protocol == "file" );
497 #include <kprotocolinfofactory.h>
499 QString KProtocolInfo::exec( const QString& _protocol )
501 if ( _protocol != "file" )
502 return QString();
504 KProtocolInfo::Ptr prot = KProtocolInfoFactory::self()->findProtocol(_protocol);
505 if ( !prot )
506 return QString();
508 return prot->m_exec;
511 #include <dcopclient.h>
513 bool DCOPClient::attach()
515 return false;
518 bool DCOPClient::isAttached() const
520 return false;
523 void DCOPClient::processSocketData( int )
527 #include <QtGui/QApplication>
528 #include <QtGui/QPalette>
530 #if 0
531 KDE_EXPORT void QApplication::setPalette( const QPalette &, bool ,
532 const char* )
534 static bool done = false;
535 if (done) return;
536 QString xlfd = AHEM;
537 XFontStruct *xfs;
538 xfs = XLoadQueryFont(QPaintDevice::x11AppDisplay(), xlfd.toLatin1().constData() );
539 if (!xfs) // as long as you don't do screenshots, it's maybe fine
540 qFatal("We will need some fonts. So make sure you have %s installed.", xlfd.toLatin1().constData());
541 XFreeFont(QPaintDevice::x11AppDisplay(), xfs);
542 done = true;
544 #endif
546 #include <kapplication.h>
547 // void KApplication::dcopFailure( const QString & )
548 // {
549 // qDebug( "KApplication::dcopFailure" );
550 // }
552 #include <kparts/historyprovider.h>
554 bool KParts::HistoryProvider::contains( const QString& t ) const
556 return ( t == "http://www.kde.org/" || t == "http://www.google.com/");
560 #include <ksslsettings.h>
562 bool KSSLSettings::warnOnEnter() const { return false; }
563 bool KSSLSettings::warnOnUnencrypted() const { return false; }
564 bool KSSLSettings::warnOnLeave() const { return false; }
566 #include <kparts/plugin.h>
568 KParts::Plugin* KParts::Plugin::loadPlugin( QObject * /* parent */, const char* /* libname */) { return 0; }