diff options
author | jlquinn <jlquinn@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-04-22 05:34:30 +0000 |
---|---|---|
committer | jlquinn <jlquinn@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-04-22 05:34:30 +0000 |
commit | feb0f3815cd0afe893bb3930c6ddb77f4b7bcc5d (patch) | |
tree | 6cb06df5e40b6dd5d96bf879374df74955299a58 | |
parent | 141efd27417ceb7f5799ad0ea395579ddceee0b9 (diff) | |
download | gcc-feb0f3815cd0afe893bb3930c6ddb77f4b7bcc5d.tar.gz |
2004-04-22 Jerry Quinn <jlquinn@optonline.net>
* java/awt/Font.java (deriveFont): Implement missing variants.
* gnu/java/awt/peer/ClasspathFontPeer.java (deriveFont): Implement
missing variants.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@81002 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | libjava/ChangeLog | 6 | ||||
-rw-r--r-- | libjava/gnu/java/awt/peer/ClasspathFontPeer.java | 35 | ||||
-rw-r--r-- | libjava/java/awt/Font.java | 39 |
3 files changed, 78 insertions, 2 deletions
diff --git a/libjava/ChangeLog b/libjava/ChangeLog index b5a60bd1216..ae285939f42 100644 --- a/libjava/ChangeLog +++ b/libjava/ChangeLog @@ -1,3 +1,9 @@ +2004-04-22 Jerry Quinn <jlquinn@optonline.net> + + * java/awt/Font.java (deriveFont): Implement missing variants. + * gnu/java/awt/peer/ClasspathFontPeer.java (deriveFont): Implement + missing variants. + 2004-04-21 Bryce McKinlay <mckinlay@redhat.com> * java/lang/natClass.cc (_Jv_LayoutInterfaceMethods): New method. diff --git a/libjava/gnu/java/awt/peer/ClasspathFontPeer.java b/libjava/gnu/java/awt/peer/ClasspathFontPeer.java index 287c271ba2f..6b753aa15ec 100644 --- a/libjava/gnu/java/awt/peer/ClasspathFontPeer.java +++ b/libjava/gnu/java/awt/peer/ClasspathFontPeer.java @@ -1,5 +1,5 @@ /* ClasspathFontPeer.java -- Font peer used by GNU Classpath. - Copyright (C) 2003 Free Software Foundation, Inc. + Copyright (C) 2003, 2004 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -395,6 +395,23 @@ public abstract class ClasspathFontPeer } /** + * Implementation of {@link Font#deriveFont(int, float)} + * + * @param font the font this peer is being called from. This may be + * useful if you are sharing peers between Font objects. Otherwise it may + * be ignored. + */ + + public Font deriveFont (Font font, int style, float size) + { + Map attrs = new HashMap (); + getStandardAttributes (attrs); + copyStyleToAttrs (style, attrs); + copySizeToAttrs (size, attrs); + return tk().getFont (logicalName, attrs); + } + + /** * Implementation of {@link Font#deriveFont(float)} * * @param font the font this peer is being called from. This may be @@ -444,6 +461,22 @@ public abstract class ClasspathFontPeer } /** + * Implementation of {@link Font#deriveFont(AffineTransform)} + * + * @param font the font this peer is being called from. This may be + * useful if you are sharing peers between Font objects. Otherwise it may + * be ignored. + */ + + public Font deriveFont (Font font, AffineTransform t) + { + Map attrs = new HashMap (); + getStandardAttributes (attrs); + copyTransformToAttrs (t, attrs); + return tk().getFont (logicalName, attrs); + } + + /** * Implementation of {@link Font#deriveFont(Map)} * * @param font the font this peer is being called from. This may be diff --git a/libjava/java/awt/Font.java b/libjava/java/awt/Font.java index 42f9f7b85eb..4c70c735797 100644 --- a/libjava/java/awt/Font.java +++ b/libjava/java/awt/Font.java @@ -1,5 +1,5 @@ /* Font.java -- Font object - Copyright (C) 1999, 2002 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2004 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -650,6 +650,22 @@ private static final long serialVersionUID = -4206021311591459213L; /** * Produces a new {@link Font} based on the current font, adjusted to a + * new size and style. + * + * @param style The style of the newly created font. + * @param size The size of the newly created font. + * + * @return A clone of the current font, with the specified size and style. + * + * @since 1.2 + */ + public Font deriveFont (int style, float size) +{ + return peer.deriveFont (this, style, size); +} + +/** + * Produces a new {@link Font} based on the current font, adjusted to a * new size. * * @param size The size of the newly created font. @@ -702,6 +718,27 @@ private static final long serialVersionUID = -4206021311591459213L; } /** + * Produces a new {@link Font} based on the current font, subjected + * to a new affine transformation. + * + * @param a The transformation to apply. + * + * @return A clone of the current font, with the specified transform. + * + * @throws IllegalArgumentException If transformation is + * <code>null</code>. + * + * @since 1.2 + */ + public Font deriveFont (AffineTransform a) +{ + if (a == null) + throw new IllegalArgumentException ("Affine transformation is null"); + + return peer.deriveFont (this, a); +} + +/** * Produces a new {@link Font} based on the current font, adjusted to a * new set of attributes. * |