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