9 * by Oracle in the LICENSE file that accompanied this code. 10 * 11 * This code is distributed in the hope that it will be useful, but WITHOUT 12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 * version 2 for more details (a copy is included in the LICENSE file that 15 * accompanied this code). 16 * 17 * You should have received a copy of the GNU General Public License version 18 * 2 along with this work; if not, write to the Free Software Foundation, 19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 * 21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 * or visit www.oracle.com if you need additional information or have any 23 * questions. 24 */ 25 26 package java.awt.font; 27 28 /** 29 * The <code>LineMetrics</code> class allows access to the 30 * metrics needed to layout characters along a line 31 * and to layout of a set of lines. A <code>LineMetrics</code> 32 * object encapsulates the measurement information associated 33 * with a run of text. 34 * <p> 35 * Fonts can have different metrics for different ranges of 36 * characters. The <code>getLineMetrics</code> methods of 37 * {@link java.awt.Font Font} take some text as an argument 38 * and return a <code>LineMetrics</code> object describing the 39 * metrics of the initial number of characters in that text, as 40 * returned by {@link #getNumChars}. 41 */ 42 43 44 public abstract class LineMetrics { 45 46 47 /** 48 * Returns the number of characters (<code>char</code> values) in the text whose 49 * metrics are encapsulated by this <code>LineMetrics</code> 50 * object. 51 * @return the number of characters (<code>char</code> values) in the text with which 52 * this <code>LineMetrics</code> was created. 53 */ 54 public abstract int getNumChars(); 55 56 /** 57 * Returns the ascent of the text. The ascent 58 * is the distance from the baseline 59 * to the ascender line. The ascent usually represents the 60 * the height of the capital letters of the text. Some characters 61 * can extend above the ascender line. 62 * @return the ascent of the text. 63 */ 64 public abstract float getAscent(); 65 66 /** 67 * Returns the descent of the text. The descent 68 * is the distance from the baseline 69 * to the descender line. The descent usually represents 70 * the distance to the bottom of lower case letters like 71 * 'p'. Some characters can extend below the descender 72 * line. 89 * descent and the leading. 90 * @return the height of the text. 91 */ 92 public abstract float getHeight(); 93 94 /** 95 * Returns the baseline index of the text. 96 * The index is one of 97 * {@link java.awt.Font#ROMAN_BASELINE ROMAN_BASELINE}, 98 * {@link java.awt.Font#CENTER_BASELINE CENTER_BASELINE}, 99 * {@link java.awt.Font#HANGING_BASELINE HANGING_BASELINE}. 100 * @return the baseline of the text. 101 */ 102 public abstract int getBaselineIndex(); 103 104 /** 105 * Returns the baseline offsets of the text, 106 * relative to the baseline of the text. The 107 * offsets are indexed by baseline index. For 108 * example, if the baseline index is 109 * <code>CENTER_BASELINE</code> then 110 * <code>offsets[HANGING_BASELINE]</code> is usually 111 * negative, <code>offsets[CENTER_BASELINE]</code> 112 * is zero, and <code>offsets[ROMAN_BASELINE]</code> 113 * is usually positive. 114 * @return the baseline offsets of the text. 115 */ 116 public abstract float[] getBaselineOffsets(); 117 118 /** 119 * Returns the position of the strike-through line 120 * relative to the baseline. 121 * @return the position of the strike-through line. 122 */ 123 public abstract float getStrikethroughOffset(); 124 125 /** 126 * Returns the thickness of the strike-through line. 127 * @return the thickness of the strike-through line. 128 */ 129 public abstract float getStrikethroughThickness(); 130 131 /** 132 * Returns the position of the underline relative to | 9 * by Oracle in the LICENSE file that accompanied this code. 10 * 11 * This code is distributed in the hope that it will be useful, but WITHOUT 12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 * version 2 for more details (a copy is included in the LICENSE file that 15 * accompanied this code). 16 * 17 * You should have received a copy of the GNU General Public License version 18 * 2 along with this work; if not, write to the Free Software Foundation, 19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 * 21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 * or visit www.oracle.com if you need additional information or have any 23 * questions. 24 */ 25 26 package java.awt.font; 27 28 /** 29 * The {@code LineMetrics} class allows access to the 30 * metrics needed to layout characters along a line 31 * and to layout of a set of lines. A {@code LineMetrics} 32 * object encapsulates the measurement information associated 33 * with a run of text. 34 * <p> 35 * Fonts can have different metrics for different ranges of 36 * characters. The {@code getLineMetrics} methods of 37 * {@link java.awt.Font Font} take some text as an argument 38 * and return a {@code LineMetrics} object describing the 39 * metrics of the initial number of characters in that text, as 40 * returned by {@link #getNumChars}. 41 */ 42 43 44 public abstract class LineMetrics { 45 46 47 /** 48 * Returns the number of characters ({@code char} values) in the text whose 49 * metrics are encapsulated by this {@code LineMetrics} 50 * object. 51 * @return the number of characters ({@code char} values) in the text with which 52 * this {@code LineMetrics} was created. 53 */ 54 public abstract int getNumChars(); 55 56 /** 57 * Returns the ascent of the text. The ascent 58 * is the distance from the baseline 59 * to the ascender line. The ascent usually represents the 60 * the height of the capital letters of the text. Some characters 61 * can extend above the ascender line. 62 * @return the ascent of the text. 63 */ 64 public abstract float getAscent(); 65 66 /** 67 * Returns the descent of the text. The descent 68 * is the distance from the baseline 69 * to the descender line. The descent usually represents 70 * the distance to the bottom of lower case letters like 71 * 'p'. Some characters can extend below the descender 72 * line. 89 * descent and the leading. 90 * @return the height of the text. 91 */ 92 public abstract float getHeight(); 93 94 /** 95 * Returns the baseline index of the text. 96 * The index is one of 97 * {@link java.awt.Font#ROMAN_BASELINE ROMAN_BASELINE}, 98 * {@link java.awt.Font#CENTER_BASELINE CENTER_BASELINE}, 99 * {@link java.awt.Font#HANGING_BASELINE HANGING_BASELINE}. 100 * @return the baseline of the text. 101 */ 102 public abstract int getBaselineIndex(); 103 104 /** 105 * Returns the baseline offsets of the text, 106 * relative to the baseline of the text. The 107 * offsets are indexed by baseline index. For 108 * example, if the baseline index is 109 * {@code CENTER_BASELINE} then 110 * {@code offsets[HANGING_BASELINE]} is usually 111 * negative, {@code offsets[CENTER_BASELINE]} 112 * is zero, and {@code offsets[ROMAN_BASELINE]} 113 * is usually positive. 114 * @return the baseline offsets of the text. 115 */ 116 public abstract float[] getBaselineOffsets(); 117 118 /** 119 * Returns the position of the strike-through line 120 * relative to the baseline. 121 * @return the position of the strike-through line. 122 */ 123 public abstract float getStrikethroughOffset(); 124 125 /** 126 * Returns the thickness of the strike-through line. 127 * @return the thickness of the strike-through line. 128 */ 129 public abstract float getStrikethroughThickness(); 130 131 /** 132 * Returns the position of the underline relative to |