summaryrefslogtreecommitdiff
path: root/sw/source/core/txtnode/fntcache.cxx
AgeCommit message (Collapse)AuthorFilesLines
2019-10-19Avoid -fsanitize=nullptr-with-nonzero-offsetStephan Bergmann1-3/+4
(new with recent Clang 10 trunk) Change-Id: Ifeac10c2aecb6da4f1c87e565bb26dfccc11432a Reviewed-on: https://gerrit.libreoffice.org/81112 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-10-18mnFontCacheIdCounter is only used in SwFntAccess::NewObjStephan Bergmann1-3/+3
(and while at it, drop the misleading "m" prefix) Change-Id: Ib52ef1bb54c8fc627503bdf74e594df1fe4a5801 Reviewed-on: https://gerrit.libreoffice.org/81035 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-10-07Fix FIXME in swcache.hxxJulien Nabet1-1/+1
by getting rid of useless IsAvail() function Change-Id: I7c3bbf74a9ef3aaa792936ef2b4887021226dd2a Reviewed-on: https://gerrit.libreoffice.org/80327 Tested-by: Jenkins Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2019-09-29tdf#127422 draw text with correct pKernArray values.Mark Hung1-18/+10
Prior to 5f62b97ae7891b8c601f6093a1ec5358feb20790, Starting position was specified and DrawText was used to render the text without referring to pKernArray. After the patch, DrawTextArray was used but pKernArray was not update correctly. Instead of draw each substring seprated by space, this patch increases the values pKernArray when a space is encountered and call DrawTextArray only once. Change-Id: I9e61b2d0608400f26136490248740c5f00b56cc3 Reviewed-on: https://gerrit.libreoffice.org/79544 Tested-by: Jenkins Reviewed-by: Mark Hung <marklh9@gmail.com>
2019-07-01Improve the looks of a wave line by draw it with bezier curvesTomaž Vajngerl1-4/+7
This adds drawing the wave line (typically used to underline the wrongly spelled words) with bezier curves. Previously the wave lines were drawn with drawing pixels, which didn't look that good, especially on HiDPI display, so the looks of wave lines now is therefor much better. The creation of the wave line as a polygon has been added to the basegfx module, so it can be reused if needed. In addition, everytime we draw the waveline, we have to enable antialiasing, to have a much better quality of the curves. By default the antialiasing is disabled for some reason. This also adds ScopedStates.hxx file which currently includes ScopedAntialiasing, which sets the antialiasing to a certain state for the time the object is in scope, and then sets it back to the original state. Change-Id: I4b866fc5d69725eb7f6f78a1acf4176b1205aa73 Reviewed-on: https://gerrit.libreoffice.org/74810 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2019-06-05Linguistic: new underlining styles for grammar checkersOlivier R1-7/+24
This patch adds two new underlining styles: - BOLDWAVE: a thicker version of the default WAVE style - BOLD: a thick straight line No default setting changed. It's up to the grammar checkers to specify the underlining style they want. This contribution to LibreOffice is licensed under the MPLv2/LGPLv3+ dual license. modified : include/vcl/outdev.hxx modified : offapi/com/sun/star/text/TextMarkupDescriptor.idl modified : sw/source/core/inc/wrong.hxx modified : sw/source/core/txtnode/fntcache.cxx modified : vcl/source/outdev/textline.cxx modified : vcl/workben/outdevgrind.cxx Change-Id: I5629253905ba40c51cc748a7ceeb84170ef5d94c Reviewed-on: https://gerrit.libreoffice.org/73412 Tested-by: Jenkins Reviewed-by: Michael Stahl <Michael.Stahl@cib.de>
2019-04-15improve loplugin simplifyconstructNoel Grandin1-1/+1
to find stuff like OUString s = OUString("xxx") Change-Id: Ie7ed074c1ae012734c67a2a89c564c1900a4ab04 Reviewed-on: https://gerrit.libreoffice.org/70697 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-03-22Related: tdf#124109 vcl: make glyph item caching work with kashida glyphsMiklos Vajna1-10/+1
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-22Related: tdf#124109 sw: save one vcl layout call in SwFntObj::DrawText()Miklos Vajna1-1/+11
Commit 436b829f5b904d76039db0818cff5dedf1ae89f1 (sw: save one vcl layout call in SwFntObj::DrawText(), 2018-08-16) did this unconditionally, which broke kashida justification. Re-introduce the same mechanism, but this time opt out in the kashida case to keep that working. This means that for Latin scripts we are back to 2 layout calls (instead of 3) for each keypress in Writer. Change-Id: I890f0ab04d1f5dce561f1536d7c8a6d67a639813 Reviewed-on: https://gerrit.libreoffice.org/69557 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
2019-03-22tdf#124109: Fix missing kashida glyphsKhaled Hosny1-2/+1
This partially reverts: commit 436b829f5b904d76039db0818cff5dedf1ae89f1 Author: Miklos Vajna <vmiklos@collabora.co.uk> Date: Thu Aug 16 17:35:17 2018 +0200 sw: save one vcl layout call in SwFntObj::DrawText() Pressing a key in Writer used to lay out the relevant string 4 times (counting GenericSalLayout::LayoutText() invocations), save one of them by pre-calculating the layout and sharing it between GetTextArray() and DrawTextArray(). The reverted part was causing inserted Kashida to be missing, leaving gaps inside the words. See attachment in the bug report. Change-Id: Iaafbc793ed5906e6fdf3dcb03c54d5a440e15da4 Reviewed-on: https://gerrit.libreoffice.org/69530 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2019-03-21tdf#124109: Revert "Only do kashida insertion with fonts that have non-zero ↵Khaled Hosny1-6/+3
width kashidas" This reverts commit c45b23377bb2fe44c26f1287ff38495344e4ca50. This commit breaks Kashida justification when a document is first opened (the kashida justification will be disabled and spaces will be used untill the text is changed). Probably it is checking for width of Kashida glyph too early. Also I'm not sure what the reverted commit was trying to fix since we already do kashida justification in fonts that has non-zero width Kashida and it has been the case for a long time. This does not fix the original issue in the document attched with the bug report, but if fixes kashida not being applied when opening the document. Change-Id: Ic95859bca94fa792793e3223d2adb465bc6d880f Reviewed-on: https://gerrit.libreoffice.org/69509 Tested-by: Jenkins Reviewed-by: Xisco Faulí <xiscofauli@libreoffice.org>
2019-03-11sw: prefix members of SwCalendarWrapper, SwDoc and SwFntAccessMiklos Vajna1-2/+2
Change-Id: Ia233670c8cc01442aa91588fd7aa5d65443af077 Reviewed-on: https://gerrit.libreoffice.org/69033 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
2019-02-13sw btlr writing mode layout: implement unmapping of this directionMiklos Vajna1-11/+14
Fix various cases which trigger this warning: warn:legacy.osl:10975:10975:sw/source/core/txtnode/swfont.cxx:427: Unsupported direction Which means that we tried to work with a VCL direction of 900, without passing around the btlr flag accordingly. Change-Id: I96374fc949f60e8324c5a84de48b710b6461bafb Reviewed-on: https://gerrit.libreoffice.org/67746 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2019-02-10loplugin:indentation in swNoel Grandin1-1/+3
Change-Id: I4936284bff568b6bb47e5df3821f4ddd78260e92 Reviewed-on: https://gerrit.libreoffice.org/67568 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-01-24loplugin:constparams in swNoel Grandin1-1/+1
Change-Id: I4a0f51eae28c82eca3c44b9d06c0410f9645f62f Reviewed-on: https://gerrit.libreoffice.org/66833 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-01-11use unique_ptr in swNoel Grandin1-4/+4
Change-Id: I471875142391e537a4301dfe42beb8f8803ff46b Reviewed-on: https://gerrit.libreoffice.org/66036 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-11-25drop unnecessary vcl/window.hxx includes in writerCaolán McNamara1-1/+0
Change-Id: I9bf20f2b4a20444f910738e42789b219efcf51fd Reviewed-on: https://gerrit.libreoffice.org/63977 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
2018-11-25tdf#120703 PVS: V560 A part of conditional expression is always true/falseMike Kaganski1-3/+2
Change-Id: If173f42302553b164267909a0a3156bb25a6d558 Reviewed-on: https://gerrit.libreoffice.org/63957 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2018-11-15sw_redlinehide_3: trivial conversions in new code in fntcache.cxxMichael Stahl1-5/+5
Change-Id: Id625ee27e69800780c04ea80d888f606cde0f308
2018-11-08loplugin:constantparamNoel Grandin1-1/+1
Change-Id: I593ccc2fb43321caf3ff64d0c348b1bac742ad18 Reviewed-on: https://gerrit.libreoffice.org/63025 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-11-01tdf#121030 invalidate referenced FontInstancesJan-Marek Glogowski1-1/+1
This sets the FreetypeFont pointer of the FreetypeFontInstances to nullptr when clearing the cache. And it changes the interface functions of SalLayoutGlyphs to some variant different from std::vector. I don't know if we should prefer the mutable or the const font instance. With mutable at least one can invalidate the font instance when checking the IsValid(), so we can get rid of our referenced font instance. Change-Id: I6070cfcb3c549dbad3383bd4ec2b05b30645b753 Reviewed-on: https://gerrit.libreoffice.org/62688 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
2018-10-25Always check IsVirtual() in SwFntObj::DrawTextJan-Marek Glogowski1-2/+2
I tried to use the new OUTDEV_PDF in replacement for the PDF export check. It survived Jenkins and local builds, but sometimes a tinderbox breaks, so check IsVirtual() instead. Change-Id: I64fe7c145dc3b87345f6a967f6b2997f3c7e38c2 Reviewed-on: https://gerrit.libreoffice.org/62366 Tested-by: Jenkins Reviewed-by: Jan-Marek Glogowski <glogow@fbihome.de>
2018-10-25Move GlyphItem into its own headerJan-Marek Glogowski1-0/+1
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-24Introduce OutputDevice type OUTDEV_PDFJan-Marek Glogowski1-4/+4
Originally I thought mpPDFWriter can be used to create PDF from any OutputDevice, but it's actually just set for the internal VirtualDevice of the PDF writer. So this gets rid of all the special mpPDFWriter and GetPDFWriter() handling and replaces it with checks for OUTDEV_PDF. But since ImplPDFWriter used to be a OUTDEV_VIRDEV, this also introduces OutputDevice::IsVirtual(), which now replaces most of the direct OUTDEV_VIRDEV checks. Change-Id: I11824143b6b8833ecc81119762448cbdf1145dbc Reviewed-on: https://gerrit.libreoffice.org/62257 Tested-by: Jenkins Reviewed-by: Jan-Marek Glogowski <glogow@fbihome.de>
2018-10-12tdf#119992 sw: compare sub-strings in SwTextGlyphsKey comparisonMiklos Vajna1-3/+10
Time till the layout reaches idle, before: 77.412 seconds After: 26.221 seconds (33% of baseline) for me. Change-Id: Idd0c5255070c836fde2fb048b02c851f5f2321e4 Reviewed-on: https://gerrit.libreoffice.org/61724 Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk> Tested-by: Jenkins
2018-10-09tdf#119993 sw: clear the font cache text glyphs on table col changeMiklos Vajna1-0/+6
This helps not storing pre-computed vcl text layouts which are most probably never re-used anymore. Approximate numbers for memory usage with 10 column resizes for the bugdoc: - old: 310MB -> 454MB - new: 309MB -> 310MB Change-Id: Ifb88b88e1bffe2c2670089930fc2d22ff19576ce Reviewed-on: https://gerrit.libreoffice.org/61562 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
2018-10-03loplugin:constfields in swNoel Grandin1-3/+3
Change-Id: I1eb6583bb9ec815bc0564b0d7c676f5b1fb9045f Reviewed-on: https://gerrit.libreoffice.org/61177 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-09-17tdf#119820 sw: optimize SwTextGlyphsKey comparisonMiklos Vajna1-4/+9
Import time before: 12.192 seconds After: 5.836 seconds (47.87% of baseline) for me. Change-Id: Ifd650addaae3fe25b45cf0fd452f78372e60c467 Reviewed-on: https://gerrit.libreoffice.org/60591 Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk> Tested-by: Jenkins
2018-09-07sw: less vcl text layout calls in SwFont::GetTextBreak()Miklos Vajna1-1/+8
Number of GenericSalLayout::LayoutText() calls during "dt<F3>" in Writer: 105 -> 89. Change-Id: I0f2bb241536209cfccc1d78bed6f54bf5c31e627 Reviewed-on: https://gerrit.libreoffice.org/60133 Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk> Tested-by: Jenkins
2018-09-04sw: less vcl layout calls in SwFntObj::GetCursorOfst()Miklos Vajna1-1/+3
GenericSalLayout::LayoutText() calls for a single word document's initial layout: 5 -> 4. Change-Id: If806b6f91faef1a5ad56b3439efc12bbabe030af Reviewed-on: https://gerrit.libreoffice.org/59973 Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk> Tested-by: Jenkins
2018-09-03use less magic in sw/Noel Grandin1-10/+10
rename the "magic" members and fields that are actually a font-cache-id, to more useful names Change-Id: Ie787b0939115c576e979c7e27a21a68c138c32f6 Reviewed-on: https://gerrit.libreoffice.org/59868 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-09-03sw: save more vcl layout calls in SwFntObjMiklos Vajna1-16/+40
This builds on top of commit 436b829f5b904d76039db0818cff5dedf1ae89f1 (sw: save one vcl layout call in SwFntObj::DrawText(), 2018-08-16), but now layouts are shared not only inside SwFntObj::DrawText(), but also between SwFntObj::GetTextSize() and SwFntObj::DrawText(). To get there, create an SwFntObj cache member that stores already calculated vcl layouts. SwFntObj already derives from SwCacheObj, so no need to explicitly expire this cache member. Total number of GenericSalLayout::LayoutText() invocations go down from 8 to 5 with this when pressing a key in Writer. Change-Id: Ifbe84a5c00025604f9c1331b56074b3dc27864b5 Reviewed-on: https://gerrit.libreoffice.org/59879 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
2018-08-31pWaveCol can just be a file local constantNoel Grandin1-3/+3
Change-Id: Iff44dae790793701e00f5394d5fb786059bd7c7c Reviewed-on: https://gerrit.libreoffice.org/59862 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-08-16sw: save one vcl layout call in SwFntObj::DrawText()Miklos Vajna1-2/+38
Pressing a key in Writer used to lay out the relevant string 4 times (counting GenericSalLayout::LayoutText() invocations), save one of them by pre-calculating the layout and sharing it between GetTextArray() and DrawTextArray(). Change-Id: Ic2194bdcbe94a546d57745463ae81e6b0cadcd92 Reviewed-on: https://gerrit.libreoffice.org/59208 Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk> Tested-by: Jenkins
2018-08-15sw: nOffs is always 0 in SwFntObj::DrawText()Miklos Vajna1-6/+5
Since commit 95cb8d2ce96578e8968d4d74573fa528e226fac9 (Remove FONT_TEST_DEBUG, COMING_SOON and some more dead code., 2011-01-24). Change-Id: Iff4ad45f8e1550254ab237ea097b17ec3122766a Reviewed-on: https://gerrit.libreoffice.org/59109 Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk> Tested-by: Jenkins
2018-06-08sw_redlinehide: trivial conversions in lcl_DrawLineForWrongListDataMichael Stahl1-9/+6
Change-Id: I7425bac439df7518b7fe1b62cd6f3fd7a9f88fec
2018-06-08sw_redlinehide: use WrongListIterator in text formatting codeMichael Stahl1-5/+2
Change-Id: Ie13119d456fa6fe3919871cc541a9ad927b5982e
2018-06-08sw_redlinehide: trivial conversions in fntcache.cxx, part 2Michael Stahl1-74/+85
Change-Id: I7d0bd7c2bfa84914a0659123b75282e7d0c54f1f
2018-06-08sw_redlinehide: trivial conversions in fntcache.cxx, part 1Michael Stahl1-84/+91
Change-Id: I3564ad15d3913a6de4f6f978d8a357e3ff18e52f
2018-06-08sw_redlinehide: convert font/SwDrawTextInfo/SwFntObj headersMichael Stahl1-2/+2
Change-Id: If5d7ef45cf1c722728c4f31dd1390ce5d76aa255
2018-05-22Fix typosAndrea Gelmini1-1/+1
Change-Id: I5ad14286712e27e8d15174c9ed420bf93367d041 Reviewed-on: https://gerrit.libreoffice.org/54579 Reviewed-by: Julien Nabet <serval2412@yahoo.fr> Tested-by: Jenkins <ci@libreoffice.org>
2018-04-16tdf#117028 sw: conditionally consider fill of shape for in-textbox auto colorMiklos Vajna1-1/+1
Commit f966767e1ccfa432da33e1a0fd6de69e17a36bc3 (tdf#116925 sw: consider fill styles of shape for in-textbox auto color, 2018-04-10) did this unconditionally, but there are two cases: 1) Shape (with textbox) has a fill, in that case auto text color of textbox should consider the shape fill. 2) Shape has no fill, in that case the shape fill should not be considered when counting the background of a transparent fly frame. Fix 2) without breaking 1) by making the change to SwFrame::GetBackgroundBrush() opt-in, and only use it for auto font color, not in other cases. Change-Id: I761a1b7d6ecf47586edbe5641ec012f22f6a53d7 Reviewed-on: https://gerrit.libreoffice.org/52941 Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk> Tested-by: Jenkins <ci@libreoffice.org>
2018-04-12sw: fix some IWYU warningsMiklos Vajna1-0/+1
Change-Id: I0241707fcdf1d22131ce35fb64488fcf6d669675 Reviewed-on: https://gerrit.libreoffice.org/52750 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
2018-04-07coverity#1433794 Unintended sign extensionCaolán McNamara1-1/+1
Change-Id: I674991f5621bf6cf5a9cbecac936872b48fbdbcd Reviewed-on: https://gerrit.libreoffice.org/52433 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
2018-03-07use more Color in swNoel Grandin1-6/+6
Change-Id: I51d575c40228bbd2ff384f12da33c1cd8bda2dda Reviewed-on: https://gerrit.libreoffice.org/50800 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-03-02forcepoint #17 nTextBreak is an index into pKernArray of len rInf.GetLen()Caolán McNamara1-2/+1
Change-Id: I3afeaf987cc5e75362560165fea7230904530933 Reviewed-on: https://gerrit.libreoffice.org/50628 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
2018-02-28convert COL_ constants to be of type ColorNoel Grandin1-1/+1
Change-Id: I0e25c8950ac26b851ff42f71e1471fcbe4770d48 Reviewed-on: https://gerrit.libreoffice.org/50373 Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-02-26use less RGB_COLORDATANoel Grandin1-1/+1
part of removing ColorData Change-Id: If31b5b88545529863377e9a178f45f4516bf6cbb Reviewed-on: https://gerrit.libreoffice.org/50345 Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-02-21loplugin:changetoolsgen in swNoel Grandin1-48/+48
Change-Id: If07efe4c15cfc28df38a9327856d39313ca78d50 Reviewed-on: https://gerrit.libreoffice.org/50078 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-02-21ColorData->Color in swNoel Grandin1-1/+1
Change-Id: I6b5b6b15f86d452b73fe02df5dec5490b29daed8 Reviewed-on: https://gerrit.libreoffice.org/50050 Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>