@Override
@Test
public void test() throws Exception {
- File file = new File("test-data/slideshow/ae.ac.uaeu.faculty_nafaachbili_GeomLec1.pptx");
+ File file = new File("test-data/slideshow/ca.ubc.cs.people_~emhill_presentations_HowWeRefactor.pptx");
try (InputStream stream = new FileInputStream(file)) {
handleFile(stream, file.getPath());
}
if (tx == null) {
tx = new AffineTransform();
}
- final Rectangle2D anchor = tx.createTransformedShape(ps.getAnchor()).getBounds2D();
+
+ // we saw one document failing here, probably the format is slightly broken, but
+ // maybe better to try to handle it more gracefully
+ java.awt.Shape transformedShape = tx.createTransformedShape(ps.getAnchor());
+ if(transformedShape == null) {
+ return;
+ }
+
+ final Rectangle2D anchor = transformedShape.getBounds2D();
char cmds[] = isHSLF ? new char[]{ 'h','v','r' } : new char[]{ 'r','h','v' };
for (char ch : cmds) {
}
AffineTransform tx = (AffineTransform)graphics.getRenderingHint(Drawable.GROUP_TRANSFORM);
- if(tx != null && !tx.isIdentity()) {
+ if(tx != null && !tx.isIdentity() && tx.createTransformedShape(anchor) != null) {
anchor = tx.createTransformedShape(anchor).getBounds2D();
}
return anchor;
TextShape<?,?> s = getShape();
Rectangle2D anchor = DrawShape.getAnchor(graphics, s);
+ if(anchor == null) {
+ return;
+ }
+
Insets2D insets = s.getInsets();
double x = anchor.getX() + insets.left;
double y = anchor.getY();