final Path2D path;
if (useBracket) {
path = prop.getPath();
- if (path.getCurrentPoint() == null) {
- // workaround if a path has been started and no MoveTo command
- // has been specified before the first lineTo/splineTo
- final Point2D loc = prop.getLocation();
- path.moveTo(loc.getX(), loc.getY());
- }
} else {
path = new Path2D.Double();
Point2D pnt = prop.getLocation();
path.moveTo(pnt.getX(),pnt.getY());
}
- pathConsumer.accept(path);
+ try {
+ pathConsumer.accept(path);
+ } catch (Exception e) {
+ // workaround if a path has been started and no MoveTo command
+ // has been specified before the first lineTo/splineTo
+ final Point2D loc = prop.getLocation();
+ path.moveTo(loc.getX(), loc.getY());
+ pathConsumer.accept(path);
+ }
prop.setLocation(path.getCurrentPoint());
if (!useBracket) {
package org.apache.poi.hemf.record.emf;
-import static org.apache.poi.hwmf.record.HwmfBrushStyle.BS_NULL;
-import static org.apache.poi.hwmf.record.HwmfBrushStyle.BS_SOLID;
-
-import java.awt.Color;
import java.awt.geom.Arc2D;
import java.awt.geom.Area;
import java.awt.geom.Dimension2D;
import org.apache.poi.hemf.draw.HemfDrawProperties;
import org.apache.poi.hemf.draw.HemfGraphics;
-import org.apache.poi.hwmf.record.HwmfColorRef;
import org.apache.poi.hwmf.record.HwmfDraw;
import org.apache.poi.hwmf.record.HwmfDraw.WmfSelectObject;
-import org.apache.poi.hwmf.record.HwmfPenStyle;
import org.apache.poi.util.LittleEndianConsts;
import org.apache.poi.util.LittleEndianInputStream;
// if this path is connected to the current position (= has no start point)
// the first entry is a dummy entry and will be skipped later
poly.moveTo(0,0);
+ poly.lineTo(pnt.getX(), pnt.getY());
}
} else {
poly.lineTo(pnt.getX(), pnt.getY());
path.closePath();
prop.setLocation(path.getCurrentPoint());
}
-
}
@Override
setDiBitsToDevice(0x00000050, HemfFill.EmfSetDiBitsToDevice::new),
stretchDiBits(0x00000051, HemfFill.EmfStretchDiBits::new),
extCreateFontIndirectW(0x00000052, HemfText.ExtCreateFontIndirectW::new),
- exttextouta(0x00000053, HemfText.EmfExtTextOutA::new),
- exttextoutw(0x00000054, HemfText.EmfExtTextOutW::new),
+ extTextOutA(0x00000053, HemfText.EmfExtTextOutA::new),
+ extTextOutW(0x00000054, HemfText.EmfExtTextOutW::new),
polyBezier16(0x00000055, HemfDraw.EmfPolyBezier16::new),
polygon16(0x00000056, HemfDraw.EmfPolygon16::new),
polyline16(0x00000057, HemfDraw.EmfPolyline16::new),
import java.io.IOException;
import java.nio.charset.Charset;
-import org.apache.commons.codec.Charsets;
import org.apache.poi.hemf.draw.HemfGraphics;
import org.apache.poi.hwmf.draw.HwmfGraphics;
import org.apache.poi.hwmf.record.HwmfText;
import org.apache.poi.util.Internal;
import org.apache.poi.util.LittleEndianConsts;
import org.apache.poi.util.LittleEndianInputStream;
-import org.apache.poi.util.LocaleUtil;
import org.apache.poi.util.RecordFormatException;
/**
@Override
public HemfRecordType getEmfRecordType() {
- return HemfRecordType.exttextouta;
+ return HemfRecordType.extTextOutA;
}
@Override
@Override
public HemfRecordType getEmfRecordType() {
- return HemfRecordType.exttextoutw;
+ return HemfRecordType.extTextOutW;
}
public String getText() throws IOException {