summaryrefslogtreecommitdiffstats
path: root/libjava/classpath/java/awt/Font.java
diff options
context:
space:
mode:
Diffstat (limited to 'libjava/classpath/java/awt/Font.java')
-rw-r--r--libjava/classpath/java/awt/Font.java39
1 files changed, 38 insertions, 1 deletions
diff --git a/libjava/classpath/java/awt/Font.java b/libjava/classpath/java/awt/Font.java
index a52f63408da..1c22ce7b48f 100644
--- a/libjava/classpath/java/awt/Font.java
+++ b/libjava/classpath/java/awt/Font.java
@@ -48,6 +48,8 @@ import java.awt.font.TextLayout;
import java.awt.geom.AffineTransform;
import java.awt.geom.Rectangle2D;
import java.awt.peer.FontPeer;
+import java.io.File;
+import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.ObjectInputStream;
@@ -114,7 +116,14 @@ public class Font implements Serializable
* @since 1.3
*/
public static final int TRUETYPE_FONT = 0;
-
+
+ /**
+ * Indicates to <code>createFont</code> that the supplied font data
+ * is in Type1 format.
+ *
+ * @since 1.5
+ */
+ public static final int TYPE1_FONT = 1;
/**
* A flag for <code>layoutGlyphVector</code>, indicating that the
@@ -576,6 +585,34 @@ public class Font implements Serializable
}
/**
+ * Creates a new font from a File object.
+ *
+ * @see #layoutGlyphVector(FontRenderContext, char[], int, int, int)
+ *
+ * @param fontFormat - Integer code indicating the format the font data is
+ * in.Currently this can only be {@link #TRUETYPE_FONT}.
+ * @param file - a {@link File} from which font data will be read.
+ *
+ * @return A new {@link Font} of the format indicated.
+ *
+ * @throws IllegalArgumentException if <code>fontType</code> is not
+ * recognized.
+ * @throws NullPointerException if <code>file</code> is <code>null</code>.
+ * @throws FontFormatException if data in the file is invalid or cannot be read..
+ * @throws SecurityException if the caller has no read permission for the file.
+ * @throws IOException if the file cannot be read
+ *
+ * @since 1.5
+ */
+ public static Font createFont (int fontFormat, File file)
+ throws FontFormatException, IOException
+ {
+ if( file == null )
+ throw new NullPointerException("Null file argument");
+ return tk().createFont(fontFormat, new FileInputStream( file ));
+ }
+
+ /**
* Maps characters to glyphs in a one-to-one relationship, returning a new
* {@link GlyphVector} with a mapped glyph for each input character. This
* sort of mapping is often sufficient for some scripts such as Roman, but
OpenPOWER on IntegriCloud