diff options
Diffstat (limited to 'libjava/classpath/java/awt/FontMetrics.java')
-rw-r--r-- | libjava/classpath/java/awt/FontMetrics.java | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/libjava/classpath/java/awt/FontMetrics.java b/libjava/classpath/java/awt/FontMetrics.java index e702a625766..6dd73ec2560 100644 --- a/libjava/classpath/java/awt/FontMetrics.java +++ b/libjava/classpath/java/awt/FontMetrics.java @@ -193,7 +193,8 @@ public abstract class FontMetrics implements java.io.Serializable */ public int charWidth(int ch) { - return charWidth((char) ch); + char[] chars = Character.toChars(ch); + return charsWidth(chars, 0, chars.length); } /** @@ -235,7 +236,8 @@ public abstract class FontMetrics implements java.io.Serializable public int charsWidth(char[] buf, int offset, int len) { int total_width = 0; - for (int i = offset; i < len; i++) + int endOffset = offset + len; + for (int i = offset; i < endOffset; i++) total_width += charWidth(buf[i]); return total_width; } |