aboutsummaryrefslogtreecommitdiffstats
path: root/src/scratchpad
diff options
context:
space:
mode:
authorAndreas Beeker <kiwiwings@apache.org>2018-09-26 22:51:03 +0000
committerAndreas Beeker <kiwiwings@apache.org>2018-09-26 22:51:03 +0000
commit93b7cb0bc70ac51739b9c01172fce52965c685d0 (patch)
treefce8c8045bf52183b1bf815db293f77b23c79475 /src/scratchpad
parent312fde5bd0728039f448837bd504e388fac2ce4a (diff)
downloadpoi-93b7cb0bc70ac51739b9c01172fce52965c685d0.tar.gz
poi-93b7cb0bc70ac51739b9c01172fce52965c685d0.zip
#60656 - Support export file that contains emf and render it correctly
git-svn-id: https://svn.apache.org/repos/asf/poi/branches/hemf@1842059 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/scratchpad')
-rw-r--r--src/scratchpad/src/org/apache/poi/hwmf/draw/HwmfGraphics.java6
1 files changed, 4 insertions, 2 deletions
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 c5873e02a6..23ccd1c70f 100644
--- a/src/scratchpad/src/org/apache/poi/hwmf/draw/HwmfGraphics.java
+++ b/src/scratchpad/src/org/apache/poi/hwmf/draw/HwmfGraphics.java
@@ -351,7 +351,7 @@ public class HwmfGraphics {
}
}
- String textString = new String(text, charset);
+ String textString = new String(text, charset).trim();
AttributedString as = new AttributedString(textString);
if (dx == null || dx.isEmpty()) {
addAttributes(as, font);
@@ -388,7 +388,9 @@ public class HwmfGraphics {
offset += Character.charCount(chars[0]);
}
}
- for (int i = 0; i < dxNormed.size(); i++) {
+
+ int cps = textString.codePointCount(0, textString.length());
+ for (int i = 0; i < Math.min(dxNormed.size(),cps-1); i++) {
addAttributes(as, font);
// Tracking works as a prefix/advance space on characters whereas
// dx[...] is the complete width of the current char