From 824f01af8ffb39d94807c2b27d1259b9206b3014 Mon Sep 17 00:00:00 2001 From: Shawn Rutledge Date: Wed, 29 Oct 2014 10:30:17 +0100 Subject: fontconfig: do not assume the path to a font file is Latin1-encoded Task-number: QTBUG-42249 Change-Id: Ie5d41ed26a69103991a5189c4f42aa37ac73de26 Reviewed-by: Allan Sandfeld Jensen Reviewed-by: Liang Qi --- src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/platformsupport') diff --git a/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp b/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp index 2b9883eb36..5dec1d0915 100644 --- a/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp +++ b/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp @@ -409,7 +409,7 @@ static void populateFromPattern(FcPattern *pattern) #endif FontFile *fontFile = new FontFile; - fontFile->fileName = QLatin1String((const char *)file_value); + fontFile->fileName = QString::fromLocal8Bit((const char *)file_value); fontFile->indexValue = indexValue; QFont::Style style = (slant_value == FC_SLANT_ITALIC) -- cgit v1.2.3 From f3fb787a32aee43441c5802a406f8dbd1eb0a1d6 Mon Sep 17 00:00:00 2001 From: Dyami Caliri Date: Wed, 29 Oct 2014 16:45:33 -0700 Subject: OS X: fix CFString leaks in mime classes Some CFStringRefs created with CFStringCreate* methods were not being released. Using the QCFString helper class to perform auto release. Change-Id: I36d15c0d35118524089e99ea3cd53c41342d6308 Reviewed-by: Jake Petroules --- src/platformsupport/clipboard/qmacmime.mm | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src/platformsupport') diff --git a/src/platformsupport/clipboard/qmacmime.mm b/src/platformsupport/clipboard/qmacmime.mm index 27a490335b..6fcd19e07b 100644 --- a/src/platformsupport/clipboard/qmacmime.mm +++ b/src/platformsupport/clipboard/qmacmime.mm @@ -48,6 +48,7 @@ #include "qmacmime_p.h" #include "qguiapplication.h" +#include "private/qcore_mac_p.h" QT_BEGIN_NAMESPACE @@ -335,9 +336,9 @@ QVariant QMacPasteboardMimePlainTextFallback::convertToMime(const QString &mimet // Note that public.text is documented by Apple to have an undefined encoding. From // testing it seems that utf8 is normally used, at least by Safari on iOS. const QByteArray &firstData = data.first(); - return QString::fromCFString(CFStringCreateWithBytes(kCFAllocatorDefault, + return QString(QCFString(CFStringCreateWithBytes(kCFAllocatorDefault, reinterpret_cast(firstData.constData()), - firstData.size(), kCFStringEncodingUTF8, false)); + firstData.size(), kCFStringEncodingUTF8, false))); } else { qWarning("QMime::convertToMime: unhandled mimetype: %s", qPrintable(mimetype)); } @@ -410,9 +411,9 @@ QVariant QMacPasteboardMimeUnicodeText::convertToMime(const QString &mimetype, Q // I can only handle two types (system and unicode) so deal with them that way QVariant ret; if (flavor == QLatin1String("public.utf8-plain-text")) { - ret = QString::fromCFString(CFStringCreateWithBytes(kCFAllocatorDefault, + ret = QString(QCFString(CFStringCreateWithBytes(kCFAllocatorDefault, reinterpret_cast(firstData.constData()), - firstData.size(), CFStringGetSystemEncoding(), false)); + firstData.size(), CFStringGetSystemEncoding(), false))); } else if (flavor == QLatin1String("public.utf16-plain-text")) { ret = QString(reinterpret_cast(firstData.constData()), firstData.size() / sizeof(QChar)); -- cgit v1.2.3 From 4b717026d3e6b891ba14ae90394bc81e2514ffda Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pasi=20Pet=C3=A4j=C3=A4j=C3=A4rvi?= Date: Wed, 8 Oct 2014 15:11:57 +0300 Subject: eglfs: ifdef linux specific functionality from convenience functions Because change a093204f07f276bc8e7b4fedf4af0e1369f55734 qeglfshooks_stub.cpp don't compile anymore on any other *nix platform than linux as those functions have been set linux specific only. Change-Id: I339672b1bf2745511076030cc1fe13dc7f2356ff Reviewed-by: Laszlo Agocs --- .../eglconvenience/qeglconvenience.cpp | 31 ++++++++++++++++++---- 1 file changed, 26 insertions(+), 5 deletions(-) (limited to 'src/platformsupport') diff --git a/src/platformsupport/eglconvenience/qeglconvenience.cpp b/src/platformsupport/eglconvenience/qeglconvenience.cpp index 1fdeec3adb..c1a491c80b 100644 --- a/src/platformsupport/eglconvenience/qeglconvenience.cpp +++ b/src/platformsupport/eglconvenience/qeglconvenience.cpp @@ -37,8 +37,8 @@ #ifdef Q_OS_LINUX #include #include -#include #endif +#include #include "qeglconvenience_p.h" @@ -448,10 +448,13 @@ void q_printEglConfig(EGLDisplay display, EGLConfig config) } } -#ifdef Q_OS_LINUX +#ifdef Q_OS_UNIX QSizeF q_physicalScreenSizeFromFb(int framebufferDevice, const QSize &screenSize) { +#ifndef Q_OS_LINUX + Q_UNUSED(framebufferDevice) +#endif const int defaultPhysicalDpi = 100; static QSizeF size; @@ -466,10 +469,11 @@ QSizeF q_physicalScreenSizeFromFb(int framebufferDevice, const QSize &screenSize return size; } - struct fb_var_screeninfo vinfo; int w = -1; int h = -1; QSize screenResolution; +#ifdef Q_OS_LINUX + struct fb_var_screeninfo vinfo; if (framebufferDevice != -1) { if (ioctl(framebufferDevice, FBIOGET_VSCREENINFO, &vinfo) == -1) { @@ -479,7 +483,9 @@ QSizeF q_physicalScreenSizeFromFb(int framebufferDevice, const QSize &screenSize h = vinfo.height; screenResolution = QSize(vinfo.xres, vinfo.yres); } - } else { + } else +#endif + { // Use the provided screen size, when available, since some platforms may have their own // specific way to query it. Otherwise try querying it from the framebuffer. screenResolution = screenSize.isEmpty() ? q_screenSizeFromFb(framebufferDevice) : screenSize; @@ -499,6 +505,9 @@ QSizeF q_physicalScreenSizeFromFb(int framebufferDevice, const QSize &screenSize QSize q_screenSizeFromFb(int framebufferDevice) { +#ifndef Q_OS_LINUX + Q_UNUSED(framebufferDevice) +#endif const int defaultWidth = 800; const int defaultHeight = 600; static QSize size; @@ -513,6 +522,7 @@ QSize q_screenSizeFromFb(int framebufferDevice) return size; } +#ifdef Q_OS_LINUX struct fb_var_screeninfo vinfo; int xres = -1; int yres = -1; @@ -528,6 +538,10 @@ QSize q_screenSizeFromFb(int framebufferDevice) size.setWidth(xres <= 0 ? defaultWidth : xres); size.setHeight(yres <= 0 ? defaultHeight : yres); +#else + size.setWidth(defaultWidth); + size.setHeight(defaultHeight); +#endif } return size; @@ -535,10 +549,14 @@ QSize q_screenSizeFromFb(int framebufferDevice) int q_screenDepthFromFb(int framebufferDevice) { +#ifndef Q_OS_LINUX + Q_UNUSED(framebufferDevice) +#endif const int defaultDepth = 32; static int depth = qgetenv("QT_QPA_EGLFS_DEPTH").toInt(); if (depth == 0) { +#ifdef Q_OS_LINUX struct fb_var_screeninfo vinfo; if (framebufferDevice != -1) { @@ -550,11 +568,14 @@ int q_screenDepthFromFb(int framebufferDevice) if (depth <= 0) depth = defaultDepth; +#else + depth = defaultDepth; +#endif } return depth; } -#endif // Q_OS_LINUX +#endif // Q_OS_UNIX QT_END_NAMESPACE -- cgit v1.2.3 From ca526496c3d5a1aef5d85c76b162adafe1b98627 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9rgio=20Martins?= Date: Thu, 13 Nov 2014 16:08:36 +0000 Subject: Allow to use FT_Library_SetLcdFilter in bundled FreeType. For a default Qt build this change is a NOP, ftlcdfil.c is ifdefed by FT_CONFIG_OPTION_SUBPIXEL_RENDERING, which we don't define. But for users who changed ftoption.h, or are using 3rdparty/freetype/devel/ftoption.h instead of 3rdparty/freetype/include/freetype/config/ftoption.h they can now enable Subpixel rendering without getting a build error. Change-Id: I547e8a20514fcb97e4e56cb0100e9c2ed525f483 Reviewed-by: Allan Sandfeld Jensen Reviewed-by: Konstantin Ritt --- src/platformsupport/fontdatabases/basic/basic.pri | 1 + 1 file changed, 1 insertion(+) (limited to 'src/platformsupport') diff --git a/src/platformsupport/fontdatabases/basic/basic.pri b/src/platformsupport/fontdatabases/basic/basic.pri index 88be809cd8..c2b882ed5a 100644 --- a/src/platformsupport/fontdatabases/basic/basic.pri +++ b/src/platformsupport/fontdatabases/basic/basic.pri @@ -17,6 +17,7 @@ contains(QT_CONFIG, freetype) { $$QT_FREETYPE_DIR/src/base/ftbbox.c \ $$QT_FREETYPE_DIR/src/base/ftdebug.c \ $$QT_FREETYPE_DIR/src/base/ftglyph.c \ + $$QT_FREETYPE_DIR/src/base/ftlcdfil.c \ $$QT_FREETYPE_DIR/src/base/ftinit.c \ $$QT_FREETYPE_DIR/src/base/ftmm.c \ $$QT_FREETYPE_DIR/src/base/fttype1.c \ -- cgit v1.2.3 From edd436a268ea038322735174fddb6da3a29d147d Mon Sep 17 00:00:00 2001 From: David Faure Date: Thu, 20 Nov 2014 10:15:23 +0100 Subject: OSX: implement QFontMetrics::maxWidth(). MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit CoreText doesn't seem to provide us with a "maximum advance" value, but 0 is really wrong, it leads to QLineEdit::minimumSizeHint() being 0 since it's based on maxWidth(). It even led to a negative min width with setTextMargins(-1, 0, -1, 0). Change-Id: I4faf8ecfb6d91e9dff66ec63651d003014503cb4 Reviewed-by: Konstantin Ritt Reviewed-by: Tor Arne Vestbø --- src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/platformsupport') diff --git a/src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm b/src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm index 2859886d59..23fe48b493 100644 --- a/src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm +++ b/src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm @@ -353,7 +353,10 @@ QFixed QCoreTextFontEngine::averageCharWidth() const qreal QCoreTextFontEngine::maxCharWidth() const { - return 0; + // ### FIXME: 'W' might not be the widest character, but this is better than nothing + const glyph_t glyph = glyphIndex('W'); + glyph_metrics_t bb = const_cast(this)->boundingBox(glyph); + return bb.xoff.toReal(); } qreal QCoreTextFontEngine::minLeftBearing() const -- cgit v1.2.3