1 /*
2 * Copyright (c) 1998, 2003, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
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
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
|
1 /*
2 * Copyright (c) 1998, 2020, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
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
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 * Constructor for subclasses to call.
48 */
49 protected LineMetrics() {}
50
51 /**
52 * Returns the number of characters ({@code char} values) in the text whose
53 * metrics are encapsulated by this {@code LineMetrics}
54 * object.
55 * @return the number of characters ({@code char} values) in the text with which
56 * this {@code LineMetrics} was created.
57 */
58 public abstract int getNumChars();
59
60 /**
61 * Returns the ascent of the text. The ascent
62 * is the distance from the baseline
63 * to the ascender line. The ascent usually represents the
64 * the height of the capital letters of the text. Some characters
65 * can extend above the ascender line.
66 * @return the ascent of the text.
67 */
68 public abstract float getAscent();
69
|