aboutsummaryrefslogtreecommitdiffstats
path: root/src/scratchpad
diff options
context:
space:
mode:
authorAndreas Beeker <kiwiwings@apache.org>2020-11-15 21:49:24 +0000
committerAndreas Beeker <kiwiwings@apache.org>2020-11-15 21:49:24 +0000
commitc6b408b232dfde2e2ba4d930a57ca57d84a7b25f (patch)
treed2f87ebc1ba80d9a79a48640788906db030173f9 /src/scratchpad
parentb8cb440ce4d614600d3514a116330f32495cfc48 (diff)
downloadpoi-c6b408b232dfde2e2ba4d930a57ca57d84a7b25f.tar.gz
poi-c6b408b232dfde2e2ba4d930a57ca57d84a7b25f.zip
#64716 - wmf display error
- close polygons - reset current path location on emf modifyworldtransform - mirror text if the affinetransform is negative scaled git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1883460 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/scratchpad')
-rw-r--r--src/scratchpad/src/org/apache/poi/hemf/record/emf/HemfDraw.java15
-rw-r--r--src/scratchpad/src/org/apache/poi/hemf/record/emf/HemfMisc.java1
-rw-r--r--src/scratchpad/src/org/apache/poi/hemf/record/emf/HemfText.java2
-rw-r--r--src/scratchpad/src/org/apache/poi/hwmf/draw/HwmfGraphics.java1
-rw-r--r--src/scratchpad/src/org/apache/poi/hwmf/record/HwmfDraw.java17
-rw-r--r--src/scratchpad/src/org/apache/poi/hwmf/record/HwmfText.java5
6 files changed, 40 insertions, 1 deletions
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
@@ -206,6 +206,11 @@ public final class HemfDraw {
}
@Override
+ protected boolean addClose() {
+ return false;
+ }
+
+ @Override
public Map<String, Supplier<?>> getGenericProperties() {
return GenericRecordUtil.getGenericProperties(
"base", super::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;
+ }
}
/**
@@ -953,6 +963,11 @@ public final class HemfDraw {
}
@Override
+ protected boolean addClose() {
+ return false;
+ }
+
+ @Override
public Map<String, Supplier<?>> getGenericProperties() {
return GenericRecordUtil.getGenericProperties(
"base", super::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<String, Supplier<?>> 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
);