summaryrefslogtreecommitdiffstats
path: root/src/gui/text/qfontengine.cpp
diff options
context:
space:
mode:
authorJørgen Lind <jorgen.lind@nokia.com>2010-09-17 06:30:04 (GMT)
committerJørgen Lind <jorgen.lind@nokia.com>2010-09-30 09:52:20 (GMT)
commit086a349d770eafe007136f3dda6ef7d6093a86a9 (patch)
tree7031a436cd38f33547bbacaf01c3db3c5a88871f /src/gui/text/qfontengine.cpp
parent5bd6f7eb5c7d87c08539b6c2df416990cc417ec7 (diff)
downloadQt-086a349d770eafe007136f3dda6ef7d6093a86a9.zip
Qt-086a349d770eafe007136f3dda6ef7d6093a86a9.tar.gz
Qt-086a349d770eafe007136f3dda6ef7d6093a86a9.tar.bz2
Moving QPdf::stripSpecialCharacter to fontengine
It is only used by the fontengines. This is one of the steps to make it easier to make fontengines build outside of QtGui. Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com>
Diffstat (limited to 'src/gui/text/qfontengine.cpp')
-rw-r--r--src/gui/text/qfontengine.cpp24
1 files changed, 18 insertions, 6 deletions
diff --git a/src/gui/text/qfontengine.cpp b/src/gui/text/qfontengine.cpp
index 0dfd295..7e04180 100644
--- a/src/gui/text/qfontengine.cpp
+++ b/src/gui/text/qfontengine.cpp
@@ -46,7 +46,6 @@
#include "qpainter.h"
#include "qpainterpath.h"
#include "qvarlengtharray.h"
-#include <private/qpdf_p.h>
#include <qmath.h>
#include <qendian.h>
#include <private/qharfbuzz_p.h>
@@ -667,11 +666,7 @@ void QFontEngine::removeGlyphFromCache(glyph_t)
QFontEngine::Properties QFontEngine::properties() const
{
Properties p;
-#ifndef QT_NO_PRINTER
- QByteArray psname = QPdf::stripSpecialCharacters(fontDef.family.toUtf8());
-#else
- QByteArray psname = fontDef.family.toUtf8();
-#endif
+ QByteArray psname = QFontEngine::convertToPostscriptFontFamilyName(fontDef.family.toUtf8());
psname += '-';
psname += QByteArray::number(fontDef.style);
psname += '-';
@@ -1081,6 +1076,23 @@ quint32 QFontEngine::getTrueTypeGlyphIndex(const uchar *cmap, uint unicode)
return 0;
}
+QByteArray QFontEngine::convertToPostscriptFontFamilyName(const QByteArray &family)
+{
+ QByteArray f = family;
+ f.replace(' ', "");
+ f.replace('(', "");
+ f.replace(')', "");
+ f.replace('<', "");
+ f.replace('>', "");
+ f.replace('[', "");
+ f.replace(']', "");
+ f.replace('{', "");
+ f.replace('}', "");
+ f.replace('/', "");
+ f.replace('%', "");
+ return f;
+}
+
Q_GLOBAL_STATIC_WITH_INITIALIZER(QVector<QRgb>, qt_grayPalette, {
x->resize(256);
QRgb *it = x->data();