01: /**
02: * Chart2D, a java library for drawing two dimensional charts.
03: * Copyright (C) 2001 Jason J. Simas
04: *
05: * This library is free software; you can redistribute it and/or
06: * modify it under the terms of the GNU Lesser General Public
07: * License as published by the Free Software Foundation; either
08: * version 2.1 of the License, or (at your option) any later version.
09: *
10: * This library is distributed in the hope that it will be useful,
11: * but WITHOUT ANY WARRANTY; without even the implied warranty of
12: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13: * Lesser General Public License for more details.
14: * You should have received a copy of the GNU Lesser General Public
15: * License along with this library; if not, write to the Free Software
16: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17: *
18: * The author of this library may be contacted at:
19: * E-mail: jjsimas@users.sourceforge.net
20: * Street Address: J J Simas, 887 Tico Road, Ojai, CA 93023-3555 USA
21: */package net.sourceforge.chart2d;
22:
23: import java.awt.Font;
24: import java.util.Vector;
25: import java.awt.GraphicsEnvironment;
26:
27: /**
28: * A data structure for holding the properties common to all Properties objects.
29: * Currently it only holds the font names vector.
30: */
31: abstract class Properties {
32:
33: private static String[] fontNames;
34: private static boolean gotFontNames = false;
35:
36: /**
37: * Returns true if the font name exists in the graphics enviornment.
38: * @param name The name of the font to determine the existence of.
39: * @return boolean If true, then the font name exists.
40: */
41: public synchronized final boolean isFontNameExists(String name) {
42:
43: if (!gotFontNames)
44: getFontNames();
45: for (int i = 0; i < fontNames.length; ++i)
46: if (name.equals(fontNames[i]))
47: return true;
48: return false;
49: }
50:
51: private void getFontNames() {
52:
53: fontNames = GraphicsEnvironment.getLocalGraphicsEnvironment()
54: .getAvailableFontFamilyNames();
55: gotFontNames = true;
56: }
57: }
|