This is the mail archive of the java-patches@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[gui][PATCH] Set default font size attribute


Hi,

I committed this to java-gui-branch.  It matches the behaviour of Sun's
setStandardAttributes implementation except that it clamps the size to a
minimum of one since Pango doesn't support zero as a font size.

Tom

2004-10-20  Thomas Fitzsimmons  <fitzsim@redhat.com>

	* gnu/java/awt/peer/ClasspathFontPeer.java
	(setStandardAttributes(String,Map)): If size attribute doesn't
	exist, default to size 12.  Clamp size value to a minimum of 1.


Index: gnu/java/awt/peer/ClasspathFontPeer.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/gnu/java/awt/peer/ClasspathFontPeer.java,v
retrieving revision 1.2.2.2
diff -u -r1.2.2.2 ClasspathFontPeer.java
--- gnu/java/awt/peer/ClasspathFontPeer.java	4 Oct 2004 16:45:46 -0000	1.2.2.2
+++ gnu/java/awt/peer/ClasspathFontPeer.java	20 Oct 2004 21:13:41 -0000
@@ -218,7 +218,7 @@
     AffineTransform trans = this.transform;
     float size = this.size;
     int style = this.style;
-    
+
     if (attribs.containsKey (TextAttribute.FAMILY))
       family = (String) attribs.get (TextAttribute.FAMILY);
 
@@ -243,7 +243,13 @@
       {
         Float sz = (Float) attribs.get (TextAttribute.SIZE);
         size = sz.floatValue ();
+
+        // Pango doesn't accept 0 as a font size.
+        if (size < 1)
+          size = 1;
       }
+    else
+      size = 12;
 
     if (attribs.containsKey (TextAttribute.TRANSFORM))
       {



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]