summaryrefslogtreecommitdiff
path: root/vcl/inc/impfontcache.hxx
AgeCommit message (Collapse)Author
2018-10-30Rely on the font instance of the glyphJan-Marek Glogowski
The FreetypeFont might already have released the font instance of the glyph, but the glyphs font instance must still be valid, so use this instead to cache glyph bound rect. For whatever reason the Windows compiler doesn't accept inline functions in the GlyphItem struct and wants to export them in the DLL, even when declared VCL_DLLPRIVATE, so this just uses static inlines as a workaround. Change-Id: I4539d91a846a54a05f9648638494e1e99f704b0a Reviewed-on: https://gerrit.libreoffice.org/62425 Tested-by: Jenkins Reviewed-by: Jan-Marek Glogowski <glogow@fbihome.de>
2018-10-23Antialias drawing is part of the font selectionJan-Marek Glogowski
At least on Windows antialias-drawing has to be selected via LOGFONTW.lfQuality passed to CreateFont, so InitFont is too late. Change-Id: Ie81c5f0074fdbcf1f0e74fbff31a5df663a67884 Reviewed-on: https://gerrit.libreoffice.org/62200 Tested-by: Jenkins Reviewed-by: Jan-Marek Glogowski <glogow@fbihome.de>
2018-10-06Convert ImplFontCache to use o3tl::lru_mapJan-Marek Glogowski
We still do our own cleanup of the LRU map, as we can't drop any fonts in use. Change-Id: I8ec5c6ce8f80893635621357e9085950e7010f5b Reviewed-on: https://gerrit.libreoffice.org/61455 Tested-by: Jenkins Reviewed-by: Jan-Marek Glogowski <glogow@fbihome.de>
2018-10-06Add a glyph-bound-rect cache to the font cacheJan-Marek Glogowski
This way the font cache can correctly invalidate the cached glyph rects when a font is dropped from the cache. Change-Id: I050866099742334f01cac1b872228a017ddb5e9b Reviewed-on: https://gerrit.libreoffice.org/61371 Tested-by: Jenkins Reviewed-by: Jan-Marek Glogowski <glogow@fbihome.de>
2018-08-22rename FontSelectPatternAttributes to FontSelectPatternCaolán McNamara
Change-Id: I2c018e2e61707c0d89178b0cb38a0918906e23cb Reviewed-on: https://gerrit.libreoffice.org/59390 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
2018-08-22turn the cache around to work on LogicalFontInstanceCaolán McNamara
instead of a FontSelectPattern with an associated LogicalFontInstance use a LogicalFontInstance with owned FontSelectPatternAttributes Change-Id: I939f84731fcb8db5ff6484dcfbd2f9199bb50d23 Reviewed-on: https://gerrit.libreoffice.org/59388 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
2018-08-20these just use the base FontSelectPatternAttributesCaolán McNamara
Change-Id: I0c5ffe571c2cf37ec7d20d4d3ae965227cd72b7e Reviewed-on: https://gerrit.libreoffice.org/59314 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
2018-06-08hold LogicalFontInstance with rtl::ReferenceNoel Grandin
instead of manual reference counting. Also the releasing of not-currently-in-use LogicalFontInstance objects from the cache is made less aggressive - we now only flush entries until we have less than CACHE_SIZE instances, instead of flushing the whole cache. Change-Id: Ib235b132776b5f09ae8ae93a933c2eebe5fa9610 Reviewed-on: https://gerrit.libreoffice.org/55384 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-05-07Move PhysicalFontFace member of FontSelectPatternJan-Marek Glogowski
A FontSelectPattern describes a general font request. It can be used to find the best matching LogicalFontInstance. The instance will be created based on a PhysicalFontFace, which is really a factory since commit 8b700794b2746070814e9ff416ecd7bbb1c902e7. Following this workflow, this moves the PhysicalFontFace pointer to the instance and makes it constant. Which leaves some special symbol font handling code in the hash and instance lookup code path. It used to query the font face directly from the instance. I'm not sure of the correct handling. The related commits where made to fix #i89002#, which has an attached test document. 1. commit 849f618270da313f9339dda29a9f35938434c91d 2. commit 8c9823d311fdf8092cc75873e4565325d204a658 The document is as broken as it was before the patch. The symbol substitution still works, but the 'Q's are missing when displaying a symbol font. I also don't understand all the reinterpret_casts for fake font ids. I guess this was used to prevent the crashes I see, where a PhysicalFontFace referenced in a valid LogicalFontInstance is freed and a later FontId check in the GlyphCache crashes. So this now checks for a valid cache instead. Change-Id: If8ee5a6288e66cfa4c419289fbdd5b5da128c6ea Reviewed-on: https://gerrit.libreoffice.org/47279 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Khaled Hosny <khaledhosny@eglug.org>
2017-12-28Try to handle fonts orphaned from cache gracefullyMike Kaganski
ImplFontCache::Invalidate deletes unused entries (with zero ref count), and keeps other entries, but clears everything (including still used fonts) from its instance list. In the same time, those fonts' mpFontCache pointers kept pointing to this cache object. External clients released font instance by calling its cache's Release method; this itself allows for broken invariants that cache's mnRef0Count is equal to number of unused font instances in its list. Also, those fonts never got released, leaking because ImplFontCache only ever deletes objects in its list. What is worse, sometimes font caches get deleted after invalidation (see OutputDevice::ImplClearFontData). As the instance list of the cache is empty at the point of delete, the cache destructor doesn't delete those fonts that were orphaned at the moment of invalidation (those fonts are still used by some client objects, so deleting them is clearly wrong). But since the font instances still have cache pointer referring the already deleted cache, releasing the instances (by calling deleted cache's Release member function) must lead do some weird results. This patch moves the Acquire/Release to LogicalFontInstance, which now checks if its cache pointer is valid, and if it is, the cache is used to do the work (as before); otherwise, the font handles its lifetime itself, and deletes itself when its reference counter is zero. The cache invalidation clears the cache pointer of the still-used instances. Change-Id: I29811272dda814cbc81f14668d63e385ce772332 Reviewed-on: https://gerrit.libreoffice.org/47111 Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com> Tested-by: Mike Kaganski <mike.kaganski@collabora.com>
2017-07-18loplugin:constparams in vclNoel Grandin
Change-Id: I36afe2107e07ffb9b73c0b76be600e3e999a0fd4 Reviewed-on: https://gerrit.libreoffice.org/40116 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2016-01-14vcl: move ImplFontCache into own private headerChris Sherlock
Change-Id: Ic4444f54fabe03319de9add93653f6b7c91d6fce