summaryrefslogtreecommitdiffstats
path: root/src/gui/text
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/text')
-rw-r--r--src/gui/text/qfontengine.cpp24
-rw-r--r--src/gui/text/qfontengine_ft.cpp6
-rw-r--r--src/gui/text/qfontengine_mac.mm3
-rw-r--r--src/gui/text/qfontengine_p.h2
-rw-r--r--src/gui/text/qfontengine_win.cpp5
5 files changed, 23 insertions, 17 deletions
diff --git a/src/gui/text/qfontengine.cpp b/src/gui/text/qfontengine.cpp
index 70b7d65..be346e9 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>
@@ -681,11 +680,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 += '-';
@@ -1097,6 +1092,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();
diff --git a/src/gui/text/qfontengine_ft.cpp b/src/gui/text/qfontengine_ft.cpp
index 5e86b37..512afc8 100644
--- a/src/gui/text/qfontengine_ft.cpp
+++ b/src/gui/text/qfontengine_ft.cpp
@@ -51,7 +51,6 @@
#include "qabstractfileengine.h"
#include "qthreadstorage.h"
#include <qmath.h>
-#include <private/qpdf_p.h>
#include <private/qharfbuzz_p.h>
#include "qfontengine_ft_p.h"
@@ -1205,10 +1204,7 @@ QFontEngine::Properties QFontEngineFT::properties() const
{
Properties p = freetype->properties();
if (p.postscriptName.isEmpty()) {
- p.postscriptName = fontDef.family.toUtf8();
-#ifndef QT_NO_PRINTER
- p.postscriptName = QPdf::stripSpecialCharacters(p.postscriptName);
-#endif
+ p.postscriptName = QFontEngine::convertToPostscriptFontFamilyName(fontDef.family.toUtf8());
}
return freetype->properties();
diff --git a/src/gui/text/qfontengine_mac.mm b/src/gui/text/qfontengine_mac.mm
index 6e524f6..ebc1f6d 100644
--- a/src/gui/text/qfontengine_mac.mm
+++ b/src/gui/text/qfontengine_mac.mm
@@ -46,7 +46,6 @@
#include <qbitmap.h>
#include <private/qpaintengine_mac_p.h>
#include <private/qprintengine_mac_p.h>
-#include <private/qpdf_p.h>
#include <qglobal.h>
#include <qpixmap.h>
#include <qpixmapcache.h>
@@ -1876,7 +1875,7 @@ QFontEngine::Properties QFontEngineMac::properties() const
QCFString psName;
if (ATSFontGetPostScriptName(FMGetATSFontRefFromFont(fontID), kATSOptionFlagsDefault, &psName) == noErr)
props.postscriptName = QString(psName).toUtf8();
- props.postscriptName = QPdf::stripSpecialCharacters(props.postscriptName);
+ props.postscriptName = QFontEngine::convertToPostscriptFontFamilyName(props.postscriptName);
return props;
}
diff --git a/src/gui/text/qfontengine_p.h b/src/gui/text/qfontengine_p.h
index b3a6c59..d07c8c9 100644
--- a/src/gui/text/qfontengine_p.h
+++ b/src/gui/text/qfontengine_p.h
@@ -232,6 +232,8 @@ public:
static const uchar *getCMap(const uchar *table, uint tableSize, bool *isSymbolFont, int *cmapSize);
static quint32 getTrueTypeGlyphIndex(const uchar *cmap, uint unicode);
+ static QByteArray convertToPostscriptFontFamilyName(const QByteArray &fontFamily);
+
QAtomicInt ref;
QFontDef fontDef;
uint cache_cost; // amount of mem used in kb by the font
diff --git a/src/gui/text/qfontengine_win.cpp b/src/gui/text/qfontengine_win.cpp
index 3006776..a941dab 100644
--- a/src/gui/text/qfontengine_win.cpp
+++ b/src/gui/text/qfontengine_win.cpp
@@ -63,7 +63,6 @@
#include <qbitmap.h>
#include <private/qpainter_p.h>
-#include <private/qpdf_p.h>
#include "qpaintengine.h"
#include "qvarlengtharray.h"
#include <private/qpaintengine_raster_p.h>
@@ -1039,9 +1038,7 @@ QFontEngine::Properties QFontEngineWin::properties() const
p.italicAngle = otm->otmItalicAngle;
p.postscriptName = QString::fromWCharArray((wchar_t *)((char *)otm + (quintptr)otm->otmpFamilyName)).toLatin1();
p.postscriptName += QString::fromWCharArray((wchar_t *)((char *)otm + (quintptr)otm->otmpStyleName)).toLatin1();
-#ifndef QT_NO_PRINTER
- p.postscriptName = QPdf::stripSpecialCharacters(p.postscriptName);
-#endif
+ p.postscriptName = QFontEngine::convertToPostscriptFontFamilyName(p.postscriptName);
p.boundingBox = QRectF(otm->otmrcFontBox.left, -otm->otmrcFontBox.top,
otm->otmrcFontBox.right - otm->otmrcFontBox.left,
otm->otmrcFontBox.top - otm->otmrcFontBox.bottom);