Mercurial > mxd2map
changeset 192:0dc34dcdaedc
Lookup symbol font in fontset.
author | raimund renkert <raimund.renkert@intevation.de> |
---|---|
date | Wed, 20 Jul 2011 16:06:33 +0200 |
parents | 17b4aaa159ec |
children | 8ced5ff9113d |
files | ChangeLog src/java/de/intevation/mxd/writer/SymbolWriter.java |
diffstat | 2 files changed, 19 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog Wed Jul 20 16:02:57 2011 +0200 +++ b/ChangeLog Wed Jul 20 16:06:33 2011 +0200 @@ -1,3 +1,9 @@ +2011-07-20 Raimund Renkert <raimund.renkert@intevation.de> + + * src/java/de/intevation/mxd/writer/SymbolWriter.java: + Lookup symbol font in fontset and print out a warning if the font is + missing. + 2011-07-20 Raimund Renkert <raimund.renkert@intevation.de> * src/java/de/intevation/mxd/writer/MarkerStyleWriter.java:
--- 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());