diff --git a/src/scratchpad/src/org/apache/poi/hemf/draw/HemfGraphics.java b/src/scratchpad/src/org/apache/poi/hemf/draw/HemfGraphics.java index e32c451e2a..011cb56ff7 100644 --- a/src/scratchpad/src/org/apache/poi/hemf/draw/HemfGraphics.java +++ b/src/scratchpad/src/org/apache/poi/hemf/draw/HemfGraphics.java @@ -106,19 +106,21 @@ public class HemfGraphics extends HwmfGraphics { 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) { diff --git a/src/scratchpad/src/org/apache/poi/hemf/record/emf/HemfDraw.java b/src/scratchpad/src/org/apache/poi/hemf/record/emf/HemfDraw.java index 459a0b2ee3..0eb6522e44 100644 --- a/src/scratchpad/src/org/apache/poi/hemf/record/emf/HemfDraw.java +++ b/src/scratchpad/src/org/apache/poi/hemf/record/emf/HemfDraw.java @@ -17,10 +17,6 @@ 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; @@ -32,10 +28,8 @@ import java.io.IOException; 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; @@ -242,6 +236,7 @@ public class HemfDraw { // 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()); @@ -952,7 +947,6 @@ public class HemfDraw { path.closePath(); prop.setLocation(path.getCurrentPoint()); } - } @Override diff --git a/src/scratchpad/src/org/apache/poi/hemf/record/emf/HemfRecordType.java b/src/scratchpad/src/org/apache/poi/hemf/record/emf/HemfRecordType.java index 7a3bf470e0..5b19f9d128 100644 --- a/src/scratchpad/src/org/apache/poi/hemf/record/emf/HemfRecordType.java +++ b/src/scratchpad/src/org/apache/poi/hemf/record/emf/HemfRecordType.java @@ -106,8 +106,8 @@ public enum HemfRecordType { 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), diff --git a/src/scratchpad/src/org/apache/poi/hemf/record/emf/HemfText.java b/src/scratchpad/src/org/apache/poi/hemf/record/emf/HemfText.java index 97a81d9102..9f36812179 100644 --- a/src/scratchpad/src/org/apache/poi/hemf/record/emf/HemfText.java +++ b/src/scratchpad/src/org/apache/poi/hemf/record/emf/HemfText.java @@ -28,7 +28,6 @@ import java.awt.geom.Rectangle2D; 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; @@ -38,7 +37,6 @@ import org.apache.poi.util.IOUtils; 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; /** @@ -72,7 +70,7 @@ public class HemfText { @Override public HemfRecordType getEmfRecordType() { - return HemfRecordType.exttextouta; + return HemfRecordType.extTextOutA; } @Override @@ -209,7 +207,7 @@ public class HemfText { @Override public HemfRecordType getEmfRecordType() { - return HemfRecordType.exttextoutw; + return HemfRecordType.extTextOutW; } public String getText() throws IOException {