jdk/src/share/classes/java/awt/FontMetrics.java
Print this page
*** 27,36 ****
--- 27,38 ----
import java.awt.Graphics2D;
import java.awt.font.FontRenderContext;
import java.awt.font.LineMetrics;
import java.awt.geom.Rectangle2D;
+ import java.nio.charset.Charset;
+ import java.nio.charset.StandardCharsets;
import java.text.CharacterIterator;
/**
* The <code>FontMetrics</code> class defines a font metrics object, which
* encapsulates information about the rendering of a particular font on a
*** 408,418 ****
* the bounds of the <code>data</code> array.
* @see #charsWidth(char[], int, int)
* @see #stringWidth(String)
*/
public int bytesWidth(byte data[], int off, int len) {
! return stringWidth(new String(data, 0, off, len));
}
/**
* Gets the advance widths of the first 256 characters in the
* <code>Font</code>. The advance is the
--- 410,420 ----
* the bounds of the <code>data</code> array.
* @see #charsWidth(char[], int, int)
* @see #stringWidth(String)
*/
public int bytesWidth(byte data[], int off, int len) {
! return stringWidth(new String(data, off, len, StandardCharsets.ISO_8859_1));
}
/**
* Gets the advance widths of the first 256 characters in the
* <code>Font</code>. The advance is the