Robert was right about the regex. I have fixed it for now. I will work
on putting the filtering of characters in the native code instead.
2005-11-22 Lillian Angel <[EMAIL PROTECTED]>
* gnu/java/awt/peer/gtk/GdkGraphics.java
(drawString): Fixed regex.
On Tue, 2005-11-22 at 12:35 +0100, Robert Schuster wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Hi Lillian,
> this broke text drawing considerably. All the spaces in labels, textfields etc
> are missing now.
>
> Lillian Angel wrote:
> >> public class GdkGraphics extends Graphics
> >> {
> >>@@ -247,10 +247,13 @@
> >> native void drawString (GdkFontPeer f, String str, int x, int y);
> >> public void drawString (String str, int x, int y)
> >> {
> >>+ // FIXME: Possibly more characters we need to ignore/
> >>+ // Also, implementation may be inefficent because allocating
> >>+ // new Strings.
>
> The reason for this is here:
>
> >>+ str = Pattern.compile("[\b | \t | \n | \f | \r | \" |
> >>\']").matcher(str).replaceAll("");
>
> I guess you added the spaces to let the regexp look a bit nicer but this
> actually means that the expression will match space characters. The correct
> expression would be: "[\b|\t|\n|\f|\r|\"|\']"
>
> Apart from that I think Mark is right here. Doing the filtering in C would
> result in better performance. You could implement a special variant of the JNI
> function that makes Java Strings available as C strings and filter unwanted
> characters in it.
>
> cya
> Robert
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.1 (GNU/Linux)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
>
> iD8DBQFDgwKMG9cfwmwwEtoRAuc4AJ9vJz9to+lDFTchIs1qtPTOnwyoggCeJp5d
> dFgnMuaS2/DCWKmYZMCP/Sk=
> =z6rn
> -----END PGP SIGNATURE-----
Index: gnu/java/awt/peer/gtk/GdkGraphics.java
===================================================================
RCS file: /cvsroot/classpath/classpath/gnu/java/awt/peer/gtk/GdkGraphics.java,v
retrieving revision 1.50
diff -u -r1.50 GdkGraphics.java
--- gnu/java/awt/peer/gtk/GdkGraphics.java 21 Nov 2005 22:10:35 -0000 1.50
+++ gnu/java/awt/peer/gtk/GdkGraphics.java 22 Nov 2005 14:35:11 -0000
@@ -250,7 +250,7 @@
// FIXME: Possibly more characters we need to ignore/
// Also, implementation may be inefficent because allocating
// new Strings.
- str = Pattern.compile("[\b | \t | \n | \f | \r | \" | \']").matcher(str).replaceAll("");
+ str = Pattern.compile("[\b|\t|\n|\f|\r|\"|\']").matcher(str).replaceAll("");
drawString(getFontPeer(), str, x, y);
}
_______________________________________________
Classpath-patches mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/classpath-patches