summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/windows/qwindowsfontengine.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Drop some qtextengine_win.cpp leftoversKonstantin Ritt2014-05-201-5/+0
| | | | | Change-Id: Id0d39acfcb340b40e51b8d06a4308df809a8fc1b Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* qpa: Clean up and refactor qfontengine_qpaTor Arne Vestbø2014-05-151-1/+1
| | | | | | | | | | | QFontEngineQPA was really QFontEngineQPF2, and has been renamed. The multi font engine in qfontengine_qpa.cpp was really a base implementation of a multi font engine, used by other multi font engines, and has been renamed and moved accordingly into qfontengine_p.h/cpp. Change-Id: Iac7409c4dbf0fdc3ee993ce4f7dc96cb00a422e6 Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com> Reviewed-by: Paul Olav Tvete <paul.tvete@digia.com>
* Add virtual function to QFontEngine report if outlines are reliableJørgen Lind2014-05-061-0/+21
| | | | | | | | | GetGlyphOutline fails for ttf fonts with embedded bitmaps. This results in distancefield rendering not rendering glyphs (for the failed paths). We need to fall back to texture rendering if this is the case. Change-Id: Ibdf7dc5c1d34f513c436f88fabbdcc4089bb6fef Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
* Fix copy-paste error.Richard J. Moore2014-04-181-1/+1
| | | | | | | | | Fix copy-paste error identified by static analysis at http://www.viva64.com/en/b/0251/ Change-Id: I214d6bf8494a946a6c772b6dca1395e4140a471f Reviewed-by: Daniel Molkentin <daniel@molkentin.de> Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
* Make QWindowsMultiFontEngine support deferred fallback families queryKonstantin Ritt2014-03-311-25/+4
| | | | | | | | | | This finishes 800232e1d3ebfbac28d07014a3c646ea00fcf6ad, which encovered a tricky issue in QFontEngineMultiQPA::createMultiFontEngine(). Task-number: QTBUG-37836 Change-Id: I6d432e09e755f5d9ded09752c4c092f4857ad224 Reviewed-by: Pierre Rossi <pierre.rossi@gmail.com> Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Guarantee QPFDB::fontEngine() always return non-multi font engineKonstantin Ritt2014-03-111-12/+18
| | | | | | | | | | After QPA refactoring, QWindowsFontDatabase::fontEngine() was returning a multi font engine w/o any particular reason. This makes the code more obvious and opens the road to further improvements. Change-Id: I4858026ddf774d3159c89357b1c905f5112b1c51 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com> Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Use QStringIterator instead of homebrewKonstantin Ritt2014-03-101-21/+13
| | | | | | | Task-number: QTBUG-15664 Change-Id: I1ed3eb04ddd822e57a4d993af656dfe283f3af1a Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Make QFontEngine::type() non-virtualKonstantin Ritt2014-03-051-6/+2
| | | | | Change-Id: I24ece90d6d8f96dad0c41a474a491b4ea96d97c3 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Get rid of QFontEngine::name()Konstantin Ritt2014-03-051-6/+0
| | | | | | | | It was only used in QFontCache debug output, and some engines weren't even report a name. Change-Id: I6cec4b75f105f5a4e1405f50188bebb3a3f04e33 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Introduce a generic QFontEngine::canRender() implementationKonstantin Ritt2014-03-031-29/+0
| | | | | | | | ...which uses the recently introduced glyphIndex() method; get rid of re-implementations that did almost the same. Change-Id: I6d32d2cee6a31f57de6aee05ed8d120d4a1f4e9c Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Introduce QFontEngine::glyphIndex(uint)Konstantin Ritt2014-03-031-0/+24
| | | | | | | | | ...an optimized drop-in replacement for the code like this: `stringToCMap(&uc, 1, &g, &numGlyphs, QFontEngine::GlyphIndicesOnly)` (aka "get the glyph index for exactly one Unicode character"). Change-Id: I22babf49f7cf28892d27533a5ac51ad449779f75 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Unify QFontEngine*::stringToCMap() behaviorKonstantin Ritt2014-03-031-0/+1
| | | | | | | | Ensure the params are valid and make QCoreTextFontEngine::stringToCMap() handle the unsufficient buffer case exactly like the other engines does. Change-Id: I078af37da917cf2bac709b12aa827ed4128e5f30 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Unify QFontEngine::getSfntTableData() behavior on all platformsKonstantin Ritt2014-03-021-0/+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>
* Unify glyph format between QFontEngine and QFontEngineGlyphCacheTor Arne Vestbø2014-02-191-2/+2
| | | | | | | | | | | | Instead of the glyph cache having its own cache type that always mapped one to one to a font engine glyph format, causing confusion and needless conversions, the glyph caches now use QFontEngine's glyph format enum. This also removes the iffy use of an int for the glyphFormat in the font engines. Change-Id: I529bad5c179e004f63e152f7dcc311d298c3db98 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Fix character mirroring issue with HarfBuzz-NGKonstantin Ritt2014-02-041-36/+3
| | | | | | | | | | HarfBuzz-NG does character mirroring where appropriate. A simple solution is to unset RightToLeft shaper flag when text gets shaped with HB-NG. Instead, move the mirroring code right to HB-old proxy function and decrease code duplication. Change-Id: Icdcd50b73b3e6a43da4b85addc7d8f51edf86512 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Get rid of QGlyphLayout::advances_yKonstantin Ritt2014-01-301-7/+4
| | | | | | | | | | | | | | | ...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>
* Port Windows QPA plugin to new logger API.Friedemann Kleint2014-01-221-15/+6
| | | | | | | | | | | | | | | | Introduce logging categories and change most debug statements to qCDebug(). Retrieve the filter rules from the environment variable QT_QPA_VERBOSE (should be removed once the logging framework offers a more convenient way of configuring). Replace the old per-category variables controlling verboseness of the output by a single variable which can be set on the command line. Change-Id: Iae55ecdb0e150efd165b7d3e90b371f72853f194 Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
* Fix OpenType fonts with cmap tables on WindowsJosh Faust2013-11-221-3/+10
| | | | | | | | Task-number: QTBUG-31656 Change-Id: I5405d80f3ac1de488c44c9f1ac9ed9942ceab6b8 Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com> Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Make QFontEngine not derive from QObjectKonstantin Ritt2013-09-101-3/+8
| | | | | | | | | | | | | Whilst having the objectName set for each engine is somewhat handy when debugging, deriving from QObject just for that is a wasting of memory in all other cases. This also broke the font engine abstraction by allowing qobject_cast() to access some private data; the only sane way to distinguish engines is querying their Type value. Change-Id: Ib1d195692859eb39089f6d8d9016cb8f9dcc0400 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com> Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Fix warning about unused variable.Friedemann Kleint2013-09-051-1/+1
| | | | | Change-Id: I557785911073a35100902aa631fcef81133615cc Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com>
* Remove undesired pixel padding of glyphs on windows.Gunnar Sletta2013-09-051-4/+4
| | | | | | | | | | | The excessive padding has serious performance implications throughout Qt and need to go. The original reason for having them was to fix issues with GL text rendering and issues with unspecified OpenType fonts. There have been several other changes to the glyph cache since then and neither of the issues can be reproduced today. Change-Id: I6de67598a079c296daf48be07cc5c2d67768c384 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
* Rely solely on alphaMapBoundingBox in QTextureGlyphCacheGunnar Sletta2013-09-051-0/+13
| | | | | | | | | | | | | | | We're currently adding a lot of transparent pixels to the cache, wasting both memory and cpu cycles while drawing. AlphaMapBoundingBox was introduced to return the exact same bounds as the alphaMapForGlyph function so we should only rely on this instead of adding arbitrary padding and margins all over the place. Windows still has an arbitrary +4 in the its drawGDIGlyph() which means batching will not work on windows, but at least now other platforms do not need to suffer. Change-Id: I714903fa195004400c09c3bf6570e46179775f09 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
* Better errorhandling for the fontengine on WINCE.Bjoern Breitmeyer2013-07-181-5/+4
| | | | | | | | | | | | | | | The CE fontengine only supports translations, scaled Text would only work if its an isometric scale and would require to create a new font from the old one. Rotations and more aren't supported at all. The freetype fontengine for CE supports this, so we give a warning that the font might be rendered incorrect, but could render correct with the freetype engine. Task-number: QTBUG-32189 Change-Id: I3581c3fef8e4ee118c0038a6ccc237e66b583731 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
* QWindowsFontEngine: Fix warnings about GetGlyphOutline() failures.Friedemann Kleint2013-05-131-7/+11
| | | | | | | | | | | | | tst_qglthreads::painterOnPixmapInThread reports QWinFontEngine: unable to query transformed glyph metrics... (Desktop OpenGL only). Task-number: QTBUG-28264 Change-Id: Ib456905a13a95037ec13dfc4cb828f830076ee89 Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com> Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
* Fix transformed raster fonts on WindowsEskil Abrahamsen Blomfeldt2013-05-131-0/+6
| | | | | | | | | | | | | | | | | | We removed all Q_WS_WIN code when going to Qt 5. One of the things removed was the condition that we do painter path text rendering for transformed, non-ttf fonts, since the GDI engine does not support transforming those. This has now been reintroduced and adapted to the QPA way of doing things, by checking for it in the font engine subclass. Then there was the problem that QStaticText only supports cases where the font engine can transform the glyphs. Thus we need to fall back to regular text drawing in drawStaticText() for unsupported cases, and we need to skip the optimized path in the raster engine (which goes to drawStaticTextItem) Task-number: QTBUG-30932 Change-Id: I17ba7355ee127811b0e77bb3a9b9db092e99893b Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
* QFreetypeFace: Fix getFace() uses UTF-8 paths on non UTF-8 localesKonstantin Ritt2013-04-111-1/+1
| | | | | | | | | | QFontEngine::FaceId::filename is intended to be local8Bit-encoded but QFreetypeFace::getFace() always treats it like UTF-8-encoded. Also replace explicit (to|from)Local8Bit and toLatin FaceId::filename conversions with QFile::(en|de)codeName, where appropriate. Change-Id: Ic7beabf0a160f2f02f1667bcb8e6067adaba1c16 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@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>
* | Fix MinGW-warning about pointer/integer of different sizes (64bit).Friedemann Kleint2013-01-211-2/+2
| | | | | | | | | | Change-Id: I26945bbcd0994e478332ea1250ad7d0bbaa8420f Reviewed-by: Joerg Bornemann <joerg.bornemann@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>
* | Make distance fields rendering work with Opentype CFF fontsEskil Abrahamsen Blomfeldt2012-12-211-1/+12
|/ | | | | | | | | | | | If the font has a CFF table, GDI will not label it as TMPF_TRUETYPE, however, we can still use GetFontData to get the SFNT tables. This is required to get the maxp table which contains the glyph count, which is required to use the font with the distance-field renderer. Task-number: QTBUG-28746 Change-Id: I3ca1e3d96ea53c453e6fa422b33d1f1f5050a82c Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
* Fix GDI leaks in fontengineMiikka Heikkinen2012-11-051-2/+5
| | | | | | | | | | GDI objects that are created need to be deleted once no longer needed, instead of just released. Task-number: QTBUG-27812 Task-number: QTBUG-27825 Change-Id: I53b04b54cea9e2aaa8fc72365c215f516c5682e6 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@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 fallback fonts in DirectWrite font engineEskil Abrahamsen Blomfeldt2012-07-101-3/+63
| | | | | | | | | | | | | When selecting fallback fonts for a DirectWrite font, we would cast the font engine to QWindowsFontEngine and get unpredictable results and crashes. This change factors out getting the LOGFONT data from the QFontDef struct and will use this to create a new DirectWrite engine. Task-number: QTBUG-22658 Change-Id: I743944d9a44d8742b47b1aa3354532493362cc4a Reviewed-by: Jiang Jiang <jiang.jiang@nokia.com>
* Fix the UCS-2 surrogates handling in Q*FontEndine*::stringToCmap()Konstantin Ritt2012-07-101-0/+1
| | | | | | | | | by making sure QGlyphLayout's numGlyphs member is properly initialized if the string-to-glyphs lookup was successful (tip: a surrogate pair produces a single glyph index). Change-Id: I01953f3b6281d79e1a214bfab0424e796d94769a Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
* Move ShaperFlags enum from QTextEngine to QFontEngineKonstantin Ritt2012-07-101-7/+6
| | | | | | | | These flags are specific to font engine(s) and has nothing to do with the text engine or the text layout. Change-Id: I4bb793c3c634b3cf0ae0a8a8c23b946fad5874b6 Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
* Windows QPA plugin: Add \internal to class documentation.Friedemann Kleint2012-05-291-0/+2
| | | | | | | | Prevent the classes from appearing in the Qt documentation. Change-Id: I62abff0c57effdf16629f9d5a0dc384ea2c43d5a Reviewed-by: Miikka Heikkinen <miikka.heikkinen@digia.com> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
* Fix font printing on Windows using the native engine.Friedemann Kleint2012-05-151-2/+2
| | | | | | | | | | | - Add HFONT, LOGFONT, trueType as properties of the Windows font engine, make it a real Q_OBJECT. - Query properties in the Windows print engine and use the HFONT, LOGFONT there. Change-Id: I5c35275b32ef6580d7fa15ed83c6e79e33dc3334 Reviewed-by: Miikka Heikkinen <miikka.heikkinen@digia.com> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
* Fix for windows platform plugin to work with WINCE.Bjoern Breitmeyer2012-05-101-4/+109
| | | | | | | | | | | Made opengl optional. Made Clipboard and Accessability optional. Moved internal mime data into its on source file, was implemented in the clipboard source which is just strange. Change-Id: I6ddf0c656533bd45e22e24492fc2254d15b7822f Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
* fix glyph's CMAP index might be corruptedKonstantin Ritt2012-05-081-1/+1
| | | | | | | | when SMP sybmol is present in the font. this is a simple typo fix, actually Change-Id: I54a4df43ece1a36f5c7997d121b7655afb2069e3 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com>
* Windows: Fix QRawFont loading from data.Miikka Heikkinen2012-04-231-1/+13
| | | | | | | | | | | | | The implementation for loading QRawFont from data was missing from Windows QPA plugin. For freetype font database, just called the parent QBasicFontDatabse implementation. For native font database, ported the implementation from Qt 4.8 qrawfont_win.cpp. Task-number: QTBUG-24197 Change-Id: Ia784d4cbc4f37c925aa49e53d04faf06a7169a73 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com>
* Fix missing Windows native fonts in QML applicationsMiikka Heikkinen2012-04-201-0/+3
| | | | | | | | | | | Windows native fonts were not getting rendered because the font engine was cloned incorrectly for QRawFont, resulting in multi-engine instead of the specific cloned engine. Task-number: QTBUG-25410 Change-Id: I08f543e541739ac1b51f96f381ae1bb20b59399a Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com> Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com>
* replace hardcoded values with a surrogate handling methodsKonstantin Ritt2012-04-131-6/+6
| | | | | | Change-Id: Ib41e08d835f2e8ca2e32b4025c6f5a99840f2e27 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com> Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
* Remove historical +1 from font height calculationEskil Abrahamsen Blomfeldt2012-02-171-3/+1
| | | | | | | | | | | 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>
* Windows: Fix compilation with -qtnamespaceKai Koehne2012-01-311-2/+0
| | | | | 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>
* Move glyphMargin() to QFontEngineJiang Jiang2012-01-241-1/+2
| | | | | | | | | | | | | 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>
* Use freetype font engine on WindowsOlli Werwolff2011-10-101-0/+1
| | | | | | | | | | | | | | | 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>