1 18 package org.apache.batik.svggen; 19 20 import java.util.HashMap ; 21 import java.util.LinkedList ; 22 import java.util.List ; 23 import java.util.Map ; 24 25 import org.w3c.dom.Element ; 26 27 34 public class SVGFontDescriptor implements SVGDescriptor, SVGSyntax { 35 private Element def; 36 private String fontSize; 37 private String fontWeight; 38 private String fontStyle; 39 private String fontFamily; 40 41 44 public SVGFontDescriptor(String fontSize, 45 String fontWeight, 46 String fontStyle, 47 String fontFamily, 48 Element def){ 49 if (fontSize == null || 50 fontWeight == null || 51 fontStyle == null || 52 fontFamily == null) 53 throw new SVGGraphics2DRuntimeException(ErrorConstants.ERR_FONT_NULL); 54 55 this.fontSize = fontSize; 56 this.fontWeight = fontWeight; 57 this.fontStyle = fontStyle; 58 this.fontFamily = fontFamily; 59 this.def = def; 60 } 61 62 public Map getAttributeMap(Map attrMap){ 63 if(attrMap == null) 64 attrMap = new HashMap (); 65 66 attrMap.put(SVG_FONT_SIZE_ATTRIBUTE, fontSize); 67 attrMap.put(SVG_FONT_WEIGHT_ATTRIBUTE, fontWeight); 68 attrMap.put(SVG_FONT_STYLE_ATTRIBUTE, fontStyle); 69 attrMap.put(SVG_FONT_FAMILY_ATTRIBUTE, fontFamily); 70 71 return attrMap; 72 } 73 74 public Element getDef(){ 75 return def; 76 } 77 78 public List getDefinitionSet(List defSet){ 79 if (defSet == null) 80 defSet = new LinkedList (); 81 82 if(def != null && !defSet.contains(def)) 83 defSet.add(def); 84 85 return defSet; 86 } 87 } 88 | Popular Tags |