Bug 95276 - SVG-image text layout bug (pixels cut off from text)
Summary: SVG-image text layout bug (pixels cut off from text)
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: graphics stack (show other bugs)
Version:
(earliest affected)
4.3.6.2 release
Hardware: x86-64 (AMD64) All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: Writer-Images
  Show dependency treegraph
 
Reported: 2015-10-23 10:47 UTC by devseppala
Modified: 2023-10-13 08:58 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:


Attachments
Some pixels in the text of the embedded SVG image is cut off on certain zoom levels (14.80 KB, application/vnd.oasis.opendocument.text)
2015-10-23 10:47 UTC, devseppala
Details
Original svg image (3.51 KB, image/svg+xml)
2015-10-23 10:48 UTC, devseppala
Details
Gif image showing the bug on different zoom levels. (21.14 KB, image/gif)
2015-10-23 10:50 UTC, devseppala
Details
.odt document illustrating the bug on Linux (21.58 KB, application/vnd.oasis.opendocument.text)
2015-10-28 10:07 UTC, devseppala
Details
Original svg image triggering the bug on linux (6.16 KB, image/svg+xml)
2015-10-28 10:09 UTC, devseppala
Details
Lo 7.5 RC1 100% zoom. Third text box has pixels missing from top of the fonts (2.78 KB, image/gif)
2022-12-29 15:02 UTC, devseppala
Details

Note You need to log in before you can comment on or make changes to this bug.
Description devseppala 2015-10-23 10:47:40 UTC
Created attachment 119906 [details]
Some pixels in the text of the embedded SVG image is cut off on certain zoom levels

When inserting an SVG-image containing text to Writer, some pixels from the text is cut off from the display. Mainly few top pixel lines and pixels from the last character. 

This bug is dependent on the zoom-level. On some zoom levels less of the text is cut off than on others.

A certain combination of letters is also needed to trigger the bug. For example combination of letters "ks" seems to often trigger the bug.

This does not happen when viewing  the image on other programs as Firefox, IE and Inkscape.
Comment 1 devseppala 2015-10-23 10:48:50 UTC
Created attachment 119907 [details]
Original svg image


Original SVG image triggering the bug
Comment 2 devseppala 2015-10-23 10:50:08 UTC
Created attachment 119908 [details]
Gif image showing the bug on different zoom levels.
Comment 3 V Stuart Foote 2015-10-23 12:57:58 UTC
Confirming

On Windows 10 Pro 64-bit en-US with
Version: 5.0.3.1 (x64)
Build ID: fd8cfc22f7f58033351fcb8a83b92acbadb0749e
Locale: en-US (en_US)

and on a recent master

Version: 5.1.0.0.alpha1+ (x64)
Build ID: 7323190456c2ed4ec9f092f8e69ba12ce41587cd
TinderBox: Win-x86_64@62-TDF, Branch:MASTER, Time: 2015-10-20_22:44:48
Locale: en-US (en_US)

Export to PDF is also affected by issue, same clipping of extents--in addition to differences in on screen rendering at the various zoom levels.
Comment 4 devseppala 2015-10-28 10:05:41 UTC
I just tested this bug on Linux (Ubuntu 14.04 LTS and LibreOffice 4.2.8.2) and same bug is exists there also. It does not manifest it self exactly the same as on windows platform and is triggered by different combination of letters. I suspect it has something do with the fonts that are used. 

I will attach an .odt document and the original svg image that illustrates this bug on Linux.
Comment 5 devseppala 2015-10-28 10:07:13 UTC
Created attachment 120039 [details]
.odt document illustrating the bug on Linux
Comment 6 devseppala 2015-10-28 10:09:15 UTC
Created attachment 120040 [details]
Original svg image triggering the bug on linux
Comment 7 QA Administrators 2016-11-08 12:00:45 UTC Comment hidden (obsolete)
Comment 8 devseppala 2016-11-15 16:20:31 UTC
Confirming that the bug is still present on LO 5.2.3

SVG-import was introduced in LO 3.4, so the bug is not inherited from OOo.
Comment 9 devseppala 2017-01-03 15:46:25 UTC
After exploring the problem a little bit, I discovered that the bug can be circumvented to some extent by removing clipPath-elements from the SVG-file. 

<clipPath clipPathUnits="userSpaceOnUse" id="clipPath1">
    <path d="M0 0 L150 0 L150 195 L0 195 L0 0 Z"/>
</clipPath>

Apparently each line of text in an svg file is accomplished by its own clipPath-element, which restricts the region to which paint can be applied. It seems that LO-does not scale the clipPath-element (or internal LO-object it is mapped to) correctly. Other alternative is that the text layout is not scaled correctly.

For many simple SVG-images, like UML diagrams, the clipPath-element is not really needed to paint the image correctly. If you are affected by this bug and really need to use SVG-images in your .odt-document, you can try removing these clipPath-elements in a text editor. For my purposes this proved to be an effective work around.

TIP: This regular expression can be used to remove these elements from the SVG source:
<clipPath(.|\n)*?</clipPath>
replace all matches with empty strings.
Comment 10 QA Administrators 2018-01-04 03:36:00 UTC Comment hidden (obsolete)
Comment 11 Roman Kuznetsov 2018-06-19 14:33:50 UTC
still repro in LibreOffice 6.1 beta 2
Comment 12 QA Administrators 2019-06-20 02:50:44 UTC Comment hidden (obsolete)
Comment 13 QA Administrators 2021-06-20 03:46:36 UTC Comment hidden (obsolete)
Comment 14 devseppala 2021-11-23 15:34:26 UTC
I can still reproduce one of the aspect of this bug in LibreOffice 7.2.2, but it seems that the problem is less severe than before (compared to the example gif). Currently only the topmost pixel line seems to be cut off from the first text line in couple zoom levels in couple text boxes in the example document. Letters at end of the text lines in the example document don't seem to be cut off at any zoom level anymore.

I think there have been some svg library changes in LibreOffice in the past years that may have improved the text scaling in svg images.
Comment 15 Xisco Faulí 2022-10-03 10:18:36 UTC
I can't reproduce it in

Version: 7.5.0.0.alpha0+ / LibreOffice Community
Build ID: a0bc0cc81b597aa81189355a8125753d6b873cce
CPU threads: 8; OS: Linux 5.10; UI render: default; VCL: gtk3
Locale: es-ES (es_ES.UTF-8); UI: en-US
Calc: threaded

Anyone able to reproduce this issue yet ?
Comment 16 devseppala 2022-12-29 15:02:57 UTC
Created attachment 184387 [details]
Lo 7.5 RC1 100% zoom. Third text box has pixels missing from top of the fonts
Comment 17 Xisco Faulí 2023-08-02 11:57:24 UTC
This is not a svg import issue
Comment 18 Stéphane Guillou (stragu) 2023-10-13 08:58:07 UTC
I can't reproduce either.
devseppala, can you please share your full version information from Help > About LibreOffice?
Does it also happen in safe mode?

Version: 5.4.0.3
Build ID: 92c2794a7c181ba4c1c5053618179937228ed1fb
CPU threads: 8; OS: Linux 5.15; UI render: default; VCL: gtk2; 
Locale: en-AU (en_AU.UTF-8); Calc: group

Version: 7.5.7.1 (X86_64) / LibreOffice Community
Build ID: 47eb0cf7efbacdee9b19ae25d6752381ede23126
CPU threads: 8; OS: Linux 5.15; UI render: default; VCL: gtk3
Locale: en-AU (en_AU.UTF-8); UI: en-US
Calc: threaded