TextLayout.getBounds() returns for its bounds a rectangle that "contains

all of the pixels the TextLayout can draw." This turns out to mean that
x+width and y+height are actually rendered upon, unlike every other
fucking AWT thing that returns its bounds where x+width-1 is occupied but
not x+width. It's the fucking drawRect()/fillRect() fiasco all over
again. Anyway, we up our bounds by a pixel so that we behave like every
other normal Euclid fearing user interface construct.


git-svn-id: https://samskivert.googlecode.com/svn/trunk@738 6335cc39-0255-0410-8fd6-9bcaacd3b74c
This commit is contained in:
mdb
2002-05-15 03:45:38 +00:00
parent a7a2e2c229
commit e79e8c258f
@@ -1,5 +1,5 @@
//
// $Id: Label.java,v 1.8 2002/04/30 01:57:47 mdb Exp $
// $Id: Label.java,v 1.9 2002/05/15 03:45:38 mdb Exp $
package com.samskivert.swing;
@@ -199,6 +199,13 @@ public class Label implements SwingConstants
Rectangle2D bounds = layout.getBounds();
// for some reason JDK1.3 on Linux chokes on setSize(double,double)
_size.setSize((int)bounds.getWidth(), (int)getHeight(layout));
// the bounds returned by layout.getBounds() are such that
// x+width is actually a pixel contained within the bounds
// (and associatedly y+height), so we have to increase the
// bounds by 1 pixel to return a rectangle that *actually*
// contains ourselves
_size.width += 1;
_size.height += 1;
layouts = new ArrayList();
layouts.add(layout);
}