xmlgraphics-fop-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Kai Hofmann" <powers...@web.de>
Subject Aw: SingleByteFont Patch
Date Tue, 01 Jul 2014 10:36:53 GMT

Dear all,
 
looks like there is another bug based on the before mentioned problem:
 
FOPGVTGlyphVector:
 
   private void buildBoundingBoxes() {
        boundingBoxes = new Rectangle2D[glyphs.length];
        for (int i = 0; i < glyphs.length; i++) {
            Rectangle bbox = fontMetrics.getBoundingBox(glyphs[i], fontSize);
            boundingBoxes[i] = new Rectangle2D.Float(bbox.x / 1000000f, -(bbox.y
+ bbox.height) / 1000000f,
                    bbox.width / 1000000f, bbox.height / 1000000f);
        }
    }
 
 
Here the result of the patched getBoundingBox seems to be used without a null pointer check.
Please keep attention on getBoundingBox which explizitly returns null !!!!
Looks like it would help to have complete javadocs which describe the possible return values
to avoid such mistakes.
 
Greetings
 
  Kai Hofmann
 
-- 
Kai Hofmann           EMail: powerstat@web.de
Bremen/Germany        
 
 

Gesendet: Dienstag, 01. Juli 2014 um 10:52 Uhr
Von: "Kai Hofmann" <powerstat@web.de>
An: fop-users@xmlgraphics.apache.org
Betreff: SingleByteFont Patch
Dear all,
 
I found a small bug in SingleByteFont - please see attached patch - in getBoundingBox:

if (idx >= 0 && idx < boundingBoxes.length)

might result in a null pointer exception, when getBoundingBox is called before setBoudning
box.
So repleace with:

if (boundingBoxes != null && idx >= 0 && idx < boundingBoxes.length)


Greetings

Kai Hofmann

 
-- 
Kai Hofmann           EMail: powerstat@web.de
Bremen/Germany        
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org

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


Mime
View raw message