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
This commit is contained in:
Andreas Beeker 2017-07-31 12:25:23 +00:00
parent e7179159fd
commit 48b01fc621
3 changed files with 9 additions and 2 deletions

View File

@ -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])) {

View File

@ -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()));

View File

@ -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 <a href="http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/ss/usermodel/BaseTestSheetAutosizeColumn.java?view=markup">Workaround for XSSF and HSSF</a>
* @see <a href="https://issues.apache.org/bugzilla/show_bug.cgi?id=54904">POI Bug #54904</a>
* @see <a href="http://bugs.java.com/view_bug.do?bug_id=6501991">JDK Bug #6501991</a>
* @see <a href="http://bugs.java.com/view_bug.do?bug_id=8013716">JDK Bug #8013716</a>
* @see <a href="https://bitbucket.org/fakraemer/line-break-measurer-test">LineBreakMeasurerTest</a>
*/
public static boolean hasLineBreakMeasurerBug() {