diff options
author | Sven de Marothy <sven@physto.se> | 2006-07-25 17:58:52 +0000 |
---|---|---|
committer | Sven de Marothy <sven@physto.se> | 2006-07-25 17:58:52 +0000 |
commit | bf56eff91b7a9e15c8ed0d0f2d3879eba0929550 (patch) | |
tree | 59b1b50e91fe767bf26c9ae6c826169ef4a193eb | |
parent | 0dfcdeae3483e525a255235aaec31a770a32574f (diff) | |
download | classpath-bf56eff91b7a9e15c8ed0d0f2d3879eba0929550.tar.gz |
2006-07-25 Sven de Marothy <sven@physto.se>
* native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkVolatileImage.c
(init): Default to the actual depth in the worst case.
* java/awt/Font.java
(createFont(int, File)): New method.
-rw-r--r-- | ChangeLog | 8 | ||||
-rw-r--r-- | java/awt/Font.java | 30 | ||||
-rw-r--r-- | native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkVolatileImage.c | 3 |
3 files changed, 40 insertions, 1 deletions
@@ -1,3 +1,11 @@ +2006-07-25 Sven de Marothy <sven@physto.se> + + * native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkVolatileImage.c + (init): Default to the actual depth in the worst case. + + * java/awt/Font.java + (createFont(int, File)): New method. + 2006-07-25 Ito Kazumitsu <kaz@maczuka.gcd.org> Fixes bug #28413 diff --git a/java/awt/Font.java b/java/awt/Font.java index 7e0306dc0..1c22ce7b4 100644 --- a/java/awt/Font.java +++ b/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; @@ -583,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 diff --git a/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkVolatileImage.c b/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkVolatileImage.c index d7ef474e0..e391d64ec 100644 --- a/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkVolatileImage.c +++ b/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkVolatileImage.c @@ -73,7 +73,8 @@ Java_gnu_java_awt_peer_gtk_GtkVolatileImage_init (JNIEnv *env, pixmap = gdk_pixmap_new( widget->window, width, height, -1 ); } else - pixmap = gdk_pixmap_new( NULL, width, height, 16 ); + pixmap = gdk_pixmap_new( NULL, width, height, + gdk_rgb_get_visual()->depth ); gdk_threads_leave(); |