source: trunk/src/gui/text/qfontdatabase_pm.cpp@ 139

Last change on this file since 139 was 125, checked in by Dmitry A. Kuminov, 16 years ago

gui: Added QFontEnginePMFT that makes use of FreeType to render fonts and enabled by default (no proper font matching yet, HELV.PFB is always used so far).

  • Property svn:eol-style set to native
  • Property svn:executable set to *
  • Property svn:keywords set to Date Revision Author Id
File size: 4.4 KB
Line 
1/****************************************************************************
2**
3** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
4** Contact: Qt Software Information ([email protected])
5**
6** Copyright (C) 2009 netlabs.org. OS/2 parts.
7**
8** This file is part of the QtGui module of the Qt Toolkit.
9**
10** $QT_BEGIN_LICENSE:LGPL$
11** Commercial Usage
12** Licensees holding valid Qt Commercial licenses may use this file in
13** accordance with the Qt Commercial License Agreement provided with the
14** Software or, alternatively, in accordance with the terms contained in
15** a written agreement between you and Nokia.
16**
17** GNU Lesser General Public License Usage
18** Alternatively, this file may be used under the terms of the GNU Lesser
19** General Public License version 2.1 as published by the Free Software
20** Foundation and appearing in the file LICENSE.LGPL included in the
21** packaging of this file. Please review the following information to
22** ensure the GNU Lesser General Public License version 2.1 requirements
23** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
24**
25** In addition, as a special exception, Nokia gives you certain
26** additional rights. These rights are described in the Nokia Qt LGPL
27** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
28** package.
29**
30** GNU General Public License Usage
31** Alternatively, this file may be used under the terms of the GNU
32** General Public License version 3.0 as published by the Free Software
33** Foundation and appearing in the file LICENSE.GPL included in the
34** packaging of this file. Please review the following information to
35** ensure the GNU General Public License version 3.0 requirements will be
36** met: http://www.gnu.org/copyleft/gpl.html.
37**
38** If you are unsure which license is appropriate for your use, please
39** contact the sales department at [email protected].
40** $QT_END_LICENSE$
41**
42****************************************************************************/
43
44#include "qabstractfileengine.h"
45
46#include "qfontengine_pm_p.h"
47
48QT_BEGIN_NAMESPACE
49
50static void initializeDb()
51{
52 // @todo implement
53}
54
55static inline void load(const QString &family = QString(), int = -1)
56{
57 // @todo implement
58}
59
60static void registerFont(QFontDatabasePrivate::ApplicationFont *fnt)
61{
62 // @todo implement
63}
64
65void QFontDatabase::load(const QFontPrivate *d, int script)
66{
67 Q_ASSERT(script >= 0 && script < QUnicodeTables::ScriptCount);
68
69 // normalize the request to get better caching
70 QFontDef req = d->request;
71 if (req.pixelSize <= 0)
72 req.pixelSize = qMax(1, qRound(req.pointSize * d->dpi / 72.));
73 req.pointSize = 0;
74 if (req.weight == 0)
75 req.weight = QFont::Normal;
76 if (req.stretch == 0)
77 req.stretch = 100;
78
79 QFontCache::Key key(req, d->rawMode ? QUnicodeTables::Common : script, d->screen);
80 if (!d->engineData)
81 getEngineData(d, key);
82
83 // the cached engineData could have already loaded the engine we want
84 if (d->engineData->engines[script])
85 return;
86
87 // set it to the actual pointsize, so QFontInfo will do the right thing
88 req.pointSize = req.pixelSize * 72. / d->dpi;
89
90 QFontEngine *fe = QFontCache::instance()->findEngine(key);
91
92 if (!fe) {
93 if (qt_enable_test_font && req.family == QLatin1String("__Qt__Box__Engine__")) {
94 fe = new QTestFontEngine(req.pixelSize);
95 fe->fontDef = req;
96 } else {
97 // @todo initializeDb() and stuff, get the engine
98 QFontDef fd = req;
99 fe = new QFontEnginePMFT(fd);
100 }
101 if (!fe) {
102 fe = new QFontEngineBox(req.pixelSize);
103 fe->fontDef = QFontDef();
104 }
105 }
106 if (fe->symbol || (d->request.styleStrategy & QFont::NoFontMerging)) {
107 for (int i = 0; i < QUnicodeTables::ScriptCount; ++i) {
108 if (!d->engineData->engines[i]) {
109 d->engineData->engines[i] = fe;
110 fe->ref.ref();
111 }
112 }
113 } else {
114 d->engineData->engines[script] = fe;
115 fe->ref.ref();
116 }
117 QFontCache::instance()->insertEngine(key, fe);
118}
119
120bool QFontDatabase::removeApplicationFont(int handle)
121{
122 // @todo implement
123 return false;
124}
125
126bool QFontDatabase::removeAllApplicationFonts()
127{
128 // @todo implement
129 return false;
130}
131
132bool QFontDatabase::supportsThreadedFontRendering()
133{
134 // @todo implement
135 return false;
136}
137
138QT_END_NAMESPACE
Note: See TracBrowser for help on using the repository browser.