summaryrefslogtreecommitdiffstats
path: root/src/gui/text/qharfbuzzng.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Set point size, not just pixel size, when creating HarfBuzz fonts for shapingTor Arne Vestbø2018-12-161-0/+2
| | | | | | | | | | | | | | | | Otherwise HarfBuzz will fall back to using default font sizes, e.g. 12.0 in the CoreText backend. hb_coretext_font_create() already does the right thing, but we're not using that function, we create the hb_font_t ourselves in _hb_qt_font_create(). The mismatch didn't matter for vector-based fonts as the metrics (presumably) scale linearly, but for bitmap-based font such as Emojis they don't, and we ended up with advances that were way too large (increasingly so the larger the font point size). Change-Id: I4781dda965c745853732026da91590d8506ec3f5 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Remove macOS specific path that causes reverse vertical advanceAllan Sandfeld Jensen2018-11-221-4/+0
| | | | | | | | | This special case of macOS appears to be outdated and now causes a bug. Change-Id: Ie9c074bb69eda7abfe3d123f807b517334cc2958 Fixes: QTBUG-69803 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io> Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
* Update most Unicode data to version 10.0Lars Knoll2018-01-031-1/+15
| | | | | | | | | | The text segmentation data is not being updated in this change, as it requires additional code changes. Updating those will come in a follow-up commit. Change-Id: I5d6b6bc96044e8dd0c25cf6f79756e7f68bf6e7c Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com> Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* Bump the minimum required version for harfbuzz to 1.6.0Lars Knoll2017-12-301-24/+0
| | | | | | | | This is the first version that supports Unicode 10.0.0, which we now require for Qt. Change-Id: Iff3cb757eb7d97dace5649262c337a4ed1145199 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Update HB-to-Qt bridging code to deal with latest HBKonstantin Ritt2017-02-021-62/+55
| | | | | | | | | | | | | - add support for hb_font_get_{nominal,variation}_glyph() callback introduced in 1.2.3 - add support for hb_get_font_h_extents callback introduced in 1.1.3 - do not register dummy callbacks for which HB has a bit faster implementation (since 1.1.2) - mark funcs object immutable for the sake of safety Change-Id: I05281b01d012aed32030ec7cff41a456b5540179 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* QFontEngine: use RAII for font_, face_ membersMarc Mutz2016-03-041-14/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Wrap the pairs of (void *ptr, void (*dtor)(void*)) in essentially a std::unique_ptr. This simplifies code and provides the correct implicit destruction, so we can drop the explicit glyph-cache clear()ing in ~QFontEngine(), leaving that job to ~QLinkedList. A subsequent change will turn the QLinkedList into a C array, the clearing of which would otherwise cause excessive code bloat. Since we can't use std::unique_ptr, yet, provide a hand-rolled replacement for now, marking it for replacement with unique_ptr once we can use it. Make that a local type instead of providing a Qt-wide unique_ptr so we don't accidentally lock ourselves into a half-baked std clone we can't get rid of anymore. To prepare unique_ptr use with the same type-erased deleter (function pointer) as now, replace a nullptr destroy_function with a no-op function, so ~unique_ptr doesn't crash when we port to it later. Because QFreetypeFace contains the same construct and shares payloads with QFontEngine, use the Holder there, too. Even saves 150b in text size on optimized GCC 5.3 AMD64 builds. Change-Id: I5ca11a3e6e1ff9e06199124403d96e1b280f3eb2 Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com> Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* Updated license headersJani Heikkinen2016-01-151-14/+20
| | | | | | | | | | | From Qt 5.7 -> LGPL v2.1 isn't an option anymore, see http://blog.qt.io/blog/2016/01/13/new-agreement-with-the-kde-free-qt-foundation/ Updated license headers to use new LGPL header instead of LGPL21 one (in those files which will be under LGPL v3) Change-Id: I046ec3e47b1876cd7b4b0353a576b352e3a946d9 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* Update Unicode data & algorithms up to v8.0Konstantin Ritt2015-11-051-1/+9
| | | | | | | | | | | | | | | | | | | * Georgian lari currency symbol * A large collection of CJK unified ideographs * Emoji symbols and symbol modifiers * Letters to support the Ik language in Uganda, Kulango in the Côte d’Ivoire, and other languages of Africa * A set of lowercase Cherokee syllables, forming case pairs with the existing Cherokee characters * The Ahom script for support of the Tai Ahom language in India * Arabic letters to support Arwi—the Tamil language written in the Arabic script For more details, see http://www.unicode.org/versions/Unicode8.0.0/ [ChangeLog][QtCore] Unicode data updated to v.8.0 Change-Id: If255f95c9c45655b721369a116299da3cabbba0a Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* Update Unicode data up to v7.0Konstantin Ritt2015-03-271-1/+40
| | | | | | | | | | | | | | | | | | | | | | * Two newly adopted currency symbols: the Azerbaijan manat and the Russia ruble * Pictographic symbols (including many emoji), geometric symbols, arrows, and ornaments originating from the Wingdings and Webdings sets * Twenty-three new lesser-used and historic scripts extending support for written languages of North America, China, India, other Asian countries, and Africa * Letters used in Teuthonista and other transcriptional systems, and a new notational set, Duployan For more details, see http://www.unicode.org/versions/Unicode7.0.0/ The Properties struct's .*Diff members were narrowed down to signed 15 bits and the unicodeVersion has been expanded to 8 bits. [ChangeLog][QtCore] Unicode data updated to v.7.0 Change-Id: I93ab6f79fa3b05f61abc7279f1d046834c1c1a0b Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Update copyright headersJani Heikkinen2015-02-111-7/+7
| | | | | | | | | | | | | | | | | | 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. Outdated header.LGPL removed (use header.LGPL21 instead) Old header.LGPL3 renamed to header.LGPL3-COMM to match actual licensing combination. New header.LGPL-COMM taken in the use file which were using old header.LGPL3 (src/plugins/platforms/android/extract.cpp) Added new header.LGPL3 containing Commercial + LGPLv3 + GPLv2 license combination Change-Id: I6f49b819a8a20cc4f88b794a8f6726d975e8ffbe Reviewed-by: Matti Paaso <matti.paaso@theqtcompany.com>
* Minor improvement to Qt-HB bridging codeKonstantin Ritt2014-12-291-12/+12
| | | | | | | Replace C-style cast with static_cast for casts from void*. Change-Id: I4d6c602037e70afe2746a179a31fea4c5043c3d5 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Report font tables are R/O blobsKonstantin Ritt2014-12-291-1/+1
| | | | | | | There is no point in modifying font tables, so mark them RO for clarity. Change-Id: I8ddbda9ace9c5a0eeabc0c5e5f64558060b5ee69 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Fix hb_face leaking in QFontEngineFTKonstantin Ritt2014-11-151-4/+2
| | | | | | | | | | | | | | Since HarfBuzz-old's HB_Face doesn't support ref-counting, it is impossible to keep the same behavior as for NG's ref-counted hb_face when we're going to reparent the data of unknown type in QFontEngineFT. We should either not release the object returned by harfbuzzFace(), or introduce ref-counting for HB-old's HB_Face. Stop referencing HB-NG's objects on access for now and thus avoid a need to release them manually. Task-number: QTBUG-42674 Change-Id: Ia21e7ba9c17185796b0dd98c2c27d02566f2a701 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>
* Update license headers and add new license filesMatti Paaso2014-09-241-19/+11
| | | | | | | | | - Renamed LICENSE.LGPL to LICENSE.LGPLv21 - Added LICENSE.LGPLv3 - Removed LICENSE.GPL Change-Id: Iec3406e3eb3f133be549092015cefe33d259a3f2 Reviewed-by: Iikka Eklund <iikka.eklund@digia.com>
* [HB] Ensure we always working with non-multi font engineKonstantin Ritt2014-04-041-4/+4
| | | | | Change-Id: If88385d4cecdc527b7952d34e48f7ba889173c6c Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* [HarfBuzz-NG] Optimize Unicode de-/composition callbacksKonstantin Ritt2014-03-251-33/+26
| | | | | | | Use QStringIterator instead of QString::toUcs4() and escape earlier. Change-Id: If80b886bece1a43af7078e8cdc9c31babf602731 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Use QStringIterator instead of homebrewKonstantin Ritt2014-03-101-9/+5
| | | | | | | Task-number: QTBUG-15664 Change-Id: I1ed3eb04ddd822e57a4d993af656dfe283f3af1a Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Optimize glyph lookups with QFontEngine::glyphIndex(uint)Konstantin Ritt2014-03-051-27/+1
| | | | | | Change-Id: I56c7e727f3d9b08195f38939106620c744c6eaf0 Reviewed-by: Lars Knoll <lars.knoll@digia.com> Reviewed-by: BogDan Vatra <bogdan@kde.org>
* Unify QFontEngine::getSfntTableData() behavior on all platformsKonstantin Ritt2014-03-021-1/+1
| | | | | | | | | | | | Being a most significant method in the font API, getSfntTableData() must behave in exactly the same way on all platforms. Briefly, it must return true if the table exists in the font, despite the other params, and always stores the table data length in 'length' param, thus reporting the amount of bytes actually needed to store the table data in a buffer. Change-Id: I7a15465020c1ea818ea46a05ea3b9b7e1cd60d14 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Update HarfBuzz-NG path on MacKonstantin Ritt2014-02-131-0/+4
| | | | | | | | | | 84be1bd4d3ed8d2d9e65301649bc841ea4197fe2 has changed the stored data type from QFontEngine to QFontEngine::FaceData. Update the implementation and revert changing the y_scale sign on non-Mac (aka fix-up 2d576f79f748ca4c9bb54634f0fd44fa207a2248). Change-Id: I4180257bc8f610fb014fd2a2ad6f8fdceece2f13 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Merge "Merge remote-tracking branch 'origin/stable' into dev" into ↵Frederik Gladhorn2014-02-111-7/+15
|\ | | | | | | refs/staging/dev
| * Merge remote-tracking branch 'origin/stable' into devFrederik Gladhorn2014-02-071-7/+15
| |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/gui/kernel/qguiapplication.cpp src/plugins/platforms/android/androidjnimain.cpp src/plugins/platforms/android/qandroidplatformintegration.cpp src/plugins/platforms/android/qandroidplatformintegration.h src/plugins/platforms/android/qandroidplatformopenglcontext.cpp src/plugins/platforms/cocoa/qcocoawindow.h src/plugins/platforms/cocoa/qcocoawindow.mm src/plugins/platforms/xcb/qxcbconnection_xi2.cpp src/sql/doc/src/sql-driver.qdoc src/widgets/widgets/qtoolbararealayout.cpp Change-Id: Ifd7e58760c3cb6bd8a7d1dd32ef83b7ec190d41e
| | * Fix crash due to a stale pointer dereferencingKonstantin Ritt2014-01-161-7/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The HB face caching mechanism introduced in 227e9a40cfeb7e00658cd3 wasn't complete due that fact that HB-NG doesn't parse the entire font table at once but rather references a table on-demand. This incompleteness caused a crash in case the engine doesn't get cached or when it removed from the cache and then re-used. Task-number: QTBUG-36099 Change-Id: I7816836107655ce7cf6eb9683bb5dc7f892f9cd1 Reviewed-by: Lisandro Damián Nicanor Pérez Meyer <perezmeyer@gmail.com> Reviewed-by: Michael Krasnyk <michael.krasnyk@gmail.com> Reviewed-by: Lars Knoll <lars.knoll@digia.com> Reviewed-by: Allan Sandfeld Jensen <allan.jensen@digia.com>
* | | Optimize stringToCMap() usageKonstantin Ritt2014-02-071-13/+10
|/ / | | | | | | | | | | | | | | | | | | | | | | CMAP guarantees there is 1:1 mapping between the Unicode code points array and the glyph indexes array, which means the QString length always greater than or equal to a sufficient glyph indexes array length. Simply add some asserts and improve the memory consumption and the performance where possible. Change-Id: I0bc8cdba5f86c1c0ba9e79c8d5f96cbe56ec463e Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* | Make HarBuzz-NG the default shaper on MacKonstantin Ritt2014-01-311-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since we dropped all platform-related shapers during the QPA refactoring, thus making HarfBuzz the only shaper on all platforms, we can not deal with AAT-capable fonts anymore. HarBuzz-NG now supports it's own shaper backend infrastructure, so the decision was to enable HB's CoreText shaper backend on Mac and simply make HB-NG the default shaper there. Task-number: QTBUG-36056 Change-Id: If22e24fd5cc00c25952934332a2f4123f38135a4 Reviewed-by: Lars Knoll <lars.knoll@digia.com> Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
* | Get rid of QGlyphLayout::advances_yKonstantin Ritt2014-01-301-10/+6
|/ | | | | | | | | | | | | | | ...and thus consume 4 bytes less per glyph and increase the performance a bit. It seems, the only CTFontGetAdvancesForGlyphs() returns both x and y advances, though y advances are always equal to 0 for horizontal orientation and x advances are always equal to 0 for vertical orientation. Also, rename `advances_x` to `advances` for consistency and declare QGlyphLayout's data size in a single place. Change-Id: I56b20f893f8a6feb7aa870e3edbca99dd93ba2e2 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com> Reviewed-by: Lars Knoll <lars.knoll@digia.com> Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Fix build with -WerrorKonstantin Ritt2013-12-171-1/+1
| | | | | Change-Id: I2fe4b006dc0696e5491792846bdb8c99ac31af6e Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Fix build with -WerrorKonstantin Ritt2013-09-141-1/+1
| | | | | | | | | The actual warning is: src/gui/text/qharfbuzzng.cpp:589:67: error: cast from ‘void*’ \ to ‘uint {aka unsigned int}’ loses precision [-fpermissive] Change-Id: I75cc7bad2147cd5e5e7c17bc22fe613280e86755 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Add HarfBuzz-to-Qt bridging codeKonstantin Ritt2013-09-081-0/+730
Change-Id: I2f61566fe69d18b80d5831238beb27b34b7be1c8 Reviewed-by: Lars Knoll <lars.knoll@digia.com>