text with font of size zero pixels renders drawing invisible (rev >= 12488)

Bug #1294784 reported by David Mathog on 2014-03-19
This bug affects 3 people
Affects Status Importance Assigned to Milestone

Bug Description

While investigating the crash issue mentioned in bug #1294713 it was discovered that if a text element is present in the SVG which has a font size of 0px it renders the entire drawing invisible in Inkscape. It does not matter if that text precedes or follows the other graphical elements. An example is attached. In inkscape the one other graphic element, an ellipse, is not shown. Open it in Firefox and that graphic element is shown.

This effect was noted originally in a file containing hundreds of other graphic elements, none of which were visible. All were selectable.

su_v (suv-lp) wrote :

Testing on OS X:
- not reproduced with Inkscape 0.48.4
- reproduced with r13165

Based on tests with archived builds
- not reproduced with rev <= 12487
- reproduced with rev >= 12488
the regression was introduced with the merge of the EMF/WMF branch in revision 12488:

tags: added: text
tags: added: regression
Changed in inkscape:
importance: Undecided → Medium
milestone: none → 0.91
status: New → Confirmed
summary: - text with font of size zero pixels renders drawing invisible
+ text with font of size zero pixels renders drawing invisible (rev >=
+ 12488)
David Mathog (mathog) wrote :

The problem is present in lp988601.

This one is a bit of a head scratcher. The objects are all created and are selectable in the expected places, but none are drawn if the text has size zero. Further testing shows that even one <tspan> using a font size of 0 triggers this. The size seems to need to be exactly zero to trigger this, setting the font size to 0.0000001 px makes the other objects visible again.

David Mathog (mathog) wrote :

This patch adds a sanity check on SVG input in style.cpp that clamps the minimum size font to 1e-32. That seems to resolve this bug.

I never found the location where the font size of zero caused the other elements not to be drawn, but suspect it may have resulted from an unhandled divide by zero in some location involving scaling, with the font size directly or indirectly in the denominator.

ScislaC (scislac) wrote :

This is a workaround... it really deserves a proper fix given that we know the revision in which it broke. Not that it's any easier to figure out, but it's really the correct way to go about this.

su_v (suv-lp) on 2014-11-06
Changed in inkscape:
milestone: 0.91 → 0.92
su_v (suv-lp) wrote :

See also new duplicate
* Bug #1457228 “Some 0-size text breaks rendering”

David Mathog (mathog) wrote :

I had forgotten about this one and the patch was never committed. In the interim style.cpp was completely rewritten. An updated patch was just committed as revision 14167.

While I agree with ScislaC that clamping the computed value at the font at 1.0e-32 is a workaround, it does make some sense to do it that way. Otherwise every other part of the code which may at some point need to divide by the font size is going to have to do the same check anyway. As far as I can tell this patch does not change the font size when the file is saved as SVG, it still stays at zero.

I looked again and still was not able to find the place where the bug acts. Without the patch, when the drawing-text.cpp routines were modified so that they return immediately without doing anything the problem was still present when the test file was opened.

Changed in inkscape:
status: Confirmed → Won't Fix
status: Won't Fix → Triaged
milestone: 0.92 → 1.0
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Duplicates of this bug

Other bug subscribers