bug-classpath
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug swing/24316] Utilities.getTabbedTextOffset problems


From: abalkiss at redhat dot com
Subject: [Bug swing/24316] Utilities.getTabbedTextOffset problems
Date: 31 Oct 2005 18:59:25 -0000


------- Comment #2 from abalkiss at redhat dot com  2005-10-31 18:59 -------
There are other problems with this method as well.  The attached Tabbed.java
starts with a string consisting of m's and spaces and iterates over it,
removing the left-most character every time and calling getTabbedTextOffset
every time.  The first calculation seems correct, but after that it returns the
same answer always even when it is inappropriate.

If comparing this to Sun's implementation we don't expect the exact same output
because our font metrics are not exactly the same, so I've made the testcase
print out some information that explains the return result of
getTabbedTextOffset.

In the testcase, the call to getTabbedTextOffset is basically trying to find
the index in the given string such that the substring from 0 to this index
represents the best fit into 100 pixels (ie, adding 1 other character would
push us too high above 100 or removing 1 other character would drop it too far
below 100).  You can see that Sun's implementation does a good job of this,
whereas ours only does a good job for the first call, and after that just
returns the same answer.

Parameters to play around with to get different results would be the initial
string (variable "text"), and the number of pixels to fit the string into (the
hardcoded 100 in the call to getTabbedTextOffset).


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24316





reply via email to

[Prev in Thread] Current Thread [Next in Thread]