summaryrefslogtreecommitdiffstats
path: root/src/gui/text/qfont_p.h
Commit message (Collapse)AuthorAgeFilesLines
* Replace Q_DECL_OVERRIDE with override where possibleKevin Funk2017-09-191-1/+1
| | | | | | | | | | | | | | | | Remaining uses of Q_DECL_OVERRIDE are in: src/corelib/global/qcompilerdetection.h src/corelib/global/qglobal.cpp doc/global/qt-cpp-defines.qdocconf (definition and documentation of Q_DECL_OVERRIDE) tests/manual/qcursor/qcursorhighdpi/main.cpp (a test executable compilable both under Qt4 and Qt5) Change-Id: Ib9b05d829add69e98a86238274b6a1fcb19b49ba Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io> Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* Avoid synthesizing stretch on condensed font familiesAllan Sandfeld Jensen2016-08-151-1/+1
| | | | | | | | | | | | | | | | | | If an entire font family is condensed or stretched and we match by family name, the default stretch factor of 100 will make the font engine try to synthesize it back to medium stretched font. The existing code is already made to deal with a stretch of 0 that is no longer used. This patch reintroduces 0 stretch to indicate no specific stretch has been requested. Specifically setting stretch to 100 on a QFont will introduce the old behavior. [ChangeLog][QtGui][QFont] The default value of QFont::stretch() is now 0 to indicate any default stretch is acceptable. Task-number: QTBUG-48043 Change-Id: I574747f980fd4f9893df828818aae99a07b41623 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* Add qtguiglobal.h and qtguiglobal_p.hLars Knoll2016-07-031-0/+1
| | | | | | | | | | | | | | | | | | | | The new modular configuration system requires one global header per module, that is included by all other files in this module. A similar scheme and naming convention is already being used for many other modules (e.g. printsupport, qml, quick). That header will later on #include the configuration file for Qt Gui. For now it defines the Q_GUI_EXPORT macro for this library. In addition, add a private global header, qtguiglobal_p.h, that can later on include the private config header for Qt Gui for things we don't want to export to the world. Change-Id: Id9ce2a4f3d2962c3592c35e3d080574789195f24 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
* Merge remote-tracking branch 'origin/5.6' into devLiang Qi2016-01-211-0/+1
|\ | | | | | | | | | | | | | | | | | | | | Conflicts: src/corelib/io/qiodevice_p.h src/corelib/kernel/qvariant_p.h src/corelib/tools/qsimd.cpp src/gui/kernel/qguiapplication.cpp tests/auto/network/socket/qtcpsocket/tst_qtcpsocket.cpp Change-Id: I742a093cbb231b282b43e463ec67173e0d29f57a
| * Decrease the cache if necessary when adding a new fontAndy Shaw2015-12-161-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | It was possible for the cache to increase too quickly since it was relying on the timer to decrease which caused problems with FreeType. So by checking if it will be increased to be over the limit first before adding the new font, we can decrease it earlier in preparation. Task-number: QTBUG-47812 Task-number: QTBUG-49535 Change-Id: Iedc042d8903949140aa8c5257a9d54cde31a51be Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@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>
* Font definitions with different style names are not equalAllan Sandfeld Jensen2015-06-031-2/+2
| | | | | | | | | | | | Since we added font matching by style name, the style name is not just a derived property and should not be ignored in comparisons. The QFontDef::exactMatch comparison is left unchanged, since it tests if a loaded font matches a requested one. Task-number: QTBUG-30851 Change-Id: I4187c5b993815001f35bcf24dc449059bfdcba6f Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.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>
* Deprecate QFont:: rawMode()/setRawMode()Konstantin Ritt2015-01-231-2/+0
| | | | | | | rawMode only has an effect under X11 in pre-QPA times. Change-Id: Iaff8fed8f4ae5af5dd0399bb3ebd9d590a39a758 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Add Q_DECL_OVERRIDE in the src subdirectoryOlivier Goffart2014-12-031-1/+1
| | | | | | | | | | Done automatically with clang-modernize on linux (But does not add Q_DECL_OVERRIDE to the function that are marked as inline because it a compilation error with MSVC2010) Change-Id: I2196ee26e3e6fe20816834ecea5ea389eeab3171 Reviewed-by: Thiago Macieira <thiago.macieira@intel.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>
* Merge remote-tracking branch 'origin/stable' into devIikka Eklund2014-04-011-1/+1
|\ | | | | | | Change-Id: I2a6eb9dd7724931bc89f28bcc156e77c4e26d069
| * Fix QFontCache::Key comparison for custom font fallbacks caseKonstantin Ritt2014-03-311-1/+1
| | | | | | | | | | | | | | Just a C&P typo, of course we have to compare lists, not their sizes. Change-Id: I40542035b87f5bb8d75207cb02c0826cc3a2a413 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* | Properly serialize QFont.Mitch Curtis2014-03-311-1/+1
|/ | | | | | | | | | | | | | | Some data was never serialized (styleName, hintingPreference) and some was incorrectly serialized (styleStrategy). This change also adds auto tests for every applicable QDataStream version. [ChangeLog][QtGui][QFont] QFont now serializes its data properly, without any data loss. Task-number: QTBUG-22814 Task-number: QTBUG-22946 Change-Id: I34e61b10662b7ad6c57054dacc7e1f522f5b5c5d Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com>
* Fix custom font substitution list supportKonstantin Ritt2014-03-111-6/+16
| | | | | | | | | | | | | | | | During the QPA refactoring, the custom font substitution list support was lost by ignoring the font request's fallbackFamilies member when the multi font engine gets created/initialized. If fallbackFamilies is not empty, it should be prepended to the font database default fallback families list. Also respect the custom fallback families list in the cache key to avoid picking a multi font engine with wrong fallbacks list. Task-number: QTBUG-36628 Change-Id: Ie2b84b3a397bee4816f421cddf76a5375829f13a Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com> Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* QFont: add missing qHash overloadMarc Mutz2014-02-161-0/+17
| | | | | | | | | | | | | | | | | | | The properties that make up the hash value are chosen to be the same as those that make up QFontDef's op<() and op==(). Indeed, the implementation for QFont simply delegates to the one of QFontDef, which has been added for this purpose, but may prove useful in its own right down the line. The code would greatly benefit from a qHash(qreal) implementation. Lacking this, the patch uses multiplication with 10000 and qRound64() to convert the one floating-point property used in the hash to an integer. This is probably the right thing to do anyway, to avoid epsilon problems. [ChangeLog][QtGui][QFont] Added qHash overload for this class. [ChangeLog][QtCore][QHash] Allowed QFont to be used as a key in QHash/QSet. Change-Id: I2c1cb5d9da53e26cb2c0f1a7c357731e73eea78e Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Cleanup freetype data in a thread-safe wayRobin Burchell2013-11-201-1/+4
| | | | | | | | | | | | | | | One less obvious part of this patch: the fontCache pointer in engineData was not safe. It isn't safe to rely on pointer addresses to verify we're cleaning up the right thing, as a sequence of malloc()/free()/malloc() can return the same pointer, and nothing was cleaning up the dangling pointer in engineData. With this, it is possible to safely drop OpenGL contexts in QtQuick under all conditions with no possibility of crashes. Done-with: Aaron Kennedy <aaron.kennedy@jollamobile.com> Change-Id: I7b91384251593730124323a74737d41333a05f59 Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com> Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
* Fix leaking of QFontEngineDataKonstantin Ritt2013-04-121-0/+3
| | | | | | | | | | | | | QFontCache now references QFontEngineData-s it maintains, so that QFont instances not freed prior to calling ~QFontCache() would destroy QFontEngineData on their own. Task-number: QTBUG-25434 Change-Id: Ia7679d64de436841f09ac7be62ceb570e50cce5b Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com> Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com> Reviewed-by: jian liang <jianliang79@gmail.com>
* Fix the font engines leakingKonstantin Ritt2013-03-201-5/+4
| | | | | | | | | | | | | | | 1. when there were some engines with ref > 1 in the cache, prior to calling QFontDatabase::{add,remove}ApplicationFont()/removeAllApplicationFonts() (QFontCache::clear() has never decreased engine's cache_count); 2. when the QFontEngineData's engine is not in cache i.e. the Box or Test font engine (~QFontEngineData() didn't free engines it keeps). Instead of using the font engine's (external) "cache_count" counter, QFontCache now references a given font engine every time it is inserted to the cache and dereferences exactly that number of times in clear(). Change-Id: I87677ebd24c1f4a81a53526f2e726e596b043c61 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Merge remote-tracking branch 'origin/stable' into devFrederik Gladhorn2013-01-221-1/+1
|\ | | | | | | | | | | | | | | | | | | Conflicts: src/corelib/io/qsavefile_p.h src/corelib/tools/qregularexpression.cpp src/gui/util/qvalidator.cpp src/gui/util/qvalidator.h Change-Id: I58fdf0358bd86e2fad5d9ad0556f3d3f1f535825
| * Update copyright year in Digia's license headersSergio Ahumada2013-01-181-1/+1
| | | | | | | | | | Change-Id: Ic804938fc352291d011800d21e549c10acac66fb Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* | Update Qt internals to use QChar::ScriptKonstantin Ritt2012-12-211-2/+1
|/ | | | | | | | | | | | | | ...and remove the outdated QUnicodeTables::Script enum. QFontEngineData now has one extra slot that never used (engines[QChar::Script_Inherited]). engines[QChar::Script_Unknown], if accessed, would be set with a Box engine instance, and could be used as a minor optimization some time later. In order to preserve the existing behavior, we map all scripts up to Latin to Common. Change-Id: Ide4182a0f8447b4bf25713ecc3fe8097b8fed040 Reviewed-by: Pierre Rossi <pierre.rossi@gmail.com> Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
* Fix conditional jump based on an uninitialized variable.Jędrzej Nowacki2012-11-031-2/+3
| | | | | | | | | | | | | | | | | | | | | | Valgrind warns about the jump in qfontconfigdatabase.cpp:522 based on uint QFondDef::hintingPreference:2 property. Surprising thing is that the property is initialized in the default constructor, so there should not be an issue. The warning disappear if the property is _not_ placed on a boundary of a two words, or if bit field is fully initialized. So I suspect that only one bit of the two was initialized properly. I decide to implement both solutions because of a potential minor performance improvement, during reading the property. I still fail to say why the value was uninitialized, I believe that this patch simply workarounds gcc bug or valgrind bug. Change-Id: I2e87738f66a435ef6e30b3d2db6baa73da025426 Reviewed-by: Jiang Jiang <gzjjgod@gmail.com> Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com> Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
* QFont: Don't invalidate engine unless request has been changedKonstantin Ritt2012-10-191-0/+3
| | | | | | | | | | This makes QFont do a "light" detach when the font attributes data has been changed. The new test clearly shows that the engine is now shared between two font instances after changing the kerning attribute. Change-Id: I59db822f459f02d111686dba7101b98e361fada9 Reviewed-by: Marc Mutz <marc.mutz@kdab.com> Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Change copyrights from Nokia to DigiaIikka Eklund2012-09-221-24/+24
| | | | | | | | Change copyrights and license headers from Nokia to Digia Change-Id: If1cc974286d29fd01ec6c19dd4719a67f4c3f00e Reviewed-by: Lars Knoll <lars.knoll@digia.com> Reviewed-by: Sergio Ahumada <sergio.ahumada@digia.com>
* Support specifying fallbacks in font request on QPAEskil Abrahamsen Blomfeldt2012-05-161-0/+2
| | | | | | | | | | | | | Because the QPA font database would query fallback families inside findFont(), support for requesting multiple font families in order of preference (like QFont("Times New Roman, Arial")) did not work, because the Arial fallback was never attempted. To fix this, we pass in the queried fallbacks and make sure they are tried before any platform specific fallbacks. Task-number: QTBUG-20986 Change-Id: Idb2b717856f013ce2874f00a8debaff60176d2fc Reviewed-by: Jiang Jiang <jiang.jiang@nokia.com>
* Remove dead code.Pierre Rossi2012-03-081-1/+0
| | | | | | | | This logic was introduced as part of change I92dfb39289a359f49caa02c2caf8baf66098fb59 but isn't used anymore. Change-Id: I5bcfea99a7a2993434e1e978195a70dae52d6cfa Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com>
* Allow using multi fontengine in QTextLayout with QRawFont.Pierre Rossi2012-03-011-2/+3
| | | | | | | | | | | This change enables us to instantiate a QFontEngineMulti that takes the raw font's font engine as its primary engine but can use fallback engines based on the platform. Since this can be quite expensive, we defer the query for fallback families' names until it's needed and we cache the resulting multi font engine. Change-Id: I390dbc1cb2fe61d56867f29a03f313eb3eb49dc3 Reviewed-by: Simon Hausmann <simon.hausmann@nokia.com>
* Avoid loading and keeping unused fallback font enginesEskil Abrahamsen Blomfeldt2012-02-171-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | When we request glyphs from fallback fonts, we would potentially load all fonts on the system into memory. This is especially true for glyphs that are not supported by any font (or by the last in the list) in any "Common" script (which e.g. includes CJK). This would make any application which tried to display unsupported glyphs use huge amounts of memory for keeping unused fonts cached, only limited by the number of fonts on the system. The patch contains two solutions: First, before loading the font, the multi font engine will be asked whether it needs to be tried for the given character. By default, this will always be true, so all fonts will be tried, but with the new font config multi engine in the platform plugin, it will ask FontConfig whether the font contains a glyph for the character. Should the font be loaded and still fail to resolve the character (which could be the case for other platforms), we will simply delete it again immediately instead keeping it cached. Change-Id: I92dfb39289a359f49caa02c2caf8baf66098fb59 Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
* Remove "All rights reserved" line from license headers.Jason McDonald2012-01-301-1/+1
| | | | | | | | | | 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: I311e001373776812699d6efc045b5f742890c689 Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Update contact information in license headers.Jason McDonald2012-01-231-1/+1
| | | | | | | Replace Nokia contact email address with Qt Project website. Change-Id: I431bbbf76d7c27d8b502f87947675c116994c415 Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Update copyright year in license headers.Jason McDonald2012-01-051-1/+1
| | | | | Change-Id: I02f2c620296fcd91d4967d58767ea33fc4e1e7dc Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* engineData should be cached solely based on QFontDefJiang Jiang2011-12-011-3/+3
| | | | | | | | | | | | | | | | | | | | Each QFontPrivate points to a QFontEngineData instance, which is essentially a mapping from different scripts to QFontEngines. Let's say we have QFont("Waree") and trying to use that for one text in Thai and another text in English, there should be only one QFontEngineData: [ QUnicodeTables::Common -> QFontEngineMulti(1), QUnicodeTables::Thai -> QFontEngineMulti(2) ]. If we cache QFontEngineData using QFontCache::Key (which includes QFontDef, script and screen) as the key, then we will create two QFontEngineData: [ QUnicodeTables::Common -> QFontEngineMulti(1) ] and [ QUnicodeTables::Thai -> QFontEngineMulti(2) ], so it will be pointless to have QFontEngineData at all. This bug was introduced in a 2005 refactoring (512f0e8c in history repo). Change-Id: I14677507e97682472cde9a0e1b594e903ec9e718 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com>
* Remove Q_WS_ and Q_OS_SYMBIAN from QtGui.Friedemann Kleint2011-10-131-28/+0
| | | | | | Change-Id: I2ac3376513c3fbfc81a2e695a73a0d948d2696bc Reviewed-on: http://codereview.qt-project.org/6607 Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com>
* Only compare styleNames if they are not emptyJiang Jiang2011-06-271-1/+1
| | | | | | | | | | Task-number: QTBUG-19366 (cherry picked from commit 15e6ac8f4d9e7a419cd0c10405954bde78559fac) Change-Id: I5f06bb5133f23dbc8ad6d745d44ca0a85ef49686 Reviewed-on: http://codereview.qt.nokia.com/760 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com>
* Add styleName to QFontDef comparisonJiang Jiang2011-06-271-0/+3
| | | | | | | | | | | To make sure we cache different font engines with different style names. Task-number: QTBUG-19366 Change-Id: Iefaebd5418f212ff759e03c1745f839a7f23d013 Reviewed-on: http://codereview.qt.nokia.com/738 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com>
* Allow selecting fonts with irregular style namesJiang Jiang2011-06-091-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fonts like "Helvetica Neue UltraLight" or "Skia Regular Black Condensed" can't be selected in Qt because either they don't report correct numeric values for weight/stretch/etc. or these values are not mapped from QFont enums in a linear way. Thus we provide a shortcut to select these fonts with PostScript name or full name without resorting to family name matching in QFontDatabase (these fonts are not registered in font database anyway). After this, we can simply use: QFont font("Helvetica Neue"); font.setStyleName("UltraLight"); to select these fonts. QCoreTextFontEngineMulti matched like this can be created directly from the CTFontRef instance instead of creating from the font name, making this process faster. The commit also cleaned up the font loading process in Mac font database a bit, moving the code for family matching into a separate function. Add QFontInfo::styleName() and QRawFont::styleName() to access the resolved style name for a font. Task-number: QTBUG-19366 Change-Id: Iad07768c02ed06cc8d6b7395dec554384f410506 Reviewed-on: http://codereview.qt.nokia.com/333 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Jiang Jiang <jiang.jiang@nokia.com>
* Update licenseheader text in source files for qtbase Qt moduleJyri Tahtela2011-05-241-17/+17
| | | | | | | Updated version of LGPL and FDL licenseheaders. Apply release phase licenseheaders for all source files. Reviewed-by: Trust Me
* Initial import from the monolithic Qt.Qt by Nokia2011-04-271-0/+290
This is the beginning of revision history for this module. If you want to look at revision history older than this, please refer to the Qt Git wiki for how to use Git history grafting. At the time of writing, this wiki is located here: http://qt.gitorious.org/qt/pages/GitIntroductionWithQt If you have already performed the grafting and you don't see any history beyond this commit, try running "git log" with the "--follow" argument. Branched from the monolithic repo, Qt master branch, at commit 896db169ea224deb96c59ce8af800d019de63f12