1 /* Copyright (C) 2000 Free Software Foundation
3 This file is part of libgcj.
5 This software is copyrighted work licensed under the terms of the
6 Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
12 * Status: Stubbed; A very incomplete implementation.
15 public class FontMetrics implements java.io.Serializable
19 protected FontMetrics(Font font)
29 public int getLeading()
32 return getHeight() - (getDescent() + getAscent());
35 public int getAscent()
38 return getHeight() - (getDescent() + getLeading());
41 public int getDescent()
44 return getHeight() - getDescent();
47 public int getHeight()
50 return getLeading() + getAscent() + getDescent();
53 public int getMaxAscent()
59 public int getMaxDescent()
65 /* @deprecated Use getMaxDescent() instead. */
66 public int getMaxDecent()
68 return getMaxDescent();
71 public int getMaxAdvance()
77 public int charWidth(int ch)
83 public int charWidth(char ch)
89 public int stringWidth(String str)
91 return charsWidth(str.toCharArray(), 0, str.length());
94 public int charsWidth(char[] data, int off, int len)
100 public int bytesWidth(byte[] data, int off, int len)
106 public int[] getWidths()
112 public boolean hasUniformLineMetrics()
118 // Don't have LineMetrics yet...
120 public LineMetrics getLineMetrics(String str, Graphics context)
122 public LineMetrics getLineMetrics(String str, int beginIndex, int limit,
125 public LineMetrics getLineMetrics(char[] chars, int beginIndex, int limit,
128 public LineMetrics getLineMetrics(CharacterIterator ci, int beginIndex,
129 int limit, Graphics context)
132 // Don't have Java2D yet.
134 public Rectangle2D getStringBounds(String str, Graphics context)
136 public Rectangle2D getStringBounds(String str, int beginIndex, int limit,
139 public Rectangle2D getStringBounds(char[] chars, int beginIndex, int limit,
142 public Rectangle2D getStringBounds(CharacterIterator ci, int beginIndex,
143 int limit, Graphics context)
145 public Rectangle2D getMaxCharBounds(Graphics context)
148 public String toString()
150 return this.getClass() + "[font=" + font + ",ascent=" + getAscent()
151 + ",descent=" + getDescent() + ",height=" + getHeight() + "]";