From 48b01fc62104c151b927178aa323ac3d874f962e Mon Sep 17 00:00:00 2001 From: Andreas Beeker Date: Mon, 31 Jul 2017 12:25:23 +0000 Subject: [PATCH] Fix further Windows JVM 6 font rendering errors - OOM and EXCEPTION_ACCESS_VIOLATION git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1803528 13f79535-47bb-0310-9956-ffa450edef68 --- src/java/org/apache/poi/sl/draw/DrawFactory.java | 7 ++++++- src/java/org/apache/poi/sl/draw/DrawTextParagraph.java | 1 + src/java/org/apache/poi/util/JvmBugs.java | 3 ++- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/java/org/apache/poi/sl/draw/DrawFactory.java b/src/java/org/apache/poi/sl/draw/DrawFactory.java index 376a8daab8..631b51e0c3 100644 --- a/src/java/org/apache/poi/sl/draw/DrawFactory.java +++ b/src/java/org/apache/poi/sl/draw/DrawFactory.java @@ -228,7 +228,12 @@ public class DrawFactory { graphics.setRenderingHint(Drawable.FONT_MAP, fontMap); } - String fonts[][] = { { "Calibri", "Lucida Sans" }, { "Cambria", "Lucida Bright" } }; + String fonts[][] = { + { "Calibri", "Lucida Sans" }, + { "Cambria", "Lucida Bright" }, + { "Times New Roman", "Lucida Bright" }, + { "serif", "Lucida Bright" } + }; for (String f[] : fonts) { if (!fontMap.containsKey(f[0])) { diff --git a/src/java/org/apache/poi/sl/draw/DrawTextParagraph.java b/src/java/org/apache/poi/sl/draw/DrawTextParagraph.java index 7f708d1249..c3c1328867 100644 --- a/src/java/org/apache/poi/sl/draw/DrawTextParagraph.java +++ b/src/java/org/apache/poi/sl/draw/DrawTextParagraph.java @@ -254,6 +254,7 @@ public class DrawTextParagraph implements Drawable { lines.clear(); DrawFactory fact = DrawFactory.getInstance(graphics); + fact.fixFonts(graphics); StringBuilder text = new StringBuilder(); AttributedString at = getAttributedString(graphics, text); boolean emptyParagraph = ("".equals(text.toString().trim())); diff --git a/src/java/org/apache/poi/util/JvmBugs.java b/src/java/org/apache/poi/util/JvmBugs.java index 221d74e643..d79c8d65b5 100644 --- a/src/java/org/apache/poi/util/JvmBugs.java +++ b/src/java/org/apache/poi/util/JvmBugs.java @@ -25,7 +25,7 @@ public class JvmBugs { * The LineBreakMeasurer is used for calculating text bounds. * The last official JDK 6 version (1.6.0_45) and also JDK 7 (1.7.0_21) * for Windows are affected. For JDK 7 - update to a more recent version. - * For JDK 6 - replace the fontmanager.dll with the previous release. + * For JDK 6 - replace the fontmanager.dll with the previous release (1.6.0_43). * * For performance reasons, this method only checks for a windows jvm * with version 1.6.0_45 and 1.7.0_21. @@ -40,6 +40,7 @@ public class JvmBugs { * @see Workaround for XSSF and HSSF * @see POI Bug #54904 * @see JDK Bug #6501991 + * @see JDK Bug #8013716 * @see LineBreakMeasurerTest */ public static boolean hasLineBreakMeasurerBug() {