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 "qfont.h"
|
---|
45 | #include "qfont_p.h"
|
---|
46 | #include "qfontengine_p.h"
|
---|
47 | #include "qtextengine_p.h"
|
---|
48 | #include "qfontmetrics.h"
|
---|
49 | #include "qfontinfo.h"
|
---|
50 |
|
---|
51 | QT_BEGIN_NAMESPACE
|
---|
52 |
|
---|
53 | Q_GUI_EXPORT const char *qt_fontFamilyFromStyleHint(const QFontDef &request)
|
---|
54 | {
|
---|
55 | const char *family = 0;
|
---|
56 | switch (request.styleHint) {
|
---|
57 | case QFont::Helvetica:
|
---|
58 | family = "Helvetica";
|
---|
59 | break;
|
---|
60 | case QFont::Times:
|
---|
61 | case QFont::OldEnglish:
|
---|
62 | family = "Times New Roman";
|
---|
63 | break;
|
---|
64 | case QFont::Courier:
|
---|
65 | family = "Courier";
|
---|
66 | break;
|
---|
67 | case QFont::System:
|
---|
68 | family = "WarpSans";
|
---|
69 | break;
|
---|
70 | case QFont::AnyStyle:
|
---|
71 | if (request.fixedPitch)
|
---|
72 | family = "Courier";
|
---|
73 | else
|
---|
74 | family = "Helvetica";
|
---|
75 | break;
|
---|
76 | }
|
---|
77 | return family;
|
---|
78 | }
|
---|
79 |
|
---|
80 | /*****************************************************************************
|
---|
81 | QFont member functions
|
---|
82 | *****************************************************************************/
|
---|
83 |
|
---|
84 | void QFont::initialize()
|
---|
85 | {
|
---|
86 | }
|
---|
87 |
|
---|
88 | void QFont::cleanup()
|
---|
89 | {
|
---|
90 | QFontCache::cleanup();
|
---|
91 | }
|
---|
92 |
|
---|
93 | QString QFont::rawName() const
|
---|
94 | {
|
---|
95 | return family();
|
---|
96 | }
|
---|
97 |
|
---|
98 | void QFont::setRawName(const QString &name)
|
---|
99 | {
|
---|
100 | setFamily(name);
|
---|
101 | }
|
---|
102 |
|
---|
103 | QString QFont::defaultFamily() const
|
---|
104 | {
|
---|
105 | return QLatin1String(qt_fontFamilyFromStyleHint(d->request));
|
---|
106 | }
|
---|
107 |
|
---|
108 | QString QFont::lastResortFamily() const
|
---|
109 | {
|
---|
110 | return QString::fromLatin1("Helvetica");
|
---|
111 | }
|
---|
112 |
|
---|
113 | QString QFont::lastResortFont() const
|
---|
114 | {
|
---|
115 | return QString::fromLatin1("Helvetica");
|
---|
116 | }
|
---|
117 |
|
---|
118 | QT_END_NAMESPACE
|
---|