You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-dev@xmlgraphics.apache.org by bu...@apache.org on 2011/09/05 13:55:00 UTC

DO NOT REPLY [Bug 51765] New: Text-underline not working inside flowSpan

https://issues.apache.org/bugzilla/show_bug.cgi?id=51765

             Bug #: 51765
           Summary: Text-underline not working inside flowSpan
           Product: Batik
           Version: 1.7
          Platform: PC
            Status: NEW
          Severity: normal
          Priority: P2
         Component: SVG Rasterizer
        AssignedTo: batik-dev@xmlgraphics.apache.org
        ReportedBy: antoine.ansel@gmail.com
    Classification: Unclassified


Hello,

The text-decoration:underline attribute does not work when used inside a
flowSpan. I attach a svg file demonstrating the problem.
Just rasterize it and you'll see a line appear way above the text.

Thanks for your consideration.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: batik-dev-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-dev-help@xmlgraphics.apache.org


[Bug 51765] Text-underline not working inside flowSpan

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=51765

--- Comment #7 from Mario <m....@rug.nl> ---
Created attachment 29277
  --> https://issues.apache.org/bugzilla/attachment.cgi?id=29277&action=edit
SVG test case file to test the patch for this bug

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: batik-dev-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-dev-help@xmlgraphics.apache.org


[Bug 51765] Text-underline not working inside flowSpan

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=51765

--- Comment #3 from Mario <m....@rug.nl> ---
Created attachment 29267
  --> https://issues.apache.org/bugzilla/attachment.cgi?id=29267&action=edit
Fixes the incorrect positioning of underline, overline and line-through in
flowing text tags

As the previously attached test case illustrates perfectly, the underline is
positioned incorrect. As it seems, it always gets positioned at the top of the
defined flowRegion. This is also true for the overline and line-through text
decorations.
After two to three days of analysing I found that the cause was in the
GlyphLayout class in the code painting the text decorations
(paintDecorations(...)). The protected methods getUnderlineShape(),
getOverlineShape() and getStrikethroughShape() (i.e. SVG calls it
line-through), all use the offset property to determine the offset of the text
decoration in relation to the text. With regular <text> and <tspan> tags
somehow this property gets the right offset values set (probably through manual
x, y tag attributes or derived from parent tags) and the text decoration is
showed correct. However, with flowing text tags (<flowPara>, <flowSpan>) the
offset values do not get set at all (both offset.x and offset.y stay 0.0). That
is probably because flowing text elements have their own <flowRegion> defined
in which the text flows 'freely'. As a result the offset determined for the
text decoration only reaches to the top of the defined flow region. Hence, the
text decoration is always shown at the top. 
To fix this, one could either try to let the GlyphLayout.offset property values
get set and take into account the possible multiline flowing text or instead of
using the offset property, determine the text decoration offset with help of
the available glyph vector. This vector contains all the glyphs (i.e.
typographic representation of characters), that are subject to the text
decoration. Those glyphs have bounds from which their positions can be
determined. And with the other components (line thickness and what not) making
up the total offset the correct position of the text decoration can be
determined.

The latter solution I chose to implement and is attached in the patch. It is
implemented such that for regular <text> and <tspan> tags the
GlyphLayout.offset property (i.e. the original way) is still used, but for
flowing text (i.e. flowPara, flowSpan) the glyph vector is used. That is why
the patch also contains changes in FlowTextPainter.java and
FlowGlyphLayout.java, because I had to change that instances of both of those
classes get loaded when Batik is dealing with flowing text instead of regular
text.

Looking forward to seeing your comments on this fix and possibly how to commit
it to the repository if requested.

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: batik-dev-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-dev-help@xmlgraphics.apache.org


[Bug 51765] Text-underline not working inside flowSpan

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=51765

Mario <m....@rug.nl> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |WORKSFORME

--- Comment #4 from Mario <m....@rug.nl> ---
In reflect to my previous post. I would say that the status of this bug has
changed to Resolved: Worksforme.

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: batik-dev-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-dev-help@xmlgraphics.apache.org


[Bug 51765] Text-underline not working inside flowSpan

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=51765

--- Comment #6 from Mario <m....@rug.nl> ---
Created attachment 29276
  --> https://issues.apache.org/bugzilla/attachment.cgi?id=29276&action=edit
Fixes the incorrect positioning of underline, overline and line-through in
flowing text tags

This is the correct patch (previous one removed). The text-decorations were
still positioned incorrectly if text descended. In this patch the usage of the
max y position of the geometric bounds of the glyph vector has been changed in
employing the y position of the first glyph in the glyph vector. That is
basically the baseline of the glyph vector as I figured it. Results in tests
confirm that (see patch test case svg).

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: batik-dev-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-dev-help@xmlgraphics.apache.org


DO NOT REPLY [Bug 51765] Text-underline not working inside flowSpan

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=51765

--- Comment #1 from antoine.ansel@gmail.com 2011-09-05 11:56:04 UTC ---
Created attachment 27459
  --> https://issues.apache.org/bugzilla/attachment.cgi?id=27459
Svg describing underline problem

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: batik-dev-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-dev-help@xmlgraphics.apache.org


[Bug 51765] Text-underline not working inside flowSpan

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=51765

Mario <m....@rug.nl> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |m.s.ganzeboom@rug.nl

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: batik-dev-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-dev-help@xmlgraphics.apache.org


DO NOT REPLY [Bug 51765] Text-underline not working inside flowSpan

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=51765

--- Comment #2 from antoine.ansel@gmail.com 2011-09-05 11:56:30 UTC ---
Created attachment 27460
  --> https://issues.apache.org/bugzilla/attachment.cgi?id=27460
Png describing underline problem

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: batik-dev-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-dev-help@xmlgraphics.apache.org


[Bug 51765] Text-underline not working inside flowSpan

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=51765

Mario <m....@rug.nl> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #29267|bug51765_incorrect-text-dec |[INCORRECT PATCH PLEASE
           filename|orations-in-flowing-text.pa |REMOVE]
                   |tch                         |bug51765_incorrect-text-dec
                   |                            |orations-in-flowing-text.pa
                   |                            |tch
  Attachment #29267|0                           |1
        is obsolete|                            |

--- Comment #5 from Mario <m....@rug.nl> ---
Comment on attachment 29267
  --> https://issues.apache.org/bugzilla/attachment.cgi?id=29267
Fixes the incorrect positioning of underline, overline and line-through in
flowing text tags

This patch does not fix everything regarding the positioning of the text
decorations. Especially I later noticed that the line-through text decoration
was not positioned correctly. That was because I used the max y position of the
geometric bounds of the glyph vector. When the text descends beyond the
baseline (as it does with characters like 'g', 'j', etc.) the line-through
appeared still too low.
The patch marked as [CORRECT] fixes this by not using the max y position of the
geometric bounds of the glyph vector, but employing the y position of the first
glyph in the glyph vector. That is basically the baseline of the glyph vector
as I figure it. Results in tests confirm that (see patch test case svg).

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: batik-dev-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-dev-help@xmlgraphics.apache.org


[Bug 51765] Text-underline not working inside flowSpan

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=51765

Helder Magalhães <he...@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |PatchAvailable
             Status|RESOLVED                    |REOPENED
         Resolution|WORKSFORME                  |---

--- Comment #8 from Helder Magalhães <he...@gmail.com> ---
(In reply to comment #4)
> In reflect to my previous post. I would say that the status of this bug has
> changed to Resolved: Worksforme.

Thanks for the patch submission, Mario! :-)

Again, having a patch available doesn't mean the issue's fixed: a committer [1]
familiar with the code (Thomas?) still needs to review it and integrate it into
the mainstream code. Best way to flag this is using the "PatchAvailable" in the
keywords, as has been done. I'm therefore reopening the issue.

[1] http://xmlgraphics.apache.org/batik/contributors.html#committers

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: batik-dev-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-dev-help@xmlgraphics.apache.org