summaryrefslogtreecommitdiff
path: root/vcl/inc/sallayout.hxx
AgeCommit message (Collapse)Author
2020-03-16Revert "loplugin:constfields in vcl"Noel Grandin
This reverts commit 59887868da3499c68d5f259cfa48178354397448. Change-Id: I0f3f6a7680c78103a559a0f881badc8211b97ace Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90544 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-11-03make some classes module-privateNoel Grandin
improve the script, but it still generates some false positives Change-Id: If8ee1cba8c04ac0be11f73220149e6de15f24f44 Reviewed-on: https://gerrit.libreoffice.org/81929 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-06-13tdf#42949 Fix IWYU warnings in vcl/inc/*Gabor Kelemen
Platform-specific subdirs are left alone: android, ios, osx, quartz, win Found with bin/find-unneeded-includes Only removal proposals are dealt with here. Change-Id: Icbb906b7fbc960240c73c56d3dae2a78b06a0f53 Reviewed-on: https://gerrit.libreoffice.org/73754 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2019-03-22Related: tdf#124109 vcl: make glyph item caching work with kashida glyphsMiklos Vajna
This was broken because GenericSalLayout::LayoutText() sets the SalLayoutFlags::KashidaJustification flag as a side-effect of building the glyph list. So in case we cache the list and not build it, the flag will be missing. This means that later in GenericSalLayout::ApplyDXArray() kashida glyphs won't be inserted. With this, the workaround in sw can be removed. Change-Id: Ic18211bf50ca673daa238e8950a381915e4b3096 Reviewed-on: https://gerrit.libreoffice.org/69566 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
2019-03-11merge SalLayoutGlyphsImpl and SalGenericLayoutGlyphsImplNoel Grandin
Change-Id: I5697d2b7961ce714835316879610f23aeabbd8ec Reviewed-on: https://gerrit.libreoffice.org/69030 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-01-25Assert missing SalGraphics font on GetTextLayoutJan-Marek Glogowski
Trying to layout text without a font can't work. Without a font, currently the text is simply not painted, but this is still a programming error, so warn the developer. And we can get rid of all the intermediate OutputDevice font and gpahics checks, as everything now uses Harfbuzz and there won't be any layout which can't use the cached runs, so just generate them directly. Change-Id: Iae1fab0afeefec1cb1ca82c4e5d8dcbe9919859d Reviewed-on: https://gerrit.libreoffice.org/66818 Tested-by: Jenkins Reviewed-by: Jan-Marek Glogowski <glogow@fbihome.de>
2019-01-23loplugin:constparams in vclNoel Grandin
Change-Id: Icf1a952fbe190fd6c4efd89364136aa2b48050e3 Reviewed-on: https://gerrit.libreoffice.org/66767 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-10-30Move SalGraphics glyph functions into FontInstanceJan-Marek Glogowski
As we already rely on the GlyphItem's font instance, consequently this removes the SalGraphics GlyphItem based functions. Also unifies the glyph bound rect cache handling. An interesting aspect is the rotated glyph bounding box handling moved from CairoTextRender to FreetypeFont. It doesn't look like an implementation detail for Cairo, so it may have been a bug. Change-Id: I81bbb5d8ee98fb77a1eee05568c456f9e4553023 Reviewed-on: https://gerrit.libreoffice.org/62503 Tested-by: Jenkins Reviewed-by: Jan-Marek Glogowski <glogow@fbihome.de>
2018-10-30tdf#120982 add font reference to SalLayoutGlyphsImplJan-Marek Glogowski
Now that we store the LogicalFontInstance instead of the fallback level, it's not enough to keep a pointer in the glyphs in SalLayoutGlyphsImpl. We also need a reference to the font, to keep the font instance alive. Change-Id: Idc99cf9259af6be672a97ab2c67dbffd9cf29c70 Reviewed-on: https://gerrit.libreoffice.org/62520 Tested-by: Jenkins Reviewed-by: Jan-Marek Glogowski <glogow@fbihome.de>
2018-10-30Hide SalLayoutGlyphs detailsJan-Marek Glogowski
Nobody outside of VCL should deal with GlyphItems. Change-Id: Id84b0f320bc49f790658f23efe129b92262c2aea Reviewed-on: https://gerrit.libreoffice.org/62446 Tested-by: Jenkins Reviewed-by: Jan-Marek Glogowski <glogow@fbihome.de>
2018-10-25Change GlyphItem::nFallbackLevel to font instanceJan-Marek Glogowski
No need for a real reference, as GlyphItems are bound to their GenericSalLayout, which holds the valid reference and doesn't allow font change. Change-Id: I8e1129ef99f576e43d55f39aee040ceeb635d51d Reviewed-on: https://gerrit.libreoffice.org/62359 Reviewed-by: Khaled Hosny <khaledhosny@eglug.org> Tested-by: Jenkins Reviewed-by: Jan-Marek Glogowski <glogow@fbihome.de>
2018-10-25Move GlyphItem into its own headerJan-Marek Glogowski
Actually GlyphItem should be VCL internal, but this requires a transparent SalLayoutGlyphs (i.e. via pImpl), which I'm too lazy to implement currently. This seperation makes the affected source files more obvious and later migration of vcl/glyphitem.hxx easier. While at it apply the coding style and add '_' to member prefix. Change-Id: I61497af5c628c40f51597ce0ef286c47321acbc2 Reviewed-on: https://gerrit.libreoffice.org/62358 Tested-by: Jenkins Reviewed-by: Jan-Marek Glogowski <glogow@fbihome.de>
2018-10-25Drop duplicate PhysicalFontFace referenceJan-Marek Glogowski
A LogicalFontInstance has a pointer to its parent font face. And don't pretend we can actually nest MultiSalLayout, so store the GenericSalLayout internally. Change-Id: I801acbc34497fc57e8e185eee34c1a1162dbea93 Reviewed-on: https://gerrit.libreoffice.org/62314 Tested-by: Jenkins Reviewed-by: Jan-Marek Glogowski <glogow@fbihome.de>
2018-09-14loplugin:constfields in vclNoel Grandin
Change-Id: I1072642be4fdfa720e61f2d7bad3c2701eb81610 Reviewed-on: https://gerrit.libreoffice.org/60430 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-08-16vcl: use SalLayoutGlyphs, not SalLayout for pre-computed layoutMiklos Vajna
This means that the pre-computed glyph ids and positions are usable with multiple dx array or draw base. So the amount of cached data is smaller, but it can be used in more situations, most importantly Writer's SwFntObj::DrawText() use-case (which does GetTextArray() followed by a DrawTextArray(), with different dx array arguments). Change-Id: I3bcd1b7a015c2cf9921efa0f3f355f2c627fb652 Reviewed-on: https://gerrit.libreoffice.org/59207 Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk> Tested-by: Jenkins
2018-08-16vcl: support pre-computed glyph items in OutputDevice::ImplLayout()Miklos Vajna
This allows using the SalLayoutGlyphs obtained from GenericSalLayout::GetGlyphs() to return early in GenericSalLayout::LayoutText(). Change-Id: If3a004f983f3578915786668bfcada00227d2eeb Reviewed-on: https://gerrit.libreoffice.org/59169 Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk> Tested-by: Jenkins
2018-08-16vcl: introduce a SalLayoutFlags::GlyphItemsOnlyMiklos Vajna
OutputDevice::ImplLayout() does a number of things: first it calls the expensive SalLayout::LayoutText(), then it does a number of remaing tweaks to the resulting SalLayout based on the rLogicalPos and pDXArray parameters. This means that the resulting layout is not easy to reuse for Writer purposes, as it typically operates with the same text multiple times, but with different LogicalPos/DXArray. Add a new flag that returns the glyph items early, with the hope that this way the result only depends on the output device state and the string only, nothing else. Change-Id: I7c4a23d0f230495c8ba0ebbd1cfc3421e4a6e43c Reviewed-on: https://gerrit.libreoffice.org/59159 Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk> Tested-by: Jenkins
2018-08-10vcl: separate SalLayout from the rest of sallayout.hxxMiklos Vajna
This way SalLayout can be created separately (and potentially reused) outside vcl as well. Don't reformat the moved code, so git blame keeps working. This is a first step towards the goal of <https://wiki.documentfoundation.org/Development/Budget2017#Text_layout_performance>, in the context of code outside vcl. Change-Id: I8b40313b5fa531d3b56c153cbc4b5ca3cec8f8df Reviewed-on: https://gerrit.libreoffice.org/58851 Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk> Tested-by: Jenkins
2018-07-24GetCharWidths always returns trueCaolán McNamara
Change-Id: I4a58b203a7c18484c3405f918e77297ac764725d Reviewed-on: https://gerrit.libreoffice.org/57925 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-12Make SalLayout overrides finalKhaled Hosny
We really don’t want anyone to subclass these classes and introduce new text layout inconsistencies. Change-Id: I38d046dc2fab602fd262dc43ac86b55fb0c59db2 Reviewed-on: https://gerrit.libreoffice.org/54153 Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Khaled Hosny <khaledhosny@eglug.org>
2018-05-12SalLayout::CalcAsianKerning() can be made localKhaled Hosny
Change-Id: Ieff9fda888112e98236d846aa6cf9140be8b355a Reviewed-on: https://gerrit.libreoffice.org/54152 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Khaled Hosny <khaledhosny@eglug.org>
2018-05-12Drop trivial, used only once, functionsKhaled Hosny
Change-Id: I387dd91464b211eb892dd4a3adc0b8dae6f84fa2 Reviewed-on: https://gerrit.libreoffice.org/54097 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Khaled Hosny <khaledhosny@eglug.org>
2018-05-11Fold CommonSalLayout into GenericSalLayoutKhaled Hosny
Now the crazy constructors of CommonSalLayout are gone, we can merge the two and drop one level of indirection. Change-Id: I166e4ed2c9d22c1ce75246d486f7526c4928f652 Reviewed-on: https://gerrit.libreoffice.org/54077 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Khaled Hosny <khaledhosny@eglug.org>
2018-04-27tdf#66597 Fix PDF text extraction for complex textKhaled Hosny
Implement a more through strategy for embedding textual content in PDF files: * If there is unique one to one or one to many mapping between each glyph index and Unicode code points, use ToUnicode CMAP. * If there is many to one or many to many mapping, use an ActualText span embedding the original string, since ToUnicode can’t handle these. * If the one glyph is used for several Unicode code points, also use ActualText since ToUnicode can map each glyph in the font only once. * Limit ActualText to single cluster at a time, since using it for whole words or sentences breaks text selection and highlighting in PDF viewers (there will be no way to tell which glyphs belong to which characters). * Keep generating (now) redundant ToUnicode entries for compatibility with old tools not supporting ActualText. Change-Id: I33261811b59b3b8fe2164c2c21d3c52c417e6208 Reviewed-on: https://gerrit.libreoffice.org/53315 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
2018-04-25Simplify and rename SalLayout::GetNextGlyphsKhaled Hosny
It is now always called with nLen == 1, so simplify and rename. The criteria for deciding how many glyphs to return was bogus anyway, good riddance. Change-Id: Iff578d124ab40a0dfa84469be8e0e9fc1b6b8c48 Reviewed-on: https://gerrit.libreoffice.org/53406 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Khaled Hosny <khaledhosny@eglug.org>
2018-04-22Rename GlyphItem::IsClusterStart() → IsInCluster()Khaled Hosny
The flag is called IS_IN_CLUSTER and the only place that uses it checks for !IsClusterStart(), so invert the condition and rename it accordingly. Change-Id: I0feaf27ee671883f111340bcd9ffcb4e3782005f Reviewed-on: https://gerrit.libreoffice.org/53276 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Khaled Hosny <khaledhosny@eglug.org>
2018-04-22sal_GlyphId can be 16 bit nowKhaled Hosny
OpenType glyph ids are 16 bit unsigned integers, but we were using 32 bit integer and abusing the higher bits to set glyph flags. All such abuses are now gone and we can make it a simple 16 bit integer. Change-Id: I594068675f239fd525376fd9ea752462ec3edd9d Reviewed-on: https://gerrit.libreoffice.org/53270 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Khaled Hosny <khaledhosny@eglug.org>
2018-04-22Don’t abuse glyph id for flagging dropped glyphsKhaled Hosny
Use a bitflag instead. Change-Id: I7833a37578112b5326f4a30578596e53085ff3c0 Reviewed-on: https://gerrit.libreoffice.org/53269 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Khaled Hosny <khaledhosny@eglug.org>
2018-04-22Drop header that had just one typedefKhaled Hosny
Move the typedef elsewhere. Change-Id: I7a91ffd5ed4d1f182d6d57c80eb5188892fa5ccd Reviewed-on: https://gerrit.libreoffice.org/53268 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Khaled Hosny <khaledhosny@eglug.org>
2018-04-21Drop GlyphItem constructor that is used only onceKhaled Hosny
Change-Id: I36aed033ea811daf2dfae89a89cf0ff5fc86b270 Reviewed-on: https://gerrit.libreoffice.org/53257 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Khaled Hosny <khaledhosny@eglug.org>
2018-03-21tdf#115117: Fix PDF ToUnicode CMAP for ligaturesKhaled Hosny
Move the glyph to character(s) mapping to CommonSalLayout where we have enough information to do this properly. This correctly handles ligatures at end of run that wasn’t handled before, and also fixes a bug in the PDF writer code when there is more than one ligature in the run (it forgot to clear aCodeUnitsPerGlyph vector after each iteration). Also drop the “temporary” fix for rotated glyph from 2009 that does not seem to be needed now (the document from that bug exports correctly after this change). Change-Id: I5b5b1f4470bbd0ef05cbbc86dfa29d2ff51249ea Reviewed-on: https://gerrit.libreoffice.org/51617 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
2018-03-08loplugin:unusedfieldsNoel Grandin
Change-Id: Id332557cbe7fb42d3d794612f26aa3ac161548d9 Reviewed-on: https://gerrit.libreoffice.org/50902 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-11-17loplugin:useuniqueptr in MultiSalLayoutNoel Grandin
Change-Id: I57ac9cf988dfccfcb38c69ca9c66c2ad77bbdada Reviewed-on: https://gerrit.libreoffice.org/44819 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-11-14use std::unique_ptr for SalLayoutNoel Grandin
to make the ownership passing around more obvious Change-Id: I147ec6d9cfe7566cf3600685e0730ed741c2d90d Reviewed-on: https://gerrit.libreoffice.org/43454 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-11-03loplugin:constparam in vcl,svtoolsNoel Grandin
Change-Id: I7a3eb2bfda869e9e66db919f929ead60cf8890a4 Reviewed-on: https://gerrit.libreoffice.org/44209 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-10-05loplugin:finalclasses in vclNoel Grandin
Change-Id: I7de9cd6c5569217aa8d379c6d112cd1874bca8e2 Reviewed-on: https://gerrit.libreoffice.org/43151 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
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>
2017-06-17loplugin:unusedfields in vcl part3Noel Grandin
Change-Id: I5a6319ba1667af6e9b7b92c22f858188c28c4c61 Reviewed-on: https://gerrit.libreoffice.org/38835 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-06-07Replace vcl::SalLayout Release with destructorTamas Bunth
Replace SalLayout::Release() with normal destructor mechanism. Release() uses reference counting for the layout. But in practice, the reference counting variable is initialized in ctor and is not incremented elsewhere. So I removed the Release() method and replaced all the Release() calls with 'delete'. It will make easier the use of smart pointers and decrease the chance of memory leaks. Change-Id: Ia2e142dea10b87e232d5757d84778e62d87cf081 Reviewed-on: https://gerrit.libreoffice.org/38488 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
2017-04-26use strong_int for LanguageTypeNoel Grandin
Change-Id: If99a944f7032180355da291ad283b4cfcea4f448 Reviewed-on: https://gerrit.libreoffice.org/36629 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-03-31tdf#82580 tools: rename Rectangle to tools::RectangleMiklos Vajna
Mostly generated using make check COMPILER_EXTERNAL_TOOL=1 CCACHE_PREFIX=clang-rename-wrapper RENAME_ARGS="-qualified-name=Rectangle -new-name=tools::Rectangle" Except some modules have their own foo::tools namespace, so there have to use ::tools::Rectangle. This commit just moves the class from the global namespace, it does not update pre/postwin.h yet. Change-Id: I42b2de3c6f769fcf28cfe086f98eb31e42a305f2 Reviewed-on: https://gerrit.libreoffice.org/35923 Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk> Tested-by: Jenkins <ci@libreoffice.org>
2017-03-29loplugin:unusedmethodsNoel Grandin
Change-Id: Ib008613fb06c82791c63d5b074a3e2ff1c3607a0 Reviewed-on: https://gerrit.libreoffice.org/35834 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-02-21loplugin:unusedmethodsNoel Grandin
Change-Id: I52a9f16f3ed543a3c83ca111df70e3f7ae1ef33c Reviewed-on: https://gerrit.libreoffice.org/34508 Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-01-27DisableGlyphInjection does nothingKhaled Hosny
Change-Id: Ie97eac46fde075bd74c7adb583b8be979f3af829
2016-12-23loplugin:unusedmethodsNoel Grandin
Change-Id: Ife4c8d948ffa116f044d43903de9485e43cfcae5 Reviewed-on: https://gerrit.libreoffice.org/32336 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2016-12-11Drop SalLayout::IsSpacingGlyph()Khaled Hosny
Replace it with a check from ICU that actually makes sense. Change-Id: Ie8789444a967420d58f5575f42bc45677bfa96a1 Reviewed-on: https://gerrit.libreoffice.org/31822 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Khaled Hosny <khaledhosny@eglug.org>
2016-12-11Don’t encode font fallback level in the glyph idKhaled Hosny
Change-Id: I747d969c3c1dc42b1a3b5d12d06fed3af9a64675 Reviewed-on: https://gerrit.libreoffice.org/31818 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Khaled Hosny <khaledhosny@eglug.org>
2016-12-11Don’t encode the vertical flag in the glyph idKhaled Hosny
Change-Id: I00485dd4d42004e4eaa163a9e6ad0a43cf98a30a Reviewed-on: https://gerrit.libreoffice.org/31816 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Khaled Hosny <khaledhosny@eglug.org>
2016-12-10Remove noop SalLayout::UseCommonLayout()Khaled Hosny
Change-Id: Ifc143f33bc4e087726ada1e3b1b5182bf830b0cb Reviewed-on: https://gerrit.libreoffice.org/31821 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Khaled Hosny <khaledhosny@eglug.org>