diff src/java/de/intevation/mxd/writer/SymbolWriter.java @ 192:0dc34dcdaedc

Lookup symbol font in fontset.
author raimund renkert <raimund.renkert@intevation.de>
date Wed, 20 Jul 2011 16:06:33 +0200
parents c79c3c6fc99a
children df4e0946ef02
line wrap: on
line diff
--- a/src/java/de/intevation/mxd/writer/SymbolWriter.java	Wed Jul 20 16:02:57 2011 +0200
+++ b/src/java/de/intevation/mxd/writer/SymbolWriter.java	Wed Jul 20 16:06:33 2011 +0200
@@ -11,6 +11,8 @@
 import edu.umn.gis.mapscript.symbolSetObj;
 import edu.umn.gis.mapscript.lineObj;
 import edu.umn.gis.mapscript.pointObj;
+import edu.umn.gis.mapscript.fontSetObj;
+import edu.umn.gis.mapscript.hashTableObj;
 import edu.umn.gis.mapscript.MS_SYMBOL_TYPE;
 
 import java.io.File;
@@ -154,6 +156,17 @@
         String font = symbolElement.getAttribute("font");
         //Remove all blank character to match the mapserver fonts.txt.
         font = font.replaceAll(" ", "");
+        fontSetObj fso = this.map.getFontset();
+        hashTableObj fonts = fso.getFonts();
+        String mapFont = fonts.get(font,"");
+        if (mapFont == null || mapFont.equals("")) {
+            logger.warn(
+                "Could not find font " + font + " in font set. " +
+                "Setting FreeSans as symbol font." +
+                "Please add " + font + " to fonts.txt and replace the alias " +
+                "in symbol \"" + symbolElement.getAttribute("name") + "\".");
+            font = "FreeSans";
+        }
         symbol.setName(symbolElement.getAttribute("name"));
         symbol.setFont(font);
         symbol.setType(MS_SYMBOL_TYPE.MS_SYMBOL_TRUETYPE.swigValue());
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)