summaryrefslogtreecommitdiffstats
path: root/src/gui/text/qfontengine_ft.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Don't render glyph with FT with fetchMetricsOnlyJiang Jiang2012-02-171-1/+1
| | | | | | | | | Neither rendering with outline nor fetchMetricsOnly requires the rendering from FreeType so we don't need to render them or cache it. It should speed up recalcAdvances() quite a lot. Change-Id: I0f623cb4f79da2edf6e9c9634a2f22fb0c66823c Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com>
* Remove historical +1 from font height calculationEskil Abrahamsen Blomfeldt2012-02-171-3/+2
| | | | | | | | | | | Historically, we've calculated font height as ascent+descent+1. In Qt 4, a patch was added to work around this by subtracting 1 from the descent of the font engines. We now remove the +1 and the work arounds. Change-Id: I7e25d49b97ac892015d3328f32d70eb9a7c2d88f Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com> Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
* Use newly-added QFileInfo::isNativePathJoão Abecasis2012-02-141-3/+4
| | | | | | | | | | | | Don't indirect over internal API. With QAbstractFileEngine and friends on the way out, QFile is losing its (marked internal) virtual fileEngine() function and the file engine can't be queried for LocalDiskFlag. That information is now available through QFileInfo, instead. Change-Id: I48827a96fd8cd748055ad5f075912fc8e1c5ef7f Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com>
* Windows: Fix compilation with -qtnamespaceKai Koehne2012-01-311-1/+2
| | | | | Change-Id: Ib006d74299d65e5872a5a524eaa937e127306ec7 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@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>
* Don't lose the fontDef when setting the size of a raw font.Pierre Rossi2012-01-251-1/+1
| | | | | | | | | QFontEngineFT::cloneWithSize, which is used among other things by QRawFont::setPixelSize, should create a new font engine using the font definition from the current font engine. Change-Id: I9415422bbecc2bf7b7acf105c12c1c83a894526c Reviewed-by: Simon Hausmann <simon.hausmann@nokia.com>
* Move glyphMargin() to QFontEngineJiang Jiang2012-01-241-3/+3
| | | | | | | | | | | | | glyphMargin() support for QTextureGlyphCache is implemented in respective font engines, thus this function is platform dependent. Before Qt 5 the code is guarded in macros like #ifdef Q_WS_MAC, now we should move them into QFontEngine and its subclasses. So far only Windows font engines support it. FreeType and Core Text based font engines all ignore it. Change-Id: Ia14016533d8fbfaacf848a7d3bc928f8197318f5 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@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>
* Provide defaultFont with fontconfig dbJiang Jiang2011-11-151-0/+1
| | | | | | | | | | | So that it won't just return "Helvetica" that may not exist in target system. Providing it seems to fix QTBUG-21833 as well, thus we can remove the QEXPECT_FAIL statement in qlistview test. '_' appears to reach the minimum right bearing in some fonts. Task-number: QTBUG-21833 Change-Id: I2340af6ee736083ec4f6575e469840ebec4e545e Reviewed-by: Jiang Jiang <jiang.jiang@nokia.com>
* Fix symbol fonts support with FT engineJiang Jiang2011-11-111-20/+0
| | | | | | | | | | | | It appears that the symbol_map we obtained with FreeType doesn't work for common symbol fonts like Wingdings, in previous X11 code we use the code path with normal charmap, to enable it we need to make sure QT_NO_FONTCONFIG is not defined. And since the FcCharset functions doesn't really operates on the font database, we can safely skip the mutex calls. Change-Id: I8c484de200be1d47c053b10be2c51d2273dcd359 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com>
* Fix subpixel positioning supportJiang Jiang2011-11-081-0/+1
| | | | | | | | | | | | Move subpixelPositionForX from QTextureGlyphCache to QFontEngine, since some font engines like QFontEngineFT may need a custom implementation or tweak it a little bit. In QRasterPaintEngine::drawCachedGlyphs, do not add aliasedCoodinate to x offset as that will break subpixel positioning. Change-Id: Idbcec617509459b80965220ceb07b17737649bbf Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com>
* Allow disabling FreeType internal cacheJiang Jiang2011-11-051-136/+107
| | | | | | | To disable it, set QT_NO_FT_CACHE environment variable to 1. Change-Id: I086aa93c71cbdf86858a41a2bbad5d2db247cdfb Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com>
* Fix most warnings about assignments of QAtomicInt.Friedemann Kleint2011-10-311-1/+1
| | | | | Change-Id: Ide409d72d2637b68ec2a85aaca4bc783a7e911e7 Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com>
* Freetype: Do not unlock face when returning superclass value in ↵Oliver Wolff2011-10-281-1/+0
| | | | | | | | | | lockedAlphaMapForGlyph If the face is unlocked in this case, calling unlockAlphaMapForGlyph after doing the operation will cause an assert. Change-Id: Icb2310a3b139e5bedf24f9c3794bd7d3fd38cfea Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com>
* Fix scaled text rendering with the raster paint engine & FreeTypeSimon Hausmann2011-10-171-0/+7
| | | | | | | | | | | | | | | Before commit 070d9c00c488a5ee6811f04170cf488ead79bf80, the raster paint engine used to call loadGlyphs() on the FT engine, which ensures that the glyphs are loaded and (more importantly) that the correct transformation matrix is applied on the freetype face. After commit 070d9c0 lockedAlphaMapForGlyph is called for each glyph, which unfortunately doesn't respect the provided transformation matrix. Therefore when drawing scaled text, it was never actually scaled. This patch applies the combination of the fontengine transform and the requested transform on the freetype face actually used, similarly to loadGlyphs. Change-Id: I0956a9e71784582db6bb90475a001a63800773f4 Reviewed-by: Jiang Jiang <jiang.jiang@nokia.com>
* Remove Q_WS_ and Q_OS_SYMBIAN from QtGui.Friedemann Kleint2011-10-131-4/+0
| | | | | | Change-Id: I2ac3376513c3fbfc81a2e695a73a0d948d2696bc Reviewed-on: http://codereview.qt-project.org/6607 Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com>
* Use freetype font engine on WindowsOlli Werwolff2011-10-101-0/+4
| | | | | | | | | | | | | | | As windows' fontdatabases also uses functionalities from qbasicunixfontdatabase it was renamed to qbasicfontdatabase. But instead of iterating over the font directories' files it uses system calls to obtain the list of fonts and uses registry values to find the according filenames to add. The native font engine was still kept. It can be activated by adding fontengine=native as platformargument. Change-Id: I7197bed5d18b8a33d4aa97ce91bfa1cd281b80ea Reviewed-on: http://codereview.qt-project.org/5839 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com> Sanity-Review: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com>
* Fix possible assert in QFontEngineFTEskil Abrahamsen Blomfeldt2011-09-261-1/+3
| | | | | | | | | | | This is a regression caused by 070d9c00. If the defaultFormat is set to Format_None, we should default to Format_A8 like before the change. Change-Id: I8ad07abff96fc1dfa03c0c5b49d13beb36b9de70 Reviewed-on: http://codereview.qt-project.org/5540 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Jiang Jiang <jiang.jiang@nokia.com>
* Fix possible crash in QFontEngineFTEskil Abrahamsen Blomfeldt2011-09-261-1/+1
| | | | | | | | | | | | | Avoid crash if set pointer is null. Task-number: QTBUG-21647 Reviewed-by: Jiang Jiang (cherry picked from commit e05734987594f0e54f58a2ab3037cdf4956e9036) Change-Id: I49fde194ef6be5485a43c5d09fc43170ab9d4d6b Reviewed-on: http://codereview.qt-project.org/5532 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com> Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
* Use QT_MAX_CACHED_GLYPH_SIZE in QFontEngineFTAleksandar Stojiljkovic2011-09-201-2/+6
| | | | | | | | | | | Task-number: QTBUG-21162 - Letters get truncated when font size=72 and set to Italic Reviewed-by: Eskil (cherry picked from commit cd43d6386de6e66379fa23c1ea4ec06141167c86) Change-Id: Ic05f775975d5f21e0274e7b2c3a4903d6a4ae41f Reviewed-on: http://codereview.qt-project.org/5203 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com> Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
* Avoid double caching glyphs in raster/QPA/FreeTypeEskil Abrahamsen Blomfeldt2011-09-201-15/+86
| | | | | | | | | | | | | | | | | | | | | Since FreeType has internal caching, it has had a special code path in the raster engine which avoided using Qt's glyph cache, as that would be redundant. However, when compiling with QPA, we want the same behavior without being able to access the QFontEngineFT class. To achieve this, I've made a new abstraction and added it to QFontEngine which allows the FT engine to provide direct pointers into the alpha maps stored by FT. This requires a locking/unlocking mechanism. Yes, the QFontEngine::alphaMap* API is slowly becoming a horrible mess, but due to time constraints, the task of refactoring these functions into a more flexible API needs to wait. I've added a TODO comment for this. Change-Id: I08237403c2967f8fb952258178676f33a87c0353 Reviewed-on: http://codereview.qt-project.org/5155 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com>
* Fix regression causing synthesized oblique glyphs to clipEskil Abrahamsen Blomfeldt2011-09-191-1/+15
| | | | | | | | | | | | | | | | | In 20009ed797fb30952a889df5716aa2399102be58 I introduced a new approach to synthesized oblique. However, while the embolden function in FT alters the glyph metrics accordingly, the oblique function does not, so the glyphs would be clipped to the original, unslanted metrics. So I've implemented the same matrix in the loadGlyph() function and we now apply this to the metrics manually. This will only work as long as the underlying algorithm doesn't change significantly. Task-number: QTBUG-21202 Change-Id: Ic20b2a0fdeac5ce833e95fd06efa12b3b70feee5 Reviewed-on: http://codereview.qt-project.org/5156 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Jiang Jiang <jiang.jiang@nokia.com>
* Support synthesized oblique and bold in SceneGraphEskil Abrahamsen Blomfeldt2011-09-191-3/+20
| | | | | | | | | | | | | | | When fetching the outlines we need to synthesize the weight and style of the requested font. This is currently only supported on FreeType versions that have the Embolden and Oblique functions. We also use FreeType's Oblique function for regular text when possible, and only use the matrix approach when that function is unavailable. Task-number: QTBUG-21202 Change-Id: I0656ab66cc3ec70d6a7675b8c78d06632625261c Reviewed-on: http://codereview.qt-project.org/5076 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Jiang Jiang <jiang.jiang@nokia.com>
* Replace explicit surrogate handlers by inline methods of QChar classsuzuki toshiya2011-09-121-8/+5
| | | | | | | | | | | | Merge-request: 1284 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com> (cherry picked from commit 50af55095afe1ba048dde357b771485ef2188778) Change-Id: I0b1967145ad62243afc2060a6ae4ca141a9609fd Reviewed-on: http://codereview.qt-project.org/4587 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
* Fix uses of qRound on non-floating-point types.Thiago Macieira2011-07-121-2/+2
| | | | | | | | | | | It's silly to round integeres, since they are already round. At most, this would waste CPU cycles without any benefit. Change-Id: I6fc0152f4416d723b65966e5d48cc7a07957b83c Merge-request: 17 Reviewed-by: Olivier Goffart <olivier.goffart@nokia.com> Reviewed-on: http://codereview.qt.nokia.com/1541 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
* Fontengine buildfix for xcb platform plugin.Tapani Mikola2011-06-101-1/+0
| | | | | | Change-Id: Ic909e1ac08163e62634643c68862e802a016b911 Reviewed-on: http://codereview.qt.nokia.com/442 Reviewed-by: Gunnar Sletta <gunnar.sletta@nokia.com>
* Allow selecting fonts with irregular style namesJiang Jiang2011-06-091-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Fix broken drawing with large fonts using QStaticText and FreeTypeEskil Abrahamsen Blomfeldt2011-05-181-1/+1
| | | | | | | | | | | | | In FreeType, there's a fall back to QFontEngine::alphaMapForGlyph() when the fonts are very large. Since this uses a QPainterPath containing an unhinted glyph, the use of hinted metrics would sometimes lead to the glyphs being clipped because they would be positioned slightly outside the image they were painted into. When outline drawing is on, it makes sense to return unhinted metrics, since the glyphs we will actually use are unhinted. Task-number: QTBUG-19067 Reviewed-by: Jiang Jiang
* Only enable design metrics for scalable fontsJiang Jiang2011-05-051-1/+1
| | | | | | | Bitmap fonts don't have linear advance at all. Reviewed-by: Eskil (cherry picked from commit 111accbf9aaf95b052448ecb70937c61e9b59d66)
* Remove QFontEngineFT::loadGlyphMetricsJiang Jiang2011-05-041-100/+0
| | | | | | | It is no longer used and was accidentally merged back in. Reviewed-by: Eskil (cherry picked from commit 782535ac548c582542bd1c17207e288e816870a8)
* Make QtQuick2 compile on QPAEskil Abrahamsen Blomfeldt2011-04-281-0/+35
| | | | | | | | | | | Moved the logic to set pixel size into the font engines to avoid making the platform plugin interface too complex, and added a function in QPA to make an isolated font engine based on font data. Currently none of the QPA back-ends supports it, but it compiles and spits out a warning if you try to create a QRawFont from data there. This isn't used in QtQuick2 anyway. Reviewed-by: Jiang Jiang
* Initial import from the monolithic Qt.Qt by Nokia2011-04-271-0/+2074
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