diff --git a/src/ooxml/java/org/apache/poi/xslf/util/PPTX2PNG.java b/src/ooxml/java/org/apache/poi/xslf/util/PPTX2PNG.java index 232e29340d..6bc470d775 100644 --- a/src/ooxml/java/org/apache/poi/xslf/util/PPTX2PNG.java +++ b/src/ooxml/java/org/apache/poi/xslf/util/PPTX2PNG.java @@ -298,7 +298,7 @@ public final class PPTX2PNG { // default rendering options graphics.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); graphics.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY); - graphics.setRenderingHint(RenderingHints.KEY_COLOR_RENDERING, RenderingHints.VALUE_COLOR_RENDER_SPEED); + graphics.setRenderingHint(RenderingHints.KEY_COLOR_RENDERING, RenderingHints.VALUE_COLOR_RENDER_QUALITY); graphics.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BICUBIC); graphics.setRenderingHint(RenderingHints.KEY_FRACTIONALMETRICS, RenderingHints.VALUE_FRACTIONALMETRICS_ON); graphics.setRenderingHint(Drawable.DEFAULT_CHARSET, getDefaultCharset()); 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 f49926871f..02366a5b8d 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 @@ -205,6 +205,11 @@ public final class HemfDraw { return bounds; } + @Override + protected boolean addClose() { + return false; + } + @Override public Map> getGenericProperties() { return GenericRecordUtil.getGenericProperties( @@ -352,6 +357,11 @@ public final class HemfDraw { // The line segments SHOULD be drawn using the current pen. return FillDrawStyle.DRAW; } + + @Override + protected boolean addClose() { + return false; + } } /** @@ -952,6 +962,11 @@ public final class HemfDraw { return bounds; } + @Override + protected boolean addClose() { + return false; + } + @Override public Map> getGenericProperties() { return GenericRecordUtil.getGenericProperties( diff --git a/src/scratchpad/src/org/apache/poi/hemf/record/emf/HemfMisc.java b/src/scratchpad/src/org/apache/poi/hemf/record/emf/HemfMisc.java index 51dd125930..996a44f08e 100644 --- a/src/scratchpad/src/org/apache/poi/hemf/record/emf/HemfMisc.java +++ b/src/scratchpad/src/org/apache/poi/hemf/record/emf/HemfMisc.java @@ -831,6 +831,7 @@ public class HemfMisc { break; } ctx.updateWindowMapMode(); + ctx.getProperties().setLocation(0,0); } @Override 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 c10c004f51..9a8f629afc 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 @@ -95,7 +95,7 @@ public class HemfText { // A WMF PointL object that specifies the coordinates of the reference point used to position the string. // The reference point is defined by the last EMR_SETTEXTALIGN record. - // If no such record has been set, the default alignment is TA_LEFT,TA_TOP. + // If no such record has been set, the defaulint alignment is TA_LEFT,TA_TOP. size += readPointL(leis, reference); // A 32-bit unsigned integer that specifies the number of characters in the string. stringLength = (int)leis.readUInt(); diff --git a/src/scratchpad/src/org/apache/poi/hwmf/draw/HwmfGraphics.java b/src/scratchpad/src/org/apache/poi/hwmf/draw/HwmfGraphics.java index 48790f8e0a..dbca6ef9cf 100644 --- a/src/scratchpad/src/org/apache/poi/hwmf/draw/HwmfGraphics.java +++ b/src/scratchpad/src/org/apache/poi/hwmf/draw/HwmfGraphics.java @@ -495,6 +495,7 @@ public class HwmfGraphics implements HwmfCharsetAware { if (scale != null) { graphicsCtx.scale(scale.getWidth() < 0 ? -1 : 1, scale.getHeight() < 0 ? -1 : 1); } + graphicsCtx.scale(at.getScaleX() < 0 ? -1 : 1, at.getScaleY() < 0 ? -1 : 1); graphicsCtx.translate(dst.getX(), dst.getY()); graphicsCtx.setColor(prop.getTextColor().getColor()); graphicsCtx.drawString(as.getIterator(), 0, 0); diff --git a/src/scratchpad/src/org/apache/poi/hwmf/record/HwmfDraw.java b/src/scratchpad/src/org/apache/poi/hwmf/record/HwmfDraw.java index 38089ca7ab..19dee4e871 100644 --- a/src/scratchpad/src/org/apache/poi/hwmf/record/HwmfDraw.java +++ b/src/scratchpad/src/org/apache/poi/hwmf/record/HwmfDraw.java @@ -158,6 +158,11 @@ public final class HwmfDraw { } } + if (addClose()) { + // polygons are closed / polylines not + poly.closePath(); + } + return LittleEndianConsts.SHORT_SIZE+numberofPoints*LittleEndianConsts.INT_SIZE; } @@ -185,6 +190,13 @@ public final class HwmfDraw { return poly; } + /** + * @return {@code true} if the path needs to be closed + */ + protected boolean addClose() { + return true; + } + @Override public Map> getGenericProperties() { return GenericRecordUtil.getGenericProperties("poly", this::getPoly); @@ -206,6 +218,11 @@ public final class HwmfDraw { protected FillDrawStyle getFillDrawStyle() { return FillDrawStyle.DRAW; } + + @Override + protected boolean addClose() { + return false; + } } /** diff --git a/src/scratchpad/src/org/apache/poi/hwmf/record/HwmfText.java b/src/scratchpad/src/org/apache/poi/hwmf/record/HwmfText.java index cc29087c69..07c7636a29 100644 --- a/src/scratchpad/src/org/apache/poi/hwmf/record/HwmfText.java +++ b/src/scratchpad/src/org/apache/poi/hwmf/record/HwmfText.java @@ -469,6 +469,10 @@ public class HwmfText { return bounds; } + public WmfExtTextOutOptions getOptions() { + return options; + } + protected boolean isUnicode() { return false; } @@ -491,6 +495,7 @@ public class HwmfText { return GenericRecordUtil.getGenericProperties( "reference", this::getReference, "bounds", this::getBounds, + "options", this::getOptions, "text", this::getGenericText, "dx", () -> dx );