2 * (C) Copyright IBM Corp. 1998-2004. All Rights Reserved.
\r
4 * The program is provided "as is" without any warranty express or
\r
5 * implied, including the warranty of non-infringement and the implied
\r
6 * warranties of merchantibility and fitness for a particular purpose.
\r
7 * IBM will not be liable for any damages suffered by you as a result
\r
8 * of using the Program. In no event will IBM be liable for any
\r
9 * special, indirect or consequential damages or lost profits even if
\r
10 * IBM has been advised of the possibility of their occurrence. IBM
\r
11 * will not be liable for any third party claims against you.
\r
14 package com.ibm.richtext.uiimpl;
\r
16 import java.awt.GraphicsEnvironment;
\r
17 import java.util.Collections;
\r
18 import java.util.Iterator;
\r
19 import java.util.Vector;
\r
21 final class FontList {
\r
23 static final String COPYRIGHT =
\r
24 "(C) Copyright IBM Corp. 1998-1999 - All Rights Reserved";
\r
26 private static final String[] stripThese = {
\r
27 ".bold", ".bolditalic", ".italic"
\r
30 public static String[] getFontList() {
\r
32 String[] names = GraphicsEnvironment.getLocalGraphicsEnvironment()
\r
33 .getAvailableFontFamilyNames();
\r
34 Vector v = new Vector(names.length);
\r
35 for (int i=0; i < names.length; i++) {
\r
36 v.addElement(names[i]);
\r
39 Collections.sort(v);
\r
43 Iterator iter = v.listIterator();
\r
44 while (iter.hasNext()) {
\r
45 String current = (String) iter.next();
\r
46 testSuffixes: for (int i=0; i < stripThese.length; i++) {
\r
47 if (current.endsWith(stripThese[i])) {
\r
48 int baseLen = current.length()-stripThese[i].length();
\r
49 String base = current.substring(0, baseLen);
\r
50 if (base.equalsIgnoreCase(last)) {
\r
60 String[] result = new String[v.size()];
\r