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 Thierry Kormann <tk...@sophia.inria.fr> on 2001/05/15 16:10:34 UTC

bug with letter-spacing and whitespace

Hi,

I have just found a bug in one of my SVG file. I have spend some time to 
isolate the problem and here is the result.

Combining the whitespace in a text content and the 'letter-spacing' property 
throws exceptions such as:


     [java] java.lang.NullPointerException
     [java]     at 
sun.awt.font.StandardGlyphVector.setGlyphPosition(StandardGlyphVector.java:417)
     [java]     at 
org.apache.batik.gvt.font.AWTGVTGlyphVector.setGlyphPosition(AWTGVTGlyphVector.java:321)
     [java]     at 
org.apache.batik.gvt.text.GlyphLayout.doSpacing(GlyphLayout.java:898)
     [java]     at 
org.apache.batik.gvt.text.GlyphLayout.applySpacingParams(GlyphLayout.java:774)
     [java]     at 
org.apache.batik.gvt.text.GlyphLayout.adjustTextSpacing(GlyphLayout.java:720)
     [java]     at 
org.apache.batik.gvt.text.GlyphLayout.setOffset(GlyphLayout.java:158)
     [java]     at 
org.apache.batik.gvt.renderer.StrokingTextPainter.adjustChunkOffsets(StrokingTextPainter.java:388)
     [java]     at 
org.apache.batik.gvt.renderer.StrokingTextPainter.getTextRuns(StrokingTextPainter.java:127)
     [java]     at 
org.apache.batik.gvt.renderer.StrokingTextPainter.getOutline(StrokingTextPainter.java:588)
     [java]     at 
org.apache.batik.gvt.renderer.BasicTextPainter.getStrokeOutline(BasicTextPainter.java:400)
     [java]     at 
org.apache.batik.gvt.renderer.StrokingTextPainter.getBounds(StrokingTextPainter.java:557)
     [java]     at 
org.apache.batik.gvt.renderer.BasicTextPainter.getPaintedBounds(BasicTextPainter.java:277)
     [java]     at 
org.apache.batik.gvt.TextNode.getPrimitiveBounds(TextNode.java:154)
     [java]     at 
org.apache.batik.gvt.AbstractGraphicsNode.getTransformedPrimitiveBounds(AbstractGraphicsNode.java:815)
     [java]     at 
org.apache.batik.gvt.AbstractGraphicsNode.getTransformedBounds(AbstractGraphicsNode.java:789)
     [java]     at 
org.apache.batik.gvt.CompositeGraphicsNode.getTransformedPrimitiveBounds(CompositeGraphicsNode.java:321)


Attached to this email, a simple SVG document that fails.

PS: A simple if (newPos != null) in the AWTGVTGlyphVector does not solve the 
problem :) - that just ignores the whitespace so the global spacing 
(letter-spacing+whitespace+letter-spacing) is wrong.

Thierry.


Re: bug with letter-spacing and whitespace

Posted by Vincent Hardy <vh...@eng.sun.com>.
Thierry,

Est-ce-que tu as entre un bug dans Bugzilla?
Merci!
V.

Thierry Kormann wrote:
> 
> Hi,
> 
> I have just found a bug in one of my SVG file. I have spend some time to
> isolate the problem and here is the result.
> 
> Combining the whitespace in a text content and the 'letter-spacing' property
> throws exceptions such as:
> 
>      [java] java.lang.NullPointerException
>      [java]     at
> sun.awt.font.StandardGlyphVector.setGlyphPosition(StandardGlyphVector.java:417)
>      [java]     at
> org.apache.batik.gvt.font.AWTGVTGlyphVector.setGlyphPosition(AWTGVTGlyphVector.java:321)
>      [java]     at
> org.apache.batik.gvt.text.GlyphLayout.doSpacing(GlyphLayout.java:898)
>      [java]     at
> org.apache.batik.gvt.text.GlyphLayout.applySpacingParams(GlyphLayout.java:774)
>      [java]     at
> org.apache.batik.gvt.text.GlyphLayout.adjustTextSpacing(GlyphLayout.java:720)
>      [java]     at
> org.apache.batik.gvt.text.GlyphLayout.setOffset(GlyphLayout.java:158)
>      [java]     at
> org.apache.batik.gvt.renderer.StrokingTextPainter.adjustChunkOffsets(StrokingTextPainter.java:388)
>      [java]     at
> org.apache.batik.gvt.renderer.StrokingTextPainter.getTextRuns(StrokingTextPainter.java:127)
>      [java]     at
> org.apache.batik.gvt.renderer.StrokingTextPainter.getOutline(StrokingTextPainter.java:588)
>      [java]     at
> org.apache.batik.gvt.renderer.BasicTextPainter.getStrokeOutline(BasicTextPainter.java:400)
>      [java]     at
> org.apache.batik.gvt.renderer.StrokingTextPainter.getBounds(StrokingTextPainter.java:557)
>      [java]     at
> org.apache.batik.gvt.renderer.BasicTextPainter.getPaintedBounds(BasicTextPainter.java:277)
>      [java]     at
> org.apache.batik.gvt.TextNode.getPrimitiveBounds(TextNode.java:154)
>      [java]     at
> org.apache.batik.gvt.AbstractGraphicsNode.getTransformedPrimitiveBounds(AbstractGraphicsNode.java:815)
>      [java]     at
> org.apache.batik.gvt.AbstractGraphicsNode.getTransformedBounds(AbstractGraphicsNode.java:789)
>      [java]     at
> org.apache.batik.gvt.CompositeGraphicsNode.getTransformedPrimitiveBounds(CompositeGraphicsNode.java:321)
> 
> Attached to this email, a simple SVG document that fails.
> 
> PS: A simple if (newPos != null) in the AWTGVTGlyphVector does not solve the
> problem :) - that just ignores the whitespace so the global spacing
> (letter-spacing+whitespace+letter-spacing) is wrong.
> 
> Thierry.
> 
>   ------------------------------------------------------------------------
>               Name: bug.svg
>    bug.svg    Type: Mozilla Extensible Markup Language Document (text/xml)
>           Encoding: base64
> 
>   ------------------------------------------------------------------------
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-dev-unsubscribe@xml.apache.org
> For additional commands, e-mail: batik-dev-help@xml.apache.org

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


Re: bug with letter-spacing and whitespace

Posted by Bill Haneman <bi...@sun.com>.
[regarding letter-spacing bug]

I have a hunch that the following line (added to GlyphLayout.java) may
fix this:

                while ((gm.getBounds2D().getWidth()<0.01d) ||
                                                      
gm.isWhitespace()) {
 /* ADD THIS? */    newPositions[i] = glyphPositions[i];
                    ++i;
                    ++endWS;
                    if (!inWS) inWS = true;
                    if (i>=numGlyphs) {
                        inWS = false;
                        break;
                    }
                    gpos = glyphPositions[i];
                    gm = gv.getGlyphMetrics(i);
                }

I have not had time to test this, but thought I'd reply quickly to as
to prevent duplicated effort.

Regards,

Bill 
--------------
Bill Haneman
Gnome Accessibility / Batik SVG Toolkit
Sun Microsystems Ireland

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


text selection

Posted by Bill Haneman <bi...@sun.com>.
Hi Folks:

Why did the statusbar presentation of text selection get removed?

I thought that was a key feature, now there is no feedback on what has
been selected (other than the visual highlight onscreen).

I'd really like to see that feature put back in.

Thanks,

-Bill

--------------
Bill Haneman
Gnome Accessibility / Batik SVG Toolkit
Sun Microsystems Ireland

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


Re: bug with letter-spacing and whitespace

Posted by Vincent Hardy <vh...@eng.sun.com>.
Thierry,

Bella Robinson has found a fix for that problem that I commited.
Thanks Bella!

Cheers.
V.

Thierry Kormann wrote:
> 
> Hi,
> 
> I have just found a bug in one of my SVG file. I have spend some time to
> isolate the problem and here is the result.
> 
> Combining the whitespace in a text content and the 'letter-spacing' property
> throws exceptions such as:
> 
>      [java] java.lang.NullPointerException
>      [java]     at
> sun.awt.font.StandardGlyphVector.setGlyphPosition(StandardGlyphVector.java:417)
>      [java]     at
> org.apache.batik.gvt.font.AWTGVTGlyphVector.setGlyphPosition(AWTGVTGlyphVector.java:321)
>      [java]     at
> org.apache.batik.gvt.text.GlyphLayout.doSpacing(GlyphLayout.java:898)
>      [java]     at
> org.apache.batik.gvt.text.GlyphLayout.applySpacingParams(GlyphLayout.java:774)
>      [java]     at
> org.apache.batik.gvt.text.GlyphLayout.adjustTextSpacing(GlyphLayout.java:720)
>      [java]     at
> org.apache.batik.gvt.text.GlyphLayout.setOffset(GlyphLayout.java:158)
>      [java]     at
> org.apache.batik.gvt.renderer.StrokingTextPainter.adjustChunkOffsets(StrokingTextPainter.java:388)
>      [java]     at
> org.apache.batik.gvt.renderer.StrokingTextPainter.getTextRuns(StrokingTextPainter.java:127)
>      [java]     at
> org.apache.batik.gvt.renderer.StrokingTextPainter.getOutline(StrokingTextPainter.java:588)
>      [java]     at
> org.apache.batik.gvt.renderer.BasicTextPainter.getStrokeOutline(BasicTextPainter.java:400)
>      [java]     at
> org.apache.batik.gvt.renderer.StrokingTextPainter.getBounds(StrokingTextPainter.java:557)
>      [java]     at
> org.apache.batik.gvt.renderer.BasicTextPainter.getPaintedBounds(BasicTextPainter.java:277)
>      [java]     at
> org.apache.batik.gvt.TextNode.getPrimitiveBounds(TextNode.java:154)
>      [java]     at
> org.apache.batik.gvt.AbstractGraphicsNode.getTransformedPrimitiveBounds(AbstractGraphicsNode.java:815)
>      [java]     at
> org.apache.batik.gvt.AbstractGraphicsNode.getTransformedBounds(AbstractGraphicsNode.java:789)
>      [java]     at
> org.apache.batik.gvt.CompositeGraphicsNode.getTransformedPrimitiveBounds(CompositeGraphicsNode.java:321)
> 
> Attached to this email, a simple SVG document that fails.
> 
> PS: A simple if (newPos != null) in the AWTGVTGlyphVector does not solve the
> problem :) - that just ignores the whitespace so the global spacing
> (letter-spacing+whitespace+letter-spacing) is wrong.
> 
> Thierry.
> 
>   ------------------------------------------------------------------------
>               Name: bug.svg
>    bug.svg    Type: Mozilla Extensible Markup Language Document (text/xml)
>           Encoding: base64
> 
>   ------------------------------------------------------------------------
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-dev-unsubscribe@xml.apache.org
> For additional commands, e-mail: batik-dev-help@xml.apache.org

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