[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Compilation in javax/swing/plaf/basic/BasicGraphicsUtils.java
From: |
Sascha Brawer |
Subject: |
Re: Compilation in javax/swing/plaf/basic/BasicGraphicsUtils.java |
Date: |
Thu, 19 Jun 2003 02:40:21 +0200 |
Stephen Crawley <address@hidden> wrote on Thu, 19 Jun 2003 02:36:42
+1000:
>Found 1 semantic error compiling "../javax/swing/plaf/basic/
>BasicGraphicsUtils.java":
>
> 483. lineMetrics = font.getLineMetrics(text, frc);
> <---------------------------->
>*** Error: No method named "getLineMetrics" was found in type "java/awt/
Font".
I am sorry for this. Given the unfortunately still very desolate state of
our graphics support, I could not test my Swing code if I compiled it
with the rest of Classpath. Therefore, if some other package does not
conform to the API spec, it can happen that I do not get any compilation
errors.
In any case, here's a patch for java/awt/Font.java which should make
things compile again (already in CVS).
-- Sascha
Sascha Brawer, address@hidden, http://www.dandelis.ch/people/brawer/
Index: java/awt/Font.java
===================================================================
RCS file: /cvsroot/classpath//classpath/java/awt/Font.java,v
retrieving revision 1.9
diff -u -r1.9 Font.java
--- java/awt/Font.java 22 May 2003 07:14:25 -0000 1.9
+++ java/awt/Font.java 19 Jun 2003 00:25:15 -0000
@@ -39,6 +39,8 @@
package java.awt;
import java.awt.peer.FontPeer;
+import java.awt.font.FontRenderContext;
+import java.awt.font.LineMetrics;
import java.io.Serializable;
import java.util.StringTokenizer;
@@ -484,5 +486,28 @@
",size=" + size + ")");
}
+
+ /**
+ * Determines the line metrics for a run of text.
+ *
+ * @param str the text run to be measured.
+ *
+ * @param frc the font rendering parameters that are used for the
+ * measurement. The exact placement and size of text slightly
+ * depends on device-specific characteristics, for instance
+ * the device resolution or anti-aliasing. For this reason,
+ * the returned measurement will only be accurate if the
+ * passed <code>FontRenderContext</code> correctly reflects
+ * the relevant parameters. Hence, <code>frc</code> should be
+ * obtained from the same <code>Graphics2D</code> that will
+ * be used for drawing, and any rendering hints should be set
+ * to the desired values before obtaining <code>frc</code>.
+ *
+ * @see java.awt.Graphics2D#getFontRenderContext()
+ */
+ public LineMetrics getLineMetrics(String str, FontRenderContext frc)
+ {
+ throw new UnsupportedOperationException(); // FIXME
+ }
} // class Font