< prev index next >
src/java.desktop/share/classes/javax/swing/text/Utilities.java
Print this page
*** 524,534 ****
if (i <= spaceAddonLeftoverEnd) {
nextX++;
}
}
} else {
! nextX += getFontCharWidth(txt[i], metrics, useFPAPI);
}
if (x < nextX) {
// found the hit position... return the appropriate side
int offset;
--- 524,539 ----
if (i <= spaceAddonLeftoverEnd) {
nextX++;
}
}
} else {
! // Use the floating point API directly as char width can be in
! // floating point for non-integer window scale
! Rectangle2D bounds = metrics.getFont().
! getStringBounds(new char[]{txt[i]}, 0, 1,
! metrics.getFontRenderContext());
! nextX += (float) bounds.getWidth();
}
if (x < nextX) {
// found the hit position... return the appropriate side
int offset;
< prev index next >