1 4 5 9 10 package org.openlaszlo.compiler; 11 12 import org.openlaszlo.sc.ScriptCompiler; 13 import org.openlaszlo.server.LPS; 14 import org.openlaszlo.utils.FileUtils; 15 import org.openlaszlo.utils.ChainedException; 16 import org.openlaszlo.iv.flash.api.*; 17 import org.openlaszlo.iv.flash.api.action.*; 18 import org.openlaszlo.iv.flash.api.image.*; 19 import org.openlaszlo.iv.flash.api.sound.*; 20 import org.openlaszlo.iv.flash.api.text.*; 21 import org.openlaszlo.iv.flash.util.*; 22 import org.openlaszlo.iv.flash.cache.*; 23 24 import org.openlaszlo.compiler.CompilationEnvironment; 25 26 import org.openlaszlo.media.*; 27 28 import java.io.*; 29 import java.util.*; 30 import java.lang.Math ; 31 import java.lang.Character ; 32 33 import java.awt.geom.Rectangle2D ; 35 36 import org.apache.log4j.*; 37 38 39 40 public class FontManager { 41 42 private final Hashtable mFontTable = new Hashtable(); 43 44 public FontFamily getFontFamily(String fontName) { 45 if (fontName == null) return null; 46 return (FontFamily) mFontTable.get(fontName); 47 } 48 49 public FontFamily getFontFamily(String fontName, boolean create) { 50 FontFamily family = (FontFamily) mFontTable.get(fontName); 51 if (family == null && create) { 52 family = new FontFamily(); 53 mFontTable.put(fontName, family); 54 } 55 return family; 56 } 57 58 public Enumeration getNames() { 59 return mFontTable.keys(); 60 } 61 62 public boolean checkFontExists (FontInfo fontInfo) { 63 String fontName = fontInfo.getName(); 64 int size = fontInfo.getSize(); 65 int style = fontInfo.styleBits; 66 FontFamily family = getFontFamily(fontName); 67 if (family == null) { 68 return false; 69 } 70 Font font = family.getStyle(style); 71 if (font == null) { 72 return false; 73 } 74 return true; 75 } 76 77 } 78 | Popular Tags |