summaryrefslogtreecommitdiffstats
path: root/src/gui/text/qfontengine_mac.mm
Commit message (Collapse)AuthorAgeFilesLines
* Better handling of invalid font tablesHEAD4.8Eskil Abrahamsen Blomfeldt2015-10-231-6/+5
| | | | | | | | | | | | | | | Specifically when reading files with broken cmap tables, we could get some undeterministic results. We handle this more gracefully by verifying that the offsets are sane and bailing out early if not. This replaces the current pattern throughout the font engine for consistency. This is a back-port of 4a1e5dbade4bab55f39bd368480dcca9a11e4b38 from Qt 5. Change-Id: If4172b9ef0808801c8e27ffaad962535afe572ed Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* Update copyright headersAkseli Salovaara2015-03-311-13/+13
| | | | | | | | | Qt copyrights are now in The Qt Company, so we could update the source code headers accordingly. In the same go we should also fix the links to point to qt.io. Change-Id: I7e3e96183e073877b46bc8071b2ccae19e69426b Reviewed-by: Jani Heikkinen <jani.heikkinen@theqtcompany.com>
* Updated year in copyright headerKai Koehne2014-03-261-1/+1
| | | | | | | | | | | | | | | | | | find . -path '*/3rdparty/*' -prune -o -type f -print | xargs -L1 sed -i -E 's/Copyright(.*) 2013 Digia/Copyright\1 2014 Digia/g' Manually patched files: demos/spectrum/3rdparty/fftreal/fftreal_wrapper.h demos/spectrum/3rdparty/fftreal/fftreal_wrapper.cpp src/3rdparty/s60/eiksoftkeyimage.h tools/qdoc3/test/qt-project.qdocconf tests/auto/qsharedpointer/nontracked.h tests/auto/qsharedpointer/nontracked.cpp Change-Id: I3f9074923b4d6bd4666258ab04f01476cc6e901c Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Sergio Ahumada <sahumada@blackberry.com> Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Update copyright year in Digia's license headersSergio Ahumada2013-01-131-1/+1
| | | | | | Change-Id: I52bf8ef0447b701b4ebf7d7d240013a72adb9425 Reviewed-by: Akseli Salovaara <akseli.salovaara@digia.com> Reviewed-by: Sergio Ahumada <sergio.ahumada@digia.com>
* Change copyrights from Nokia to DigiaIikka Eklund2012-09-291-24/+24
| | | | | | | | Change copyrights and license headers from Nokia to Digia Change-Id: I280c0a575987d1770e354b4948f1d4d767d711ea Reviewed-by: Simo Fält <simo.falt@digia.com> Reviewed-by: Sergio Ahumada <sergio.ahumada@digia.com>
* Update contact information in license headers.Sergio Ahumada2012-08-011-2/+2
| | | | | | | | | | | | | - Replace Nokia contact email address with Qt Project website. - Remove "All rights reserved" line from license headers. As in the past, to avoid rewriting various autotests that contain line-number information, an extra blank line has been inserted at the end of the license text to ensure that this commit does not change the total number of lines in the license header. Change-Id: Ie7ba62011752fcb149b99b26317c54f2a0cfa931 Reviewed-by: Jason McDonald <jason.mcdonald@nokia.com>
* Update year in Nokia copyright messages.Jason McDonald2012-01-111-1/+1
| | | | | | | | | Simple search and replace. This commit doesn't touch 3rd-party files, nor translations (where the change is not so simple and will be handled in a separate commit). Change-Id: I4e48513b8078a44a8cd272326685b25338890148 Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Fix QFont related compilation errors on Mac OSX CarbonSamuli Piippo2011-11-011-1/+1
| | | | | | | Task-number: QTBUG-22318 Merge-request: 1434 Reviewed-by: Jiang Jiang <jiang.jiang@nokia.com>
* Replace explicit surrogate handlers by inline methods of QChar classsuzuki toshiya2011-09-071-15/+8
| | | | | Merge-request: 1284 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
* Update licenseheader text in source files for qt4.8Jyri Tahtela2011-05-131-17/+17
| | | | | | | Updated version of LGPL and FDL licenseheaders. Apply release phase licenseheaders for all source files. Reviewed-by: Trust Me
* Use maximum ascent/descent/leading from fallback fonts in shapingJiang Jiang2011-04-271-1/+1
| | | | | | | | | | | | | | | When shaping a QScriptItem with a multi font engine, currently we only take the ascent/descent/leading from the primary (first) font engine in that multi font engine, however, subsequent engines used during shaping may have larger ascent/descent/leading, disregarding them may cause clipping issues in some cases. It's fixed by checking each font engine used in the shaping process and take the maximum value instead of the first one. On ATSUI we merely make it compile. Task-number: QTBUG-16719 Reviewed-by: Eskil
* Long live QRawFont!Eskil Abrahamsen Blomfeldt2011-04-151-21/+0
| | | | | | | | | | | | | | The QGlyphs API was initially attempted with a bastardization of QFont which was meant to encapsulate a single, physical font instance (a QFontEngine) where a set of glyph indexes would make sense. This is not how QFont was intended to be used, and it caused several issues. At the same time, the requirement for loading a font from ttf/otf data and be able to access it and use it without polluting the rest of the process with the font arose. To support these two APIs we introduce QRawFont, which is an abstraction on top of a single physical font. Done-with: Jiang Jiang
* Merge remote branch 'origin/4.7' into qt-master-from-4.7Olivier Goffart2011-01-171-1/+1
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: examples/webkit/imageanalyzer/imageanalyzer.h examples/webkit/imageanalyzer/mainwindow.h mkspecs/unsupported/qws/linux-x86-openkode-g++/qplatformdefs.h src/corelib/io/qfsfileengine_iterator_unix.cpp src/corelib/io/qfsfileengine_iterator_win.cpp src/corelib/kernel/qcoreapplication.cpp src/network/access/qnetworkaccessdatabackend.cpp src/plugins/bearer/connman/qconnmanservice_linux.cpp src/plugins/platforms/openvglite/qwindowsurface_vglite.h src/s60installs/bwins/QtCoreu.def src/s60installs/eabi/QtCoreu.def src/s60installs/s60installs.pro tools/assistant/tools/assistant/helpviewer_qwv.h tools/qdoc3/test/qt-html-templates.qdocconf
| * Update copyright year to 2011.Jason McDonald2011-01-111-1/+1
| | | | | | | | Reviewed-by: Trust Me
* | Merge branch 'master' of scm.dev.nokia.troll.no:qt/qtGunnar Sletta2010-11-191-0/+1
|\ \ | | | | | | | | | | | | | | | Conflicts: src/gui/text/qfontengine_mac.mm src/gui/text/qfontengine_p.h
| * | Fix bidi PDF mark support in Core Text shaperJiang Jiang2010-11-161-0/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When Core Text shaping a string like LRE ... PDF, it won't leave a zero width glyph for the PDF mark, it is not consistent with HarfBuzz and will cause issues in our text engine (the last glyph of the string will be considered as a ligature). This hack appended such a zero width glyph to fix that. Reviewed-by: Eskil
| * | Fix text rendering offset for raster engine on MacJiang Jiang2010-11-121-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since the bounding box returned by Core Text in smaller than the actual glyph rendered, we have 2 pixels padding around it, as a result, we have to leave 1 pixel above the glyph in glyph cache, so we need to put the text origin 1 pixel lower to draw it. Task-number: QTBUG-15223, QTBUG-15230, QTBUG-15243 Reviewed-by: Gunnar Sletta
| * | Fix for font engines that don't support subpixel positioningJiang Jiang2010-11-111-1/+1
| | | | | | | | | | | | Reviewed-by: aavit
| * | Support glyph subpixel positioning without subpixel renderingJiang Jiang2010-11-101-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously subpixel positioning was only used when subpixel rendering is enabled (glyphType == Raster_RGBMask), however, it does not necessarily require that and for Mac OS X it will keep using subpixel positioning even when LCD font smoothing (subpixel rendering) is turned off. To maintain consistency when switching to raster, we should support subpixel positioning in this case. Task-number: QTBUG-5053 Reviewed-by: Jørgen Lind
* | | Moving QCoreTextFontEngine with related classes into own fileJørgen Lind2010-10-281-676/+4
|/ / | | | | | | | | | | The declaration of QCoreTextFontEngine was ifdefed in qfontengine_p.h. So was QMacFontEngine. I have moved them into their own files (qfontengine_coretext_p.h and qfontengine_mac_p.h).
* | Merge remote branch 'origin/4.7' into master-from-4.7Rohan McGovern2010-10-051-2/+1
|\|
| * Moving QPdf::stripSpecialCharacter to fontengineJørgen Lind2010-09-301-2/+1
| | | | | | | | | | | | | | 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>
* | Fix crash in Mac font loadingJiang Jiang2010-09-141-5/+2
| | | | | | | | | | | | | | | | | | | | | | Commit f2f6330d915cbe3d0989ad280738ed0a6954cd35 introduced an extra CFRelease of QCFString, which will cause crash. Also, since we are not refering to ATS font in Cocoa code anymore, conversion of CTFontRef to CGFontRef should not rely on platform fonts, we use CTFontCopyGraphicsFont to get the corresponding CGFontRef directly. Reviewed-by: Eskil Abrahamsen Blomfeldt
* | Fix Core Text font loading for certain Mac FontsJiang Jiang2010-09-101-4/+1
| | | | | | | | | | | | | | | | | | | | | | Font names enumerated by Core Text cannot be found by ATSFontFamilyFindFromName because ATS is expecting native names instead of the names returned by Core Text. This patch get rid of ATS font matching code in Cocoa code path to simplify the code, avoid deprecation warnings (in the future) and fix this issue. Task-number: QTBUG-11145 Reviewed-by: Eskil
* | Support sub pixel positioning of glyphs in raster engineEskil Abrahamsen Blomfeldt2010-09-091-7/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For the raster engine to provide the same quality of text rendering as the native engine on Mac Cocoa, we need to support rendering to different sub pixel positions for each glyph. The number of subpixel positions is arbitrary and has to be detected, but it's usually three or four. Each position will give slightly different coverages inside the pixel and thus different rasterizations. Other font engines which support sub pixel positioning of glyphs can provide the same functionality by implementing supportsSubPixelPositions() to return true, and then adding the subPixelPosition argument to the x coordinate used in alphaRGBMapForGlyph(). Task-number: QTBUG-5053 Reviewed-by: Jiang Jiang
* | Clean up and clarify Mac font engine codeJiang Jiang2010-08-311-0/+1
| | | | | | | | Reviewed-by: Eskil
* | Merge remote branch 'origin/4.7' into qt-master-from-4.7Olivier Goffart2010-08-301-8/+9
|\| | | | | | | | | | | | | Conflicts: qmake/generators/win32/msbuild_objectmodel.cpp qmake/generators/win32/msvc_vcxproj.cpp tests/auto/qnetworkreply/tst_qnetworkreply.cpp
| * Correct last right bearing in boundingBox(glyphs)Jiang Jiang2010-08-271-8/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Commit 07880542ecc479807c23c5646d263135240822ff introduced regression to QFontMetrics::boundingRect and QTextEngine::boundingBox on FT, XLFD and QPF font engine. Because on these platforms, rightBearing of the last glyphs is already removed from the width returned in glyph_metrics_t. Subtracting that rightBearing twice will cause the resulting boundingBox smaller than expected. This patch fix this by removing last right bearing accounting code from generic QTextEngine::boundingBox, instead, we put it into font engines that need them: QFontEngineWin, QCoreTextFontEngine, QFontEngineMac, QFontEngineS60 and QFontEngineQWS. So that the resulting width should be correct on all platforms without introducing any performance penalties. Task-number: QTBUG-6854, QTBUG-12950 Reviewed-by: Eskil
* | Merge remote branch 'origin/4.7' into qt-master-from-4.7Olivier Goffart2010-08-131-3/+29
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/gui/painting/qpainter.cpp src/gui/text/qtextengine.cpp tests/auto/qimage/tst_qimage.cpp tests/auto/qpainter/tst_qpainter.cpp tools/qdoc3/test/assistant.qdocconf tools/qdoc3/test/designer.qdocconf tools/qdoc3/test/linguist.qdocconf tools/qdoc3/test/qmake.qdocconf tools/qdoc3/test/qt-build-docs.qdocconf tools/qdoc3/test/qt-html-templates.qdocconf tools/qdoc3/test/qt-html-templates_zh_CN.qdocconf tools/qdoc3/test/qt.qdocconf
| * Fix Japanese characters not displayed in webkit on Mac Cocoa 64 (Regression)Simon Hausmann2010-08-021-3/+29
| | | | | | | | | | | | | | | | | | Our stringToCMap implementation for CoreText that bypasses the shaping needs to have basic support for font cascading / glyph substitution. We now use CTFontCreateForString to determine the substitute font for missing glyphs. Task-number: QTBUG-12411 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@nokia.com>
* | Merge remote branch 'origin/4.7' into qt-master-from-4.7Thiago Macieira2010-07-011-2/+25
|\| | | | | | | | | | | | | | | | | Conflicts: bin/syncqt src/gui/text/qtextlayout.cpp tools/assistant/tools/assistant/helpviewer_qwv.cpp tools/assistant/tools/assistant/helpviewer_qwv.h tools/configure/configureapp.cpp
| * Improve text performance with QtWebKit in Qt 4.7Simon Hausmann2010-06-231-1/+23
| | | | | | | | | | | | | | | | Implemented the straight string-to-glyph conversion in the core text font engine, that bypasses the shaping. This is used by the fast text code path in QtWebKit. Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com>
| * Fix crash on Mac OS X when drawing text with Qt::TextBypassShaping setTor Arne Vestbø2010-06-161-1/+2
| | | | | | | | | | | | | | On Mac we end up in a code path where logClusters is 0, and the fallback path for when CoreText fails to shape text didn't take this into account. Reviewed-by: Simon Hausmann
* | New class: QGlyphsEskil Abrahamsen Blomfeldt2010-06-041-0/+27
|/ | | | | | | | | | | | | Introduce an API to access glyph indexes in a font directly. A bug was discovered during this work, where different hinting flags in loadGlyph() and loadGlyphMetrics() would make the metrics in the two functions different, thus causing drawCachedGlyphs() (which uses loadGlyphMetrics() indirectly) to use different metrics than the standard drawTextItem() code path (which uses loadGlyph()). The bug was visible in the tst_QGlyphs::drawExistingGlyphs() test. Reviewed-by: Simon Hausmann
* Fix platform regression: Support QFont::setStretch() on CocoaEskil Abrahamsen Blomfeldt2010-05-191-5/+13
| | | | | | | | QFont::setStretch() would previously have no effect on Mac OS X/Cocoa. Task-number: QTBUG-10585 Reviewed-by: Eskil Done-by: Andy
* Fix crash when CoreText fails to shape text for usTor Arne Vestbø2010-04-271-2/+13
| | | | | | | As a fallback we assume one glyph per character and manually build a list of invalid glyphs with zero advance. Reviewed-and-inspired-by: Simon Hausmann
* Round instead of ceil font metrics when ForceIntegerMetrics is enabledTor Arne Vestbø2010-03-261-24/+24
| | | | | | | This matches how both the simple and complex paths in WebKit handle float to integer conversion, and looks much better. Reviewed-by: Eskil
* Fix glyph advance on Mac/CarbonEskil Abrahamsen Blomfeldt2010-03-251-10/+43
| | | | | | | | | | | | | Device metrics was turned on for Mac/Carbon to work around a bug in WebKit that required the font engine to report only integer values. This in turn caused positioning of glyphs to be slightly off compared to native applications. The bug has been fixed in WebKit, so now we can turn off the device metrics flag. Since we are now reporting fractional values as well, we need to round the numbers when the ForceIntegerMetrics style strategy flag is set. Task-number: qtbug-5529 Reviewed-by: Trond
* Add QFont::ForceIntegerMetrics style strategy flagEskil Abrahamsen Blomfeldt2010-03-241-10/+39
| | | | | | | | | | | | | | | | | | | WebKit uses integers internally to deal with positioning and sizing of text objects, but on Mac, Qt uses floating point values. This caused a discrepancy between the size used by WebKit to position text objects and the actual size of the objects when rendered by Qt. The problem was so bad that it has been holding back fixes for other bugs in the mac font engine since these would make the WebKit bug more visible. To work around the problem, we introduce a StyleStrategy flag in QFont which allows you to force the use of integers all over the line. This makes text rendering slightly different from native applications, but should fix several issues with WebKit on Mac. The WebKit-part of this patch will be submitted up-stream. Reviewed-by: Simon Hausmann Reviewed-by: Prasanth
* Cocoa: Fix misaligned text between format changesEskil Abrahamsen Blomfeldt2010-03-101-1/+1
| | | | | | | | | | | | | | | | | | | This reverts part of commit e008504b5ec34975e34adf3b1a2b7170d0e4dd38. The original commit aimed to round up all fractional numbers for the font to "improve appearance". Rounding up the last advance of a set of advances in a glyph layout, however, breaks text layout completely, since the layout of text will be different depending on how many text lines is used to represent it (since the last glyph in each line will have a higher advance than the others.) This was e.g. visible in Qt Creator when turning on whitespace visualization, as all spaces then created a format change, thus a new text line in the text layout, and hence an increase of X pixels in the positioning of the text after the space, where 0.0 < X < 1.0. I see no negative results of removing the rounding, but if there are any problems, it has to be fixed in the usage of the advances not in the advances themselves. Task-number: QTCREATORBUG-381, QTBUG-8791 Reviewed-by: mae
* Update copyright year to 2010Jason McDonald2010-01-071-1/+1
| | | | Reviewed-by: Trust Me
* Fix vertical text centering on Mac OS XEskil Abrahamsen Blomfeldt2009-12-151-2/+6
| | | | | | | | | | | | | | Change 04d18b38 fixed the windows and ft font engines so that the height reported in QFontMetrics is now correct, but this make vertical text centering one off as the platform defaults is to round down rather than up when the vertical position of the text is in the middle of a pixel. When this was fixed in change 1de8a5b, the vertical centering broke on Mac, since it still reported a too great font height. This patch applies the same hack to the mac font engines to report the correct font height. Task-number: QTBUG-6770 Reviewed-by: joerg
* Cocoa: Synthesize italic text correct way when adding glyphs to pathEskil Abrahamsen Blomfeldt2009-10-261-1/+1
| | | | | | | | | | | | On Mac OS X, Cocoa, we would synthesize italics on the text by slanting it in the incorrect direction (so it leaned to the left) when generating a path from the text, e.g. when printing. The patch makes the text slant the correct way, and the logic now becomes identical with the synthesized italics in the draw() function. Task-number: QTBUG-4969 Reviewed-by: Trond
* Fix bug QTBUG-4848Sarah Smith2009-10-201-4/+10
| | | | | | | | Make the shapeText function return numGlyphs properly - its not always the same as length of string. Task-number: QTBUG-4848 Reviewed-by: Rhys Weatherley
* Fixed bad glyph rendering under cocoaGunnar Sletta2009-10-191-17/+45
| | | | | | The positioning is still wrong, but now it at least the glyphs are ok Reviewed-by: msorvig
* Fixed text positioning when printing in HighResolution on Mac OS XGunnar Sletta2009-10-091-3/+4
| | | | Reviewed-by: Richard
* Merge branch '4.5' of scm.dev.nokia.troll.no:qt/qt into 4.6Simon Hausmann2009-09-241-0/+2
|\ | | | | | | | | | | | | Conflicts: examples/webkit/formextractor/formextractor.pro mkspecs/features/qt.prf src/gui/painting/qpaintengineex.cpp
| * Fixed text drawing regression in Assistant.Trond Kjernåsen2009-09-241-0/+2
| | | | | | | | | | | | | | | | Revert parts of adf322c514a5781dcb9ec304d44229fa47d5e8b3 to get this to work as in 4.5.2 again. What the original patch fixed, we don't really know.. Reviewed-by: Simon Hausmann
| * Update license headers again.Jason McDonald2009-09-081-4/+4
| | | | | | | | Reviewed-by: Trust Me
* | Update license headers again.Jason McDonald2009-09-091-4/+4
| | | | | | | | Reviewed-by: Trust Me