1 18 package org.apache.batik.bridge; 19 20 import java.awt.font.FontRenderContext ; 21 import java.text.AttributedCharacterIterator ; 22 23 import org.apache.batik.gvt.font.AltGlyphHandler; 24 import org.apache.batik.gvt.font.GVTGlyphVector; 25 import org.apache.batik.gvt.font.Glyph; 26 import org.apache.batik.gvt.font.SVGGVTGlyphVector; 27 import org.apache.batik.util.SVGConstants; 28 import org.w3c.dom.Element ; 29 30 37 public class SVGAltGlyphHandler implements AltGlyphHandler, SVGConstants { 38 39 private BridgeContext ctx; 40 private Element textElement; 41 42 50 public SVGAltGlyphHandler(BridgeContext ctx, Element textElement) { 51 this.ctx = ctx; 52 this.textElement = textElement; 53 } 54 55 63 public GVTGlyphVector createGlyphVector 64 (FontRenderContext frc, float fontSize, 65 AttributedCharacterIterator aci) { 66 try { 67 if (SVG_NAMESPACE_URI.equals(textElement.getNamespaceURI()) && 68 SVG_ALT_GLYPH_TAG.equals(textElement.getLocalName())) { 69 SVGAltGlyphElementBridge altGlyphBridge 70 = (SVGAltGlyphElementBridge)ctx.getBridge(textElement); 71 Glyph[] glyphArray = altGlyphBridge.createAltGlyphArray 72 (ctx, textElement, fontSize, aci); 73 if (glyphArray != null) { 74 return new SVGGVTGlyphVector(null, glyphArray, frc); 75 } 76 } 77 } catch (SecurityException e) { 78 ctx.getUserAgent().displayError(e); 79 throw e; 83 } 84 85 return null; 86 } 87 } 88 89 | Popular Tags |