Warning: That file was not part of the compilation database. It may have many parsing errors.
1 | /** |
---|---|
2 | * This file is part of the KDE project |
3 | * |
4 | * Copyright (C) 2003 Stephan Kulow (coolo@kde.org) |
5 | * |
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. |
10 | * |
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. |
15 | * |
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. |
20 | * |
21 | */ |
22 | |
23 | #include "ecma/kjs_proxy.h" |
24 | |
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> |
40 | #include <kdebug.h> |
41 | |
42 | struct MetricsInfo { |
43 | const char* name; |
44 | int ascent; |
45 | int descent; |
46 | int leading; |
47 | }; |
48 | |
49 | |
50 | typedef QFixed QtFontDim; |
51 | |
52 | static int dimToInt(QtFontDim dim) { |
53 | return dim.toInt(); |
54 | } |
55 | |
56 | |
57 | static const MetricsInfo compatMetrics[] = { |
58 | {"-Adobe-Courier-Medium-R-Normal--10-100-75-75-M-60-ISO10646-1", 8, 1, 2}, |
59 | {"-Adobe-Courier-Medium-O-Normal--10-100-75-75-M-60-ISO10646-1", 8, 1, 2}, |
60 | {"-Adobe-Courier-Bold-R-Normal--10-100-75-75-M-60-ISO10646-1", 8, 1, 2}, |
61 | {"-Adobe-Courier-Bold-O-Normal--10-100-75-75-M-60-ISO10646-1", 8, 1, 2}, |
62 | {"-Adobe-Courier-Medium-R-Normal--12-120-75-75-M-70-ISO10646-1", 10, 2, 2}, |
63 | {"-Adobe-Courier-Medium-O-Normal--12-120-75-75-M-70-ISO10646-1", 10, 2, 2}, |
64 | {"-Adobe-Courier-Bold-R-Normal--12-120-75-75-M-70-ISO10646-1", 10, 2, 2}, |
65 | {"-Adobe-Courier-Bold-O-Normal--12-120-75-75-M-70-ISO10646-1", 10, 2, 2}, |
66 | {"-Adobe-Courier-Medium-R-Normal--18-180-75-75-M-110-ISO10646-1", 14, 3, 3}, |
67 | {"-Adobe-Courier-Medium-O-Normal--18-180-75-75-M-110-ISO10646-1", 14, 3, 3}, |
68 | {"-Adobe-Courier-Bold-R-Normal--18-180-75-75-M-110-ISO10646-1", 14, 3, 3}, |
69 | {"-Adobe-Courier-Bold-O-Normal--18-180-75-75-M-110-ISO10646-1", 14, 3, 3}, |
70 | {"-Adobe-Courier-Medium-R-Normal--24-240-75-75-M-150-ISO10646-1", 19, 4, 4}, |
71 | {"-Adobe-Courier-Medium-O-Normal--24-240-75-75-M-150-ISO10646-1", 19, 4, 4}, |
72 | {"-Adobe-Courier-Bold-R-Normal--24-240-75-75-M-150-ISO10646-1", 19, 4, 4}, |
73 | {"-Adobe-Courier-Bold-O-Normal--24-240-75-75-M-150-ISO10646-1", 19, 4, 4}, |
74 | {"-Adobe-Times-Medium-R-Normal--8-80-75-75-P-44-ISO10646-1", 7, 1, 1}, |
75 | {"-Adobe-Times-Medium-R-Normal--8-80-75-75-P-44-ISO10646-1", 7, 1, 1}, |
76 | {"-Adobe-Times-Medium-R-Normal--8-80-75-75-P-44-ISO10646-1", 7, 1, 1}, |
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-Helvetica-Medium-R-Normal--10-100-75-75-P-56-ISO10646-1", 10, 1, 2}, |
91 | {"-Adobe-Helvetica-Medium-O-Normal--10-100-75-75-P-57-ISO10646-1", 10, 1, 2}, |
92 | {"-Adobe-Helvetica-Bold-R-Normal--10-100-75-75-P-60-ISO10646-1", 10, 1, 2}, |
93 | {"-Adobe-Helvetica-Bold-O-Normal--10-100-75-75-P-60-ISO10646-1", 10, 1, 2}, |
94 | {"-Adobe-Helvetica-Medium-R-Normal--12-120-75-75-P-67-ISO10646-1", 11, 2, 2}, |
95 | {"-Adobe-Helvetica-Medium-O-Normal--12-120-75-75-P-67-ISO10646-1", 11, 2, 2}, |
96 | {"-Adobe-Helvetica-Bold-R-Normal--12-120-75-75-P-70-ISO10646-1", 11, 2, 2}, |
97 | {"-Adobe-Helvetica-Bold-O-Normal--12-120-75-75-P-69-ISO10646-1", 11, 2, 2}, |
98 | {"-Adobe-Helvetica-Medium-R-Normal--18-180-75-75-P-98-ISO10646-1", 16, 4, 3}, |
99 | {"-Adobe-Helvetica-Medium-O-Normal--18-180-75-75-P-98-ISO10646-1", 16, 4, 3}, |
100 | {"-Adobe-Helvetica-Bold-R-Normal--18-180-75-75-P-103-ISO10646-1", 16, 4, 3}, |
101 | {"-Adobe-Helvetica-Bold-O-Normal--18-180-75-75-P-104-ISO10646-1", 16, 4, 3}, |
102 | {"-Adobe-Helvetica-Medium-R-Normal--24-240-75-75-P-130-ISO10646-1", 22, 4, 4}, |
103 | {"-Adobe-Helvetica-Medium-O-Normal--24-240-75-75-P-130-ISO10646-1", 22, 4, 4}, |
104 | {"-Adobe-Helvetica-Bold-R-Normal--24-240-75-75-P-138-ISO10646-1", 22, 4, 4}, |
105 | {"-Adobe-Helvetica-Bold-O-Normal--24-240-75-75-P-138-ISO10646-1", 22, 4, 4}, |
106 | {"-Adobe-Courier-Medium-R-Normal--10-100-75-75-M-60-ISO10646-1", 8, 1, 2}, |
107 | {"-Adobe-Courier-Medium-O-Normal--10-100-75-75-M-60-ISO10646-1", 8, 1, 2}, |
108 | {"-Adobe-Courier-Bold-R-Normal--10-100-75-75-M-60-ISO10646-1", 8, 1, 2}, |
109 | {"-Adobe-Courier-Bold-O-Normal--10-100-75-75-M-60-ISO10646-1", 8, 1, 2}, |
110 | {"-Adobe-Courier-Medium-R-Normal--12-120-75-75-M-70-ISO10646-1", 10, 2, 2}, |
111 | {"-Adobe-Courier-Medium-O-Normal--12-120-75-75-M-70-ISO10646-1", 10, 2, 2}, |
112 | {"-Adobe-Courier-Bold-R-Normal--12-120-75-75-M-70-ISO10646-1", 10, 2, 2}, |
113 | {"-Adobe-Courier-Bold-O-Normal--12-120-75-75-M-70-ISO10646-1", 10, 2, 2}, |
114 | {"-Adobe-Courier-Medium-R-Normal--18-180-75-75-M-110-ISO10646-1", 14, 3, 3}, |
115 | {"-Adobe-Courier-Medium-O-Normal--18-180-75-75-M-110-ISO10646-1", 14, 3, 3}, |
116 | {"-Adobe-Courier-Bold-R-Normal--18-180-75-75-M-110-ISO10646-1", 14, 3, 3}, |
117 | {"-Adobe-Courier-Bold-O-Normal--18-180-75-75-M-110-ISO10646-1", 14, 3, 3}, |
118 | {"-Adobe-Courier-Medium-R-Normal--24-240-75-75-M-150-ISO10646-1", 19, 4, 4}, |
119 | {"-Adobe-Courier-Medium-O-Normal--24-240-75-75-M-150-ISO10646-1", 19, 4, 4}, |
120 | {"-Adobe-Courier-Bold-R-Normal--24-240-75-75-M-150-ISO10646-1", 19, 4, 4}, |
121 | {"-Adobe-Courier-Bold-O-Normal--24-240-75-75-M-150-ISO10646-1", 19, 4, 4}, |
122 | {"-Adobe-Times-Medium-R-Normal--8-80-75-75-P-44-ISO10646-1", 7, 1, 1}, |
123 | {"-Adobe-Times-Medium-R-Normal--8-80-75-75-P-44-ISO10646-1", 7, 1, 1}, |
124 | {"-Adobe-Times-Medium-R-Normal--8-80-75-75-P-44-ISO10646-1", 7, 1, 1}, |
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-Helvetica-Medium-R-Normal--10-100-75-75-P-56-ISO10646-1", 10, 1, 2}, |
139 | {"-Adobe-Helvetica-Medium-O-Normal--10-100-75-75-P-57-ISO10646-1", 10, 1, 2}, |
140 | {"-Adobe-Helvetica-Bold-R-Normal--10-100-75-75-P-60-ISO10646-1", 10, 1, 2}, |
141 | {"-Adobe-Helvetica-Bold-O-Normal--10-100-75-75-P-60-ISO10646-1", 10, 1, 2}, |
142 | {"-Adobe-Helvetica-Medium-R-Normal--12-120-75-75-P-67-ISO10646-1", 11, 2, 2}, |
143 | {"-Adobe-Helvetica-Medium-O-Normal--12-120-75-75-P-67-ISO10646-1", 11, 2, 2}, |
144 | {"-Adobe-Helvetica-Bold-R-Normal--12-120-75-75-P-70-ISO10646-1", 11, 2, 2}, |
145 | {"-Adobe-Helvetica-Bold-O-Normal--12-120-75-75-P-69-ISO10646-1", 11, 2, 2}, |
146 | {"-Adobe-Helvetica-Medium-R-Normal--18-180-75-75-P-98-ISO10646-1", 16, 4, 3}, |
147 | {"-Adobe-Helvetica-Medium-O-Normal--18-180-75-75-P-98-ISO10646-1", 16, 4, 3}, |
148 | {"-Adobe-Helvetica-Bold-R-Normal--18-180-75-75-P-103-ISO10646-1", 16, 4, 3}, |
149 | {"-Adobe-Helvetica-Bold-O-Normal--18-180-75-75-P-104-ISO10646-1", 16, 4, 3}, |
150 | {"-Adobe-Helvetica-Medium-R-Normal--24-240-75-75-P-130-ISO10646-1", 22, 4, 4}, |
151 | {"-Adobe-Helvetica-Medium-O-Normal--24-240-75-75-P-130-ISO10646-1", 22, 4, 4}, |
152 | {"-Adobe-Helvetica-Bold-R-Normal--24-240-75-75-P-138-ISO10646-1", 22, 4, 4}, |
153 | {"-Adobe-Helvetica-Bold-O-Normal--24-240-75-75-P-138-ISO10646-1", 22, 4, 4}, |
154 | {0, 0, 0, 0} |
155 | }; |
156 | |
157 | static const MetricsInfo* grabMetrics(const QString &name) |
158 | { |
159 | for (int pos = 0; compatMetrics[pos].name; ++pos) |
160 | if (name == QLatin1String(compatMetrics[pos].name)) |
161 | return &compatMetrics[pos]; |
162 | return 0; |
163 | } |
164 | |
165 | class QFakeFontEngine : public QFontEngineXLFD |
166 | { |
167 | public: |
168 | QString name; |
169 | |
170 | QFakeFontEngine( XFontStruct *fs, const char *name, int size ); |
171 | ~QFakeFontEngine(); |
172 | |
173 | bool haveMetrics; |
174 | QtFontDim m_ascent, m_descent, m_leading; |
175 | bool ahem; |
176 | int pixS; |
177 | XFontStruct* xfs; |
178 | |
179 | QtFontDim fallBackWidth() const { |
180 | QtFontDim fbw = xfs->min_bounds.width; |
181 | if (xfs->per_char) { |
182 | if (haveMetrics) |
183 | fbw = m_ascent; //### we really should get rid of these and regen.. |
184 | else |
185 | fbw = xfs->ascent; |
186 | } |
187 | return fbw; |
188 | } |
189 | |
190 | void recalcAdvances(QGlyphLayout *glyphs, QTextEngine::ShaperFlags flags) const |
191 | { |
192 | QFontEngineXLFD::recalcAdvances(glyphs, flags); |
193 | |
194 | // Go through the glyhs with glyph 0 and fix up their x advance |
195 | // to make sense (or at least match Qt3) |
196 | QtFontDim fbw = fallBackWidth(); |
197 | |
198 | for (int c = 0; c < glyphs->numGlyphs; ++c) { |
199 | if (glyphs->glyphs[c] == 0x200B) // ZERO WIDTH SPACE |
200 | glyphs->advances_x[c] = 0; |
201 | else if (!glyphs->glyphs[c]) |
202 | glyphs->advances_x[c] = fbw; |
203 | } |
204 | } |
205 | |
206 | Type type() const |
207 | { |
208 | if (ahem) { |
209 | return QFontEngine::Freetype; |
210 | } else |
211 | return QFontEngine::XLFD; |
212 | } |
213 | |
214 | |
215 | QtFontDim ascent() const |
216 | { |
217 | if (haveMetrics) |
218 | return m_ascent; |
219 | else |
220 | return QFontEngineXLFD::ascent(); |
221 | } |
222 | |
223 | QtFontDim descent() const |
224 | { |
225 | if (haveMetrics) |
226 | return m_descent; |
227 | else |
228 | return QFontEngineXLFD::descent(); |
229 | } |
230 | |
231 | QtFontDim leading() const |
232 | { |
233 | if (ahem) |
234 | return 0; |
235 | else if (haveMetrics) |
236 | return m_leading; |
237 | else |
238 | return QFontEngineXLFD::leading(); |
239 | } |
240 | |
241 | bool canRender( const QChar *string, int len ); |
242 | }; |
243 | |
244 | //OK. This is evil. Since we don't use Xft, we hijack the FreeType painting hook in the X11 engine |
245 | //for ahem, as unfortunately the drawing is in the paint engine, and not the font engine in Qt4 |
246 | class KDE_EXPORT QX11PaintEngine: public QPaintEngine |
247 | { |
248 | void drawFreetype(const QPointF &p, const QTextItemInt &si); |
249 | }; |
250 | |
251 | void QX11PaintEngine::drawFreetype(const QPointF &p, const QTextItemInt &si) |
252 | { |
253 | int cnt = si.glyphs.numGlyphs; |
254 | |
255 | if (!cnt) return; |
256 | |
257 | QFakeFontEngine *eng = static_cast<QFakeFontEngine*>(si.fontEngine); |
258 | |
259 | |
260 | int x = int(p.x()); |
261 | int y = int(p.y()); |
262 | int pixS = int(eng->pixS); |
263 | int advance = pixS; |
264 | int ascent = dimToInt(eng->ascent()); |
265 | int descent = dimToInt(eng->descent()); |
266 | |
267 | if (si.flags & QTextItem::RightToLeft) |
268 | { |
269 | x = x + advance * (cnt - 1); |
270 | advance = -advance; |
271 | } |
272 | |
273 | for (int pos = 0; pos < cnt; ++pos) |
274 | { |
275 | QRect rect; |
276 | |
277 | switch (si.chars[pos].unicode()) |
278 | { |
279 | case |
280 | case 0x00A0: // NON-BREAKING SPACE |
281 | rect = QRect(); |
282 | break; |
283 | case 0x200B: // ZERO WIDTH SPACE |
284 | continue; |
285 | case |
286 | //Below the baseline, including it |
287 | rect = QRect(x, y, pixS, descent + 1); |
288 | break; |
289 | case 0xC9: |
290 | //Above the baseline |
291 | rect = QRect(x, y - ascent, pixS, ascent); |
292 | break; |
293 | default: |
294 | //Whole block |
295 | rect = QRect(x, y - ascent, pixS, pixS); |
296 | } |
297 | |
298 | QPainter* p = painter(); |
299 | p->fillRect(rect, p->pen().color()); |
300 | |
301 | x += advance; |
302 | } |
303 | } |
304 | |
305 | |
306 | QFakeFontEngine::QFakeFontEngine( XFontStruct *fs, const char *name, int size ) |
307 | : QFontEngineXLFD( fs, name, 0) |
308 | { |
309 | xfs = fs; |
310 | pixS = size; |
311 | this->name = QLatin1String(name); |
312 | ahem = this->name.contains("ahem"); |
313 | |
314 | const MetricsInfo* metrics = grabMetrics(name); |
315 | if (metrics) |
316 | { |
317 | haveMetrics = true; |
318 | m_ascent = metrics->ascent; |
319 | m_descent = metrics->descent; |
320 | m_leading = metrics->leading; |
321 | } |
322 | else |
323 | haveMetrics = false; |
324 | } |
325 | |
326 | QFakeFontEngine::~QFakeFontEngine() |
327 | { |
328 | } |
329 | |
330 | |
331 | bool QFakeFontEngine::canRender( const QChar *, int ) |
332 | { |
333 | return true; |
334 | } |
335 | |
336 | static QString courier_pickxlfd( int pixelsize, bool italic, bool bold ) |
337 | { |
338 | if ( pixelsize >= 24 ) |
339 | pixelsize = 24; |
340 | else if ( pixelsize >= 18 ) |
341 | pixelsize = 18; |
342 | else if ( pixelsize >= 12 ) |
343 | pixelsize = 12; |
344 | else |
345 | pixelsize = 10; |
346 | |
347 | return QString( "-adobe-courier-%1-%2-normal--%3-*-75-75-m-*-iso10646-1").arg( bold ? "bold": "medium").arg( italic ? "o": "r").arg( pixelsize ); |
348 | } |
349 | |
350 | static QString ahem_pickxlfd( int pixelsize ) |
351 | { |
352 | return QString( "-misc-ahem-medium-r-normal--%1-*-100-100-c-*-iso10646-1").arg( pixelsize ); |
353 | } |
354 | |
355 | static QString helv_pickxlfd( int pixelsize, bool italic, bool bold ) |
356 | { |
357 | if ( pixelsize >= 24 ) |
358 | pixelsize = 24; |
359 | else if ( pixelsize >= 18 ) |
360 | pixelsize = 18; |
361 | else if ( pixelsize >= 12 ) |
362 | pixelsize = 12; |
363 | else |
364 | pixelsize = 10; |
365 | |
366 | return QString( "-adobe-helvetica-%1-%2-normal--%3-*-75-75-p-*-iso10646-1").arg( bold ? "bold": "medium").arg( italic ? "o": "r").arg( pixelsize ); |
367 | |
368 | } |
369 | |
370 | static QFontEngine* loadFont(const QFontDef& request) |
371 | { |
372 | QString xlfd; |
373 | QStringList flist = request.family.toLower().split(","); |
374 | foreach (QString family, flist) { |
375 | if (!KHTMLSettings::availableFamilies().contains( ","+ family + ",", Qt::CaseInsensitive )) |
376 | continue; |
377 | |
378 | if ( family == "adobe courier"|| family == "courier"|| family == "fixed") { |
379 | xlfd = courier_pickxlfd( request.pixelSize, request.style == QFont::StyleItalic, request.weight > 50 ); |
380 | } else if ( family == "times new roman"|| family == "times") { |
381 | xlfd = "-adobe-times-medium-r-normal--8-80-75-75-p-44-iso10646-1"; |
382 | } else if ( family == "ahem") { |
383 | xlfd = ahem_pickxlfd( request.pixelSize ); |
384 | } else { |
385 | xlfd = helv_pickxlfd( request.pixelSize, request.style == QFont::StyleItalic, request.weight > 50 ); |
386 | } |
387 | break; |
388 | } |
389 | if (xlfd.isEmpty()) { |
390 | xlfd = helv_pickxlfd( request.pixelSize, request.style == QFont::StyleItalic, request.weight > 50 ); |
391 | } |
392 | |
393 | QFontEngine *fe = 0; |
394 | |
395 | XFontStruct *xfs; |
396 | xfs = XLoadQueryFont( QX11Info::display(), xlfd.toLatin1() ); |
397 | if (!xfs) // as long as you don't do screenshots, it's maybe fine |
398 | qFatal("we need some fonts. So make sure you have %s installed.", qPrintable(xlfd)); |
399 | |
400 | unsigned long value; |
401 | if ( !XGetFontProperty( xfs, XA_FONT, &value ) ) |
402 | return 0; |
403 | |
404 | char *n = XGetAtomName( QX11Info::display(), value ); |
405 | xlfd = n; |
406 | if ( n ) |
407 | XFree( n ); |
408 | |
409 | fe = new QFakeFontEngine( xfs, xlfd.toLatin1(),request.pixelSize ); |
410 | return fe; |
411 | } |
412 | |
413 | KDE_EXPORT |
414 | QFontEngine *QFontDatabase::loadXlfd(int /* screen */, int /* script */, |
415 | const QFontDef &request, int /* force_encoding_id */) |
416 | { |
417 | return loadFont(request); |
418 | } |
419 | |
420 | extern "C"KDE_EXPORT int FcInit() { |
421 | /* Make sure Qt uses the Xlfd path, which we intercept */ |
422 | return 0; |
423 | } |
424 | |
425 | KDE_EXPORT bool QFontDatabase::isBitmapScalable( const QString &, |
426 | const QString &) const |
427 | { |
428 | return true; |
429 | } |
430 | |
431 | KDE_EXPORT bool QFontDatabase::isSmoothlyScalable( const QString &, |
432 | const QString &) const |
433 | { |
434 | return true; |
435 | } |
436 | |
437 | const QString &KHTMLSettings::availableFamilies() |
438 | { |
439 | if ( !avFamilies ) { |
440 | avFamilies = new QString; |
441 | *avFamilies = ",Adobe Courier,Arial,Comic Sans MS,Courier,Helvetica,Times,Times New Roman,Utopia,Fixed,Ahem,"; |
442 | } |
443 | |
444 | return *avFamilies; |
445 | } |
446 | |
447 | |
448 | bool KHTMLSettings::unfinishedImageFrame() const |
449 | { |
450 | return false; |
451 | } |
452 | |
453 | KDE_EXPORT int QX11Info::appDpiY( int ) |
454 | { |
455 | return 100; |
456 | } |
457 | |
458 | KDE_EXPORT int QX11Info::appDpiX( int ) |
459 | { |
460 | return 100; |
461 | } |
462 | |
463 | KDE_EXPORT void QFont::insertSubstitution(const QString &, |
464 | const QString &) |
465 | { |
466 | } |
467 | |
468 | KDE_EXPORT void QFont::insertSubstitutions(const QString &, |
469 | const QStringList &) |
470 | { |
471 | } |
472 | |
473 | #include <kprotocolinfo.h> |
474 | bool KProtocolInfo::isKnownProtocol( const QString& _protocol ) |
475 | { |
476 | return ( _protocol == "file"); |
477 | } |
478 | |
479 | #include <kprotocolinfofactory.h> |
480 | |
481 | QString KProtocolInfo::exec( const QString& _protocol ) |
482 | { |
483 | if ( _protocol != "file") |
484 | return QString(); |
485 | |
486 | KProtocolInfo::Ptr prot = KProtocolInfoFactory::self()->findProtocol(_protocol); |
487 | if ( !prot ) |
488 | return QString(); |
489 | |
490 | return prot->m_exec; |
491 | } |
492 | /* |
493 | #include <dcopclient.h> |
494 | |
495 | bool DCOPClient::attach() |
496 | { |
497 | return false; |
498 | } |
499 | |
500 | bool DCOPClient::isAttached() const |
501 | { |
502 | return false; |
503 | } |
504 | |
505 | void DCOPClient::processSocketData( int ) |
506 | { |
507 | }*/ |
508 | |
509 | #include <QtGui/QApplication> |
510 | #include <QtGui/QPalette> |
511 | |
512 | #if 0 |
513 | KDE_EXPORT void QApplication::setPalette( const QPalette &, bool , |
514 | const char* ) |
515 | { |
516 | static bool done = false; |
517 | if (done) return; |
518 | QString xlfd = AHEM; |
519 | XFontStruct *xfs; |
520 | xfs = XLoadQueryFont(QPaintDevice::x11AppDisplay(), xlfd.toLatin1().constData() ); |
521 | if (!xfs) // as long as you don't do screenshots, it's maybe fine |
522 | qFatal("We will need some fonts. So make sure you have %s installed.", xlfd.toLatin1().constData()); |
523 | XFreeFont(QPaintDevice::x11AppDisplay(), xfs); |
524 | done = true; |
525 | } |
526 | #endif |
527 | |
528 | #include <kapplication.h> |
529 | // void KApplication::dcopFailure( const QString & ) |
530 | // { |
531 | // qDebug( "KApplication::dcopFailure" ); |
532 | // } |
533 | |
534 | #include <kparts/historyprovider.h> |
535 | |
536 | bool KParts::HistoryProvider::contains( const QString& t ) const |
537 | { |
538 | return ( t == "http://www.kde.org/"|| t == "http://www.google.com/"); |
539 | } |
540 | |
541 | |
542 | #include <ksslsettings.h> |
543 | |
544 | bool KSSLSettings::warnOnEnter() const { return false; } |
545 | bool KSSLSettings::warnOnUnencrypted() const { return false; } |
546 | bool KSSLSettings::warnOnLeave() const { return false; } |
547 | |
548 | #include <kparts/plugin.h> |
549 | |
550 | KParts::Plugin* KParts::Plugin::loadPlugin( QObject * /* parent */, const char* /* libname */) { return 0; } |
551 | |
552 | #include <klineedit.h> |
553 | |
554 | void KLineEdit::setClearButtonShown(bool /*show*/) |
555 | {} |
556 |
Warning: That file was not part of the compilation database. It may have many parsing errors.