From e79e8c258fae5179102553eca8d93fa1ccb1b8a3 Mon Sep 17 00:00:00 2001 From: mdb Date: Wed, 15 May 2002 03:45:38 +0000 Subject: [PATCH] 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 --- .../samskivert/src/java/com/samskivert/swing/Label.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/projects/samskivert/src/java/com/samskivert/swing/Label.java b/projects/samskivert/src/java/com/samskivert/swing/Label.java index 434e5931..3a0e6cb8 100644 --- a/projects/samskivert/src/java/com/samskivert/swing/Label.java +++ b/projects/samskivert/src/java/com/samskivert/swing/Label.java @@ -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); }