KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > openlaszlo > media > FontType


1 /******************************************************************************
2  * FontType.java
3  * ****************************************************************************/

4
5 /* J_LZ_COPYRIGHT_BEGIN *******************************************************
6 * Copyright 2001-2004 Laszlo Systems, Inc. All Rights Reserved. *
7 * Use is subject to license terms. *
8 * J_LZ_COPYRIGHT_END *********************************************************/

9
10 package org.openlaszlo.media;
11
12 /**
13  * Class for holding font type strings.
14  *
15  * @author <a HREF="mailto:bloch@laszlosystems.com">Eric Bloch</a>
16  */

17 public class FontType {
18     public static final String JavaDoc FFT = "fft";
19     public static final String JavaDoc TTF = "ttf";
20
21     /**
22      * Return the font type from a filename
23      */

24     public static String JavaDoc fromName(String JavaDoc name) {
25         int index = name.lastIndexOf('.');
26         if (index == -1 || index + 2 >= name.length()) {
27             return "";
28         }
29
30         return name.substring(index+1).toLowerCase();
31     }
32 }
33
34
Popular Tags