1 18 package org.apache.batik.bridge; 19 20 import java.util.List ; 21 22 import org.apache.batik.gvt.font.GVTFontFamily; 23 import org.w3c.dom.Element ; 24 25 31 public class SVGFontFace extends FontFace { 32 33 Element fontFaceElement; 34 GVTFontFamily fontFamily = null; 35 38 public SVGFontFace 39 (Element fontFaceElement, List srcs, 40 String familyName, float unitsPerEm, String fontWeight, 41 String fontStyle, String fontVariant, String fontStretch, 42 float slope, String panose1, float ascent, float descent, 43 float strikethroughPosition, float strikethroughThickness, 44 float underlinePosition, float underlineThickness, 45 float overlinePosition, float overlineThickness) { 46 super(srcs, 47 familyName, unitsPerEm, fontWeight, 48 fontStyle, fontVariant, fontStretch, 49 slope, panose1, ascent, descent, 50 strikethroughPosition, strikethroughThickness, 51 underlinePosition, underlineThickness, 52 overlinePosition, overlineThickness); 53 this.fontFaceElement = fontFaceElement; 54 } 55 56 59 public GVTFontFamily getFontFamily(BridgeContext ctx) { 60 if (fontFamily != null) 61 return fontFamily; 62 63 Element fontElt = SVGUtilities.getParentElement(fontFaceElement); 64 if (fontElt.getNamespaceURI().equals(SVG_NAMESPACE_URI) && 65 fontElt.getLocalName().equals(SVG_FONT_TAG)) { 66 return new SVGFontFamily(this, fontElt, ctx); 67 } 68 69 fontFamily = super.getFontFamily(ctx); 70 return fontFamily; 71 } 72 73 public Element getFontFaceElement() { 74 return fontFaceElement; 75 } 76 77 81 protected Element getBaseElement(BridgeContext ctx) { 82 if (fontFaceElement != null) 83 return fontFaceElement; 84 return super.getBaseElement(ctx); 85 } 86 87 } 88 | Popular Tags |