summaryrefslogtreecommitdiffstats
path: root/src/platformsupport
diff options
context:
space:
mode:
Diffstat (limited to 'src/platformsupport')
-rw-r--r--src/platformsupport/eglconvenience/qeglcompositor.cpp7
-rw-r--r--src/platformsupport/eglconvenience/qeglplatformcursor.cpp4
-rw-r--r--src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp240
-rw-r--r--src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm6
-rw-r--r--src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm67
-rw-r--r--src/platformsupport/fontdatabases/mac/qfontengine_coretext_p.h4
-rw-r--r--src/platformsupport/linuxaccessibility/application.cpp2
7 files changed, 178 insertions, 152 deletions
diff --git a/src/platformsupport/eglconvenience/qeglcompositor.cpp b/src/platformsupport/eglconvenience/qeglcompositor.cpp
index a38f00d4f6..0e0a2d9375 100644
--- a/src/platformsupport/eglconvenience/qeglcompositor.cpp
+++ b/src/platformsupport/eglconvenience/qeglcompositor.cpp
@@ -119,16 +119,21 @@ void QEGLCompositor::render(QEGLPlatformWindow *window)
glBindTexture(GL_TEXTURE_2D, textureId);
QMatrix4x4 target = QOpenGLTextureBlitter::targetTransform(textures->geometry(i),
targetWindowRect);
- m_blitter->setSwizzleRB(window->isRaster());
if (textures->count() > 1 && i == textures->count() - 1) {
+ // Backingstore for a widget with QOpenGLWidget subwidgets
+ m_blitter->setSwizzleRB(true);
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
m_blitter->blit(textureId, target, QOpenGLTextureBlitter::OriginTopLeft);
glDisable(GL_BLEND);
} else if (textures->count() == 1) {
+ // A regular QWidget window
+ m_blitter->setSwizzleRB(true);
m_blitter->blit(textureId, target, QOpenGLTextureBlitter::OriginTopLeft);
} else {
+ // Texture from an FBO belonging to a QOpenGLWidget
+ m_blitter->setSwizzleRB(false);
m_blitter->blit(textureId, target, QOpenGLTextureBlitter::OriginBottomLeft);
}
}
diff --git a/src/platformsupport/eglconvenience/qeglplatformcursor.cpp b/src/platformsupport/eglconvenience/qeglplatformcursor.cpp
index 1c87e1d27d..70e7c4e4db 100644
--- a/src/platformsupport/eglconvenience/qeglplatformcursor.cpp
+++ b/src/platformsupport/eglconvenience/qeglplatformcursor.cpp
@@ -210,7 +210,7 @@ void QEGLPlatformCursor::initCursorAtlas()
m_cursorAtlas.cursorsPerRow = cursorsPerRow;
const QJsonArray hotSpots = object.value(QLatin1String("hotSpots")).toArray();
- Q_ASSERT(hotSpots.count() == Qt::LastCursor);
+ Q_ASSERT(hotSpots.count() == Qt::LastCursor + 1);
for (int i = 0; i < hotSpots.count(); i++) {
QPoint hotSpot(hotSpots[i].toArray()[0].toDouble(), hotSpots[i].toArray()[1].toDouble());
m_cursorAtlas.hotSpots << hotSpot;
@@ -218,7 +218,7 @@ void QEGLPlatformCursor::initCursorAtlas()
QImage image = QImage(atlas).convertToFormat(QImage::Format_ARGB32_Premultiplied);
m_cursorAtlas.cursorWidth = image.width() / m_cursorAtlas.cursorsPerRow;
- m_cursorAtlas.cursorHeight = image.height() / ((Qt::LastCursor + cursorsPerRow - 1) / cursorsPerRow);
+ m_cursorAtlas.cursorHeight = image.height() / ((Qt::LastCursor + cursorsPerRow) / cursorsPerRow);
m_cursorAtlas.width = image.width();
m_cursorAtlas.height = image.height();
m_cursorAtlas.image = image;
diff --git a/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp b/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp
index 8b16e7520a..a9a85f1316 100644
--- a/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp
+++ b/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp
@@ -331,8 +331,10 @@ static const char *getFcFamilyForStyleHint(const QFont::StyleHint style)
return stylehint;
}
-static void populateFromPattern(FcPattern *pattern)
+void QFontconfigDatabase::populateFontDatabase()
{
+ FcFontSet *fonts;
+
QString familyName;
FcChar8 *value = 0;
int weight_value;
@@ -346,110 +348,6 @@ static void populateFromPattern(FcPattern *pattern)
FcBool scalable;
FcBool antialias;
- if (FcPatternGetString(pattern, FC_FAMILY, 0, &value) != FcResultMatch)
- return;
-
- familyName = QString::fromUtf8((const char *)value);
-
- slant_value = FC_SLANT_ROMAN;
- weight_value = FC_WEIGHT_REGULAR;
- spacing_value = FC_PROPORTIONAL;
- file_value = 0;
- indexValue = 0;
- scalable = FcTrue;
-
-
- if (FcPatternGetInteger(pattern, FC_SLANT, 0, &slant_value) != FcResultMatch)
- slant_value = FC_SLANT_ROMAN;
- if (FcPatternGetInteger(pattern, FC_WEIGHT, 0, &weight_value) != FcResultMatch)
- weight_value = FC_WEIGHT_REGULAR;
- if (FcPatternGetInteger(pattern, FC_WIDTH, 0, &width_value) != FcResultMatch)
- width_value = FC_WIDTH_NORMAL;
- if (FcPatternGetInteger(pattern, FC_SPACING, 0, &spacing_value) != FcResultMatch)
- spacing_value = FC_PROPORTIONAL;
- if (FcPatternGetString(pattern, FC_FILE, 0, &file_value) != FcResultMatch)
- file_value = 0;
- if (FcPatternGetInteger(pattern, FC_INDEX, 0, &indexValue) != FcResultMatch)
- indexValue = 0;
- if (FcPatternGetBool(pattern, FC_SCALABLE, 0, &scalable) != FcResultMatch)
- scalable = FcTrue;
- if (FcPatternGetString(pattern, FC_FOUNDRY, 0, &foundry_value) != FcResultMatch)
- foundry_value = 0;
- if (FcPatternGetString(pattern, FC_STYLE, 0, &style_value) != FcResultMatch)
- style_value = 0;
- if (FcPatternGetBool(pattern,FC_ANTIALIAS,0,&antialias) != FcResultMatch)
- antialias = true;
-
- QSupportedWritingSystems writingSystems;
- FcLangSet *langset = 0;
- FcResult res = FcPatternGetLangSet(pattern, FC_LANG, 0, &langset);
- if (res == FcResultMatch) {
- bool hasLang = false;
- for (int j = 1; j < QFontDatabase::WritingSystemsCount; ++j) {
- const FcChar8 *lang = (const FcChar8*) languageForWritingSystem[j];
- if (lang) {
- FcLangResult langRes = FcLangSetHasLang(langset, lang);
- if (langRes != FcLangDifferentLang) {
- writingSystems.setSupported(QFontDatabase::WritingSystem(j));
- hasLang = true;
- }
- }
- }
- if (!hasLang)
- // none of our known languages, add it to the other set
- writingSystems.setSupported(QFontDatabase::Other);
- } else {
- // we set Other to supported for symbol fonts. It makes no
- // sense to merge these with other ones, as they are
- // special in a way.
- writingSystems.setSupported(QFontDatabase::Other);
- }
-
-#if FC_VERSION >= 20297
- for (int j = 1; j < QFontDatabase::WritingSystemsCount; ++j) {
- if (writingSystems.supported(QFontDatabase::WritingSystem(j))
- && requiresOpenType(j) && openType[j]) {
- FcChar8 *cap;
- res = FcPatternGetString (pattern, FC_CAPABILITY, 0, &cap);
- if (res != FcResultMatch || !strstr((const char *)cap, openType[j]))
- writingSystems.setSupported(QFontDatabase::WritingSystem(j),false);
- }
- }
-#endif
-
- FontFile *fontFile = new FontFile;
- fontFile->fileName = QLatin1String((const char *)file_value);
- fontFile->indexValue = indexValue;
-
- QFont::Style style = (slant_value == FC_SLANT_ITALIC)
- ? QFont::StyleItalic
- : ((slant_value == FC_SLANT_OBLIQUE)
- ? QFont::StyleOblique
- : QFont::StyleNormal);
- // Note: weight should really be an int but registerFont incorrectly uses an enum
- QFont::Weight weight = QFont::Weight(weightFromFcWeight(weight_value));
-
- double pixel_size = 0;
- if (!scalable)
- FcPatternGetDouble (pattern, FC_PIXEL_SIZE, 0, &pixel_size);
-
- bool fixedPitch = spacing_value >= FC_MONO;
- // Note: stretch should really be an int but registerFont incorrectly uses an enum
- QFont::Stretch stretch = QFont::Stretch(stretchFromFcWidth(width_value));
- QString styleName = style_value ? QString::fromUtf8((const char *) style_value) : QString();
- QPlatformFontDatabase::registerFont(familyName,styleName,QLatin1String((const char *)foundry_value),weight,style,stretch,antialias,scalable,pixel_size,fixedPitch,writingSystems,fontFile);
-// qDebug() << familyName << (const char *)foundry_value << weight << style << &writingSystems << scalable << true << pixel_size;
-
- for (int k = 1; FcPatternGetString(pattern, FC_FAMILY, k, &value) == FcResultMatch; ++k)
- QPlatformFontDatabase::registerAliasToFontFamily(familyName, QString::fromUtf8((const char *)value));
-
-}
-
-void QFontconfigDatabase::populateFontDatabase()
-{
- FcInitReinitialize();
- FcFontSet *fonts;
-
{
FcObjectSet *os = FcObjectSetCreate();
FcPattern *pattern = FcPatternCreate();
@@ -473,8 +371,103 @@ void QFontconfigDatabase::populateFontDatabase()
FcPatternDestroy(pattern);
}
- for (int i = 0; i < fonts->nfont; i++)
- populateFromPattern(fonts->fonts[i]);
+ for (int i = 0; i < fonts->nfont; i++) {
+ if (FcPatternGetString(fonts->fonts[i], FC_FAMILY, 0, &value) != FcResultMatch)
+ continue;
+ // capitalize(value);
+ familyName = QString::fromUtf8((const char *)value);
+ slant_value = FC_SLANT_ROMAN;
+ weight_value = FC_WEIGHT_REGULAR;
+ spacing_value = FC_PROPORTIONAL;
+ file_value = 0;
+ indexValue = 0;
+ scalable = FcTrue;
+
+
+ if (FcPatternGetInteger (fonts->fonts[i], FC_SLANT, 0, &slant_value) != FcResultMatch)
+ slant_value = FC_SLANT_ROMAN;
+ if (FcPatternGetInteger (fonts->fonts[i], FC_WEIGHT, 0, &weight_value) != FcResultMatch)
+ weight_value = FC_WEIGHT_REGULAR;
+ if (FcPatternGetInteger (fonts->fonts[i], FC_WIDTH, 0, &width_value) != FcResultMatch)
+ width_value = FC_WIDTH_NORMAL;
+ if (FcPatternGetInteger (fonts->fonts[i], FC_SPACING, 0, &spacing_value) != FcResultMatch)
+ spacing_value = FC_PROPORTIONAL;
+ if (FcPatternGetString (fonts->fonts[i], FC_FILE, 0, &file_value) != FcResultMatch)
+ file_value = 0;
+ if (FcPatternGetInteger (fonts->fonts[i], FC_INDEX, 0, &indexValue) != FcResultMatch)
+ indexValue = 0;
+ if (FcPatternGetBool(fonts->fonts[i], FC_SCALABLE, 0, &scalable) != FcResultMatch)
+ scalable = FcTrue;
+ if (FcPatternGetString(fonts->fonts[i], FC_FOUNDRY, 0, &foundry_value) != FcResultMatch)
+ foundry_value = 0;
+ if (FcPatternGetString(fonts->fonts[i], FC_STYLE, 0, &style_value) != FcResultMatch)
+ style_value = 0;
+ if(FcPatternGetBool(fonts->fonts[i],FC_ANTIALIAS,0,&antialias) != FcResultMatch)
+ antialias = true;
+
+ QSupportedWritingSystems writingSystems;
+ FcLangSet *langset = 0;
+ FcResult res = FcPatternGetLangSet(fonts->fonts[i], FC_LANG, 0, &langset);
+ if (res == FcResultMatch) {
+ bool hasLang = false;
+ for (int j = 1; j < QFontDatabase::WritingSystemsCount; ++j) {
+ const FcChar8 *lang = (const FcChar8*) languageForWritingSystem[j];
+ if (lang) {
+ FcLangResult langRes = FcLangSetHasLang(langset, lang);
+ if (langRes != FcLangDifferentLang) {
+ writingSystems.setSupported(QFontDatabase::WritingSystem(j));
+ hasLang = true;
+ }
+ }
+ }
+ if (!hasLang)
+ // none of our known languages, add it to the other set
+ writingSystems.setSupported(QFontDatabase::Other);
+ } else {
+ // we set Other to supported for symbol fonts. It makes no
+ // sense to merge these with other ones, as they are
+ // special in a way.
+ writingSystems.setSupported(QFontDatabase::Other);
+ }
+
+#if FC_VERSION >= 20297
+ for (int j = 1; j < QFontDatabase::WritingSystemsCount; ++j) {
+ if (writingSystems.supported(QFontDatabase::WritingSystem(j))
+ && requiresOpenType(j) && openType[j]) {
+ FcChar8 *cap;
+ res = FcPatternGetString (fonts->fonts[i], FC_CAPABILITY, 0, &cap);
+ if (res != FcResultMatch || !strstr((const char *)cap, openType[j]))
+ writingSystems.setSupported(QFontDatabase::WritingSystem(j),false);
+ }
+ }
+#endif
+
+ FontFile *fontFile = new FontFile;
+ fontFile->fileName = QLatin1String((const char *)file_value);
+ fontFile->indexValue = indexValue;
+
+ QFont::Style style = (slant_value == FC_SLANT_ITALIC)
+ ? QFont::StyleItalic
+ : ((slant_value == FC_SLANT_OBLIQUE)
+ ? QFont::StyleOblique
+ : QFont::StyleNormal);
+ // Note: weight should really be an int but registerFont incorrectly uses an enum
+ QFont::Weight weight = QFont::Weight(weightFromFcWeight(weight_value));
+
+ double pixel_size = 0;
+ if (!scalable)
+ FcPatternGetDouble (fonts->fonts[i], FC_PIXEL_SIZE, 0, &pixel_size);
+
+ bool fixedPitch = spacing_value >= FC_MONO;
+ // Note: stretch should really be an int but registerFont incorrectly uses an enum
+ QFont::Stretch stretch = QFont::Stretch(stretchFromFcWidth(width_value));
+ QString styleName = style_value ? QString::fromUtf8((const char *) style_value) : QString();
+ QPlatformFontDatabase::registerFont(familyName,styleName,QLatin1String((const char *)foundry_value),weight,style,stretch,antialias,scalable,pixel_size,fixedPitch,writingSystems,fontFile);
+// qDebug() << familyName << (const char *)foundry_value << weight << style << &writingSystems << scalable << true << pixel_size;
+
+ for (int k = 1; FcPatternGetString(fonts->fonts[i], FC_FAMILY, k, &value) == FcResultMatch; ++k)
+ QPlatformFontDatabase::registerAliasToFontFamily(familyName, QString::fromUtf8((const char *)value));
+ }
FcFontSetDestroy (fonts);
@@ -522,12 +515,14 @@ QFontEngine *QFontconfigDatabase::fontEngine(const QFontDef &f, void *usrPtr)
return 0;
QFontDef fontDef = f;
+ QFontEngineFT *engine;
FontFile *fontfile = static_cast<FontFile *> (usrPtr);
QFontEngine::FaceId fid;
fid.filename = QFile::encodeName(fontfile->fileName);
fid.index = fontfile->indexValue;
bool antialias = !(fontDef.styleStrategy & QFont::NoAntialias);
+ engine = new QFontEngineFT(fontDef);
QFontEngineFT::GlyphFormat format;
// try and get the pattern
@@ -552,19 +547,7 @@ QFontEngine *QFontconfigDatabase::fontEngine(const QFontDef &f, void *usrPtr)
FcDefaultSubstitute(pattern);
FcPattern *match = FcFontMatch(0, pattern, &result);
-
- QFontEngineFT *engine = new QFontEngineFT(fontDef);
-
if (match) {
- //Respect the file and index of the font config match
- FcChar8 *file_value;
- int indexValue;
-
- if (FcPatternGetString(match, FC_FILE, 0, &file_value) == FcResultMatch)
- fid.filename = (const char *)file_value;
- if (FcPatternGetInteger(match, FC_INDEX, 0, &indexValue) == FcResultMatch)
- fid.index = indexValue;
-
QFontEngineFT::HintStyle default_hint_style;
if (f.hintingPreference != QFont::PreferDefaultHinting) {
switch (f.hintingPreference) {
@@ -641,14 +624,12 @@ QFontEngine *QFontconfigDatabase::fontEngine(const QFontDef &f, void *usrPtr)
format = subpixelType == QFontEngineFT::Subpixel_None
? QFontEngineFT::Format_A8 : QFontEngineFT::Format_A32;
engine->subpixelType = subpixelType;
- } else {
+ } else
format = QFontEngineFT::Format_Mono;
- }
FcPatternDestroy(match);
- } else {
+ } else
format = antialias ? QFontEngineFT::Format_A8 : QFontEngineFT::Format_Mono;
- }
FcPatternDestroy(pattern);
@@ -762,7 +743,6 @@ static FcPattern *queryFont(const FcChar8 *file, const QByteArray &data, int id,
QStringList QFontconfigDatabase::addApplicationFont(const QByteArray &fontData, const QString &fileName)
{
QStringList families;
-
FcFontSet *set = FcConfigGetFonts(0, FcSetApplication);
if (!set) {
FcConfigAppFontAddFile(0, (const FcChar8 *)":/non-existent");
@@ -775,24 +755,28 @@ QStringList QFontconfigDatabase::addApplicationFont(const QByteArray &fontData,
FcBlanks *blanks = FcConfigGetBlanks(0);
int count = 0;
- FcPattern *pattern;
+ FcPattern *pattern = 0;
do {
pattern = queryFont((const FcChar8 *)QFile::encodeName(fileName).constData(),
fontData, id, blanks, &count);
if (!pattern)
return families;
+ FcPatternDel(pattern, FC_FILE);
+ QByteArray cs = fileName.toUtf8();
+ FcPatternAddString(pattern, FC_FILE, (const FcChar8 *) cs.constData());
+
FcChar8 *fam = 0;
if (FcPatternGetString(pattern, FC_FAMILY, 0, &fam) == FcResultMatch) {
QString family = QString::fromUtf8(reinterpret_cast<const char *>(fam));
families << family;
}
- populateFromPattern(pattern);
- FcFontSetAdd(set, pattern);
+ if (!FcFontSetAdd(set, pattern))
+ return families;
++id;
- } while (id < count);
+ } while (pattern && id < count);
return families;
}
diff --git a/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm b/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm
index ab2e9c1f1a..76506d12e9 100644
--- a/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm
+++ b/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm
@@ -163,10 +163,10 @@ QCoreTextFontDatabase::QCoreTextFontDatabase()
[fontImage release];
}
QCoreTextFontEngine::defaultGlyphFormat = (font_smoothing > 0
- ? QFontEngineGlyphCache::Raster_RGBMask
- : QFontEngineGlyphCache::Raster_A8);
+ ? QFontEngine::Format_A32
+ : QFontEngine::Format_A8);
#else
- QCoreTextFontEngine::defaultGlyphFormat = QFontEngineGlyphCache::Raster_A8;
+ QCoreTextFontEngine::defaultGlyphFormat = QFontEngine::Format_A8;
#endif
}
diff --git a/src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm b/src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm
index 31a015ae9f..4fe78cb568 100644
--- a/src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm
+++ b/src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm
@@ -74,7 +74,7 @@ static void loadAdvancesForGlyphs(CTFontRef ctfont,
int QCoreTextFontEngine::antialiasingThreshold = 0;
-QFontEngineGlyphCache::Type QCoreTextFontEngine::defaultGlyphFormat = QFontEngineGlyphCache::Raster_RGBMask;
+QFontEngine::GlyphFormat QCoreTextFontEngine::defaultGlyphFormat = QFontEngine::Format_A32;
CGAffineTransform qt_transform_from_fontdef(const QFontDef &fontDef)
{
@@ -155,7 +155,7 @@ void QCoreTextFontEngine::init()
#if defined(Q_OS_IOS) || MAC_OS_X_VERSION_MAX_ALLOWED >= 1070
if (supportsColorGlyphs() && (traits & kCTFontColorGlyphsTrait))
- glyphFormat = QFontEngineGlyphCache::Raster_ARGB;
+ glyphFormat = QFontEngine::Format_ARGB;
else
#endif
glyphFormat = defaultGlyphFormat;
@@ -424,7 +424,7 @@ static void convertCGPathToQPainterPath(void *info, const CGPathElement *element
void QCoreTextFontEngine::addGlyphsToPath(glyph_t *glyphs, QFixedPoint *positions, int nGlyphs,
QPainterPath *path, QTextItem::RenderFlags)
{
- if (glyphFormat == QFontEngineGlyphCache::Raster_ARGB)
+ if (glyphFormat == QFontEngine::Format_ARGB)
return; // We can't convert color-glyphs to path
CGAffineTransform cgMatrix = CGAffineTransformIdentity;
@@ -452,30 +452,67 @@ static void qcoretextfontengine_scaleMetrics(glyph_metrics_t &br, const QTransfo
}
}
-glyph_metrics_t QCoreTextFontEngine::alphaMapBoundingBox(glyph_t glyph, QFixed pos, const QTransform &matrix, GlyphFormat format)
+glyph_metrics_t QCoreTextFontEngine::alphaMapBoundingBox(glyph_t glyph, QFixed subPixelPosition, const QTransform &matrix, GlyphFormat format)
{
if (matrix.type() > QTransform::TxScale)
- return QFontEngine::alphaMapBoundingBox(glyph, pos, matrix, format);
+ return QFontEngine::alphaMapBoundingBox(glyph, subPixelPosition, matrix, format);
glyph_metrics_t br = boundingBox(glyph);
qcoretextfontengine_scaleMetrics(br, matrix);
- br.width = qAbs(qRound(br.width)) + 2;
- br.height = qAbs(qRound(br.height)) + 2;
+ // Normalize width and height
+ if (br.width < 0)
+ br.width = -br.width;
+ if (br.height < 0)
+ br.height = -br.height;
+
+ if (format == QFontEngine::Format_A8 || format == QFontEngine::Format_A32) {
+ // Drawing a glyph at x-position 0 with anti-aliasing enabled
+ // will potentially fill the pixel to the left of 0, as the
+ // coordinates are not aligned to the center of pixels. To
+ // prevent clipping of this pixel we need to shift the glyph
+ // in the bitmap one pixel to the right. The shift needs to
+ // be reflected in the glyph metrics as well, so that the final
+ // position of the glyph is correct, which is why doing the
+ // shift in imageForGlyph() is not enough.
+ br.x -= 1;
+
+ // As we've shifted the glyph one pixel to the right, we need
+ // to expand the width of the alpha map bounding box as well.
+ br.width += 1;
+
+ // But we have the same anti-aliasing problem on the right
+ // hand side of the glyph, eg. if the width of the glyph
+ // results in the bounding rect landing between two pixels.
+ // We pad the bounding rect again to account for the possible
+ // anti-aliased drawing.
+ br.width += 1;
+
+ // We also shift the glyph to right right based on the subpixel
+ // position, so we pad the bounding box to take account for the
+ // subpixel positions that may result in the glyph being drawn
+ // one pixel to the right of the 0-subpixel position.
+ br.width += 1;
+
+ // The same same logic as for the x-position needs to be applied
+ // to the y-position, except we don't need to compensate for
+ // the subpixel positioning.
+ br.y -= 1;
+ br.height += 2;
+ }
return br;
}
-QImage QCoreTextFontEngine::imageForGlyph(glyph_t glyph, QFixed subPixelPosition, bool aa, const QTransform &m)
+QImage QCoreTextFontEngine::imageForGlyph(glyph_t glyph, QFixed subPixelPosition, bool aa, const QTransform &matrix)
{
- glyph_metrics_t br = boundingBox(glyph);
- qcoretextfontengine_scaleMetrics(br, m);
+ glyph_metrics_t br = alphaMapBoundingBox(glyph, subPixelPosition, matrix, glyphFormat);
- bool isColorGlyph = glyphFormat == QFontEngineGlyphCache::Raster_ARGB;
- QImage::Format format = isColorGlyph ? QImage::Format_ARGB32_Premultiplied : QImage::Format_RGB32;
- QImage im(qAbs(qRound(br.width)) + 2, qAbs(qRound(br.height)) + 2, format);
+ bool isColorGlyph = glyphFormat == QFontEngine::Format_ARGB;
+ QImage::Format imageFormat = isColorGlyph ? QImage::Format_ARGB32_Premultiplied : QImage::Format_RGB32;
+ QImage im(br.width.ceil().toInt(), br.height.ceil().toInt(), imageFormat);
im.fill(0);
#ifndef Q_OS_IOS
@@ -503,8 +540,8 @@ QImage QCoreTextFontEngine::imageForGlyph(glyph_t glyph, QFixed subPixelPosition
if (!isColorGlyph) // CTFontDrawGlyphs incorporates the font's matrix already
cgMatrix = CGAffineTransformConcat(cgMatrix, transform);
- if (m.isScaling())
- cgMatrix = CGAffineTransformConcat(cgMatrix, CGAffineTransformMakeScale(m.m11(), m.m22()));
+ if (matrix.isScaling())
+ cgMatrix = CGAffineTransformConcat(cgMatrix, CGAffineTransformMakeScale(matrix.m11(), matrix.m22()));
CGGlyph cgGlyph = glyph;
qreal pos_x = -br.x.truncate() + subPixelPosition.toReal();
diff --git a/src/platformsupport/fontdatabases/mac/qfontengine_coretext_p.h b/src/platformsupport/fontdatabases/mac/qfontengine_coretext_p.h
index 7ef9f0dfbb..1cdac820b6 100644
--- a/src/platformsupport/fontdatabases/mac/qfontengine_coretext_p.h
+++ b/src/platformsupport/fontdatabases/mac/qfontengine_coretext_p.h
@@ -104,7 +104,7 @@ public:
bool supportsTransformation(const QTransform &transform) const;
virtual QFontEngine *cloneWithSize(qreal pixelSize) const;
- virtual int glyphMargin(QFontEngineGlyphCache::Type type) { Q_UNUSED(type); return 0; }
+ virtual int glyphMargin(QFontEngine::GlyphFormat format) { Q_UNUSED(format); return 0; }
static bool supportsColorGlyphs()
{
@@ -122,7 +122,7 @@ public:
}
static int antialiasingThreshold;
- static QFontEngineGlyphCache::Type defaultGlyphFormat;
+ static QFontEngine::GlyphFormat defaultGlyphFormat;
private:
friend class QRawFontPrivate;
diff --git a/src/platformsupport/linuxaccessibility/application.cpp b/src/platformsupport/linuxaccessibility/application.cpp
index 5c8f2e5fe2..ae52ab3b57 100644
--- a/src/platformsupport/linuxaccessibility/application.cpp
+++ b/src/platformsupport/linuxaccessibility/application.cpp
@@ -171,7 +171,7 @@ bool QSpiApplicationAdaptor::eventFilter(QObject *target, QEvent *event)
// FIXME: this is critical, the timeout should probably be pretty low to allow normal processing
int timeout = 100;
bool sent = dbusConnection.callWithCallback(m, this, SLOT(notifyKeyboardListenerCallback(QDBusMessage)),
- SLOT(notifyKeyboardListenerError(QDBusError, QDBusMessage)), timeout);
+ SLOT(notifyKeyboardListenerError(QDBusError,QDBusMessage)), timeout);
if (sent) {
//queue the event and send it after callback
keyEvents.enqueue(QPair<QPointer<QObject>, QKeyEvent*> (QPointer<QObject>(target), copyKeyEvent(keyEvent)));