From 567f3ef0b8920798023222c49621d2256394a6c0 Mon Sep 17 00:00:00 2001 From: kitfox Date: Mon, 28 Apr 2008 09:07:37 +0000 Subject: Added fix for calculating screen units while running on a headless server git-svn-id: https://svn.java.net/svn/svgsalamander~svn/trunk/svg-core@57 7dc7fa77-23fb-e6ad-8e2e-c86bd48ed22b --- src/main/java/com/kitfox/svg/xml/XMLParseUtil.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/kitfox/svg/xml/XMLParseUtil.java b/src/main/java/com/kitfox/svg/xml/XMLParseUtil.java index b9cbec0..8763e3c 100644 --- a/src/main/java/com/kitfox/svg/xml/XMLParseUtil.java +++ b/src/main/java/com/kitfox/svg/xml/XMLParseUtil.java @@ -151,7 +151,15 @@ public class XMLParseUtil { retVal = Double.parseDouble(val); - float pixPerInch = (float)Toolkit.getDefaultToolkit().getScreenResolution(); + float pixPerInch; + try { + pixPerInch = (float)Toolkit.getDefaultToolkit().getScreenResolution(); + } + catch (NoClassDefFoundError err) + { + //Default value for headless X servers + pixPerInch = 72; + } final float inchesPerCm = .3936f; final String units = fpMatch.group(6); -- cgit v1.2.3-55-g7522