Bug in text width computation

Bug #167258 reported by Shap
2
Affects Status Importance Assigned to Milestone
Inkscape
Invalid
Medium
Unassigned

Bug Description

Scenario: a text item with text-anchor:middle contains
two tspans. The first tspan has no style attributes.
The second has a font size change. The text item as a
whole renders with a correctly computed middle anchor
point.

Now add a y parameter to the second tspan. The second
tspan now renders at the correct y position, but the
width computation on the containing tspan is now
computed incorrectly, with the effect that the
text-anchor center computation fails to consider this
tspan element.

The attached file renders correctly in Adobe's SVG
plugin, but incorrectly in inkscape. Removing the Y
parameter from any of the tspans to see how the text
anchor computation changes. It is most obvious in the
PX box at the upper right.

Tags: svg text
Revision history for this message
Shap (shap) wrote :
Revision history for this message
Shap (shap) wrote :

Sorry. I should have mentioned that this was happening in
Inkscape 0.43 on Linux, but I suspect it's a generic bug.

Revision history for this message
Shap (shap) wrote :

Hmm. Text handling is worse than I thought. The file icw.svg
renders to postscript with correct text widths if asked to
render a monospace font. Now change all appearances of
'monospace' to 'sans-serif'. Text width computations are now
badly off.

So I think we need to generalize this bug to state that text
width computations are not being performed properly.

Revision history for this message
Rwst (rwst) wrote :

I confirm that the file testme.svg renders different in
Batik vs. inkscape

vonHalenbach (lustik)
Changed in inkscape:
status: New → Confirmed
Revision history for this message
Mercury (mercury13) wrote :

Cannot test, but sometimes Inkscape writes text size as "100", sometimes as "100px".

Revision history for this message
jazzynico (jazzynico) wrote :

Reproduced on Windows XP, Inkscape 0.48.2 and revision 10923.

Related Bug #168023 "text-anchor incorrectly inherited in tspan".

Changed in inkscape:
assignee: Richard Hughes (cyreve) → nobody
tags: added: text
Revision history for this message
Beluga (buovjaga) wrote :

What I see in Inkscape vs. Firefox or LibreOffice is that there is a (1) on the right side of PX, outside of the box.

Win 7 64-bit
Inkscape 0.92pre1_64bit r15016

Revision history for this message
Jonathan Hofinger (jhofinger) wrote :

In 0.92.4 and 1.1-dev (6b4d57f, 2020-04-01), Windows 10:

testme.svg:
- The (1) is outside of the box. Inkscape renders it as such, Firefox and Chrome don't. That's expected and not a bug.
- Apart from that, I can't spot any differences.

icw.svg:
- The baseline-shift attribute is ignored by Firefox and accepted by Chrome and Inkscape.
- Apart from that, they render the file identically.

Closing as not reproducible in recent versions.

Please reopen on http://inkscape.org/report if the problem occurs again.

Closed by: https://gitlab.com/jhofinger

Changed in inkscape:
status: Confirmed → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.