- java.lang.Object
-
- java.awt.font.LineMetrics
-
public abstract class LineMetrics extends Object
TheLineMetrics
class allows access to the metrics needed to layout characters along a line and to layout of a set of lines. ALineMetrics
object encapsulates the measurement information associated with a run of text.Fonts can have different metrics for different ranges of characters. The
getLineMetrics
methods ofFont
take some text as an argument and return aLineMetrics
object describing the metrics of the initial number of characters in that text, as returned bygetNumChars()
.
-
-
Constructor Summary
Constructors Constructor and Description LineMetrics()
-
Method Summary
Methods Modifier and Type Method and Description abstract float
getAscent()
Returns the ascent of the text.abstract int
getBaselineIndex()
Returns the baseline index of the text.abstract float[]
getBaselineOffsets()
Returns the baseline offsets of the text, relative to the baseline of the text.abstract float
getDescent()
Returns the descent of the text.abstract float
getHeight()
Returns the height of the text.abstract float
getLeading()
Returns the leading of the text.abstract int
getNumChars()
Returns the number of characters (char
values) in the text whose metrics are encapsulated by thisLineMetrics
object.abstract float
getStrikethroughOffset()
Returns the position of the strike-through line relative to the baseline.abstract float
getStrikethroughThickness()
Returns the thickness of the strike-through line.abstract float
getUnderlineOffset()
Returns the position of the underline relative to the baseline.abstract float
getUnderlineThickness()
Returns the thickness of the underline.
-
-
-
Method Detail
-
getNumChars
public abstract int getNumChars()
Returns the number of characters (char
values) in the text whose metrics are encapsulated by thisLineMetrics
object.- Returns:
- the number of characters (
char
values) in the text with which thisLineMetrics
was created.
-
getAscent
public abstract float getAscent()
Returns the ascent of the text. The ascent is the distance from the baseline to the ascender line. The ascent usually represents the the height of the capital letters of the text. Some characters can extend above the ascender line.- Returns:
- the ascent of the text.
-
getDescent
public abstract float getDescent()
Returns the descent of the text. The descent is the distance from the baseline to the descender line. The descent usually represents the distance to the bottom of lower case letters like 'p'. Some characters can extend below the descender line.- Returns:
- the descent of the text.
-
getLeading
public abstract float getLeading()
Returns the leading of the text. The leading is the recommended distance from the bottom of the descender line to the top of the next line.- Returns:
- the leading of the text.
-
getHeight
public abstract float getHeight()
Returns the height of the text. The height is equal to the sum of the ascent, the descent and the leading.- Returns:
- the height of the text.
-
getBaselineIndex
public abstract int getBaselineIndex()
Returns the baseline index of the text. The index is one ofROMAN_BASELINE
,CENTER_BASELINE
,HANGING_BASELINE
.- Returns:
- the baseline of the text.
-
getBaselineOffsets
public abstract float[] getBaselineOffsets()
Returns the baseline offsets of the text, relative to the baseline of the text. The offsets are indexed by baseline index. For example, if the baseline index isCENTER_BASELINE
thenoffsets[HANGING_BASELINE]
is usually negative,offsets[CENTER_BASELINE]
is zero, andoffsets[ROMAN_BASELINE]
is usually positive.- Returns:
- the baseline offsets of the text.
-
getStrikethroughOffset
public abstract float getStrikethroughOffset()
Returns the position of the strike-through line relative to the baseline.- Returns:
- the position of the strike-through line.
-
getStrikethroughThickness
public abstract float getStrikethroughThickness()
Returns the thickness of the strike-through line.- Returns:
- the thickness of the strike-through line.
-
getUnderlineOffset
public abstract float getUnderlineOffset()
Returns the position of the underline relative to the baseline.- Returns:
- the position of the underline.
-
getUnderlineThickness
public abstract float getUnderlineThickness()
Returns the thickness of the underline.- Returns:
- the thickness of the underline.
-
-
Traduction non disponible
Les API Java ne sont pas encore traduites en français sur l'infobrol. Seule la version anglaise est disponible pour l'instant.
Version en cache
21/11/2024 21:39:50 Cette version de la page est en cache (à la date du 21/11/2024 21:39:50) afin d'accélérer le traitement. Vous pouvez activer le mode utilisateur dans le menu en haut pour afficher la dernère version de la page.Document créé le 30/08/2006, dernière modification le 04/03/2020
Source du document imprimé : https://www.gaudry.be/java-api-rf-java/awt/font/linemetrics.html
L'infobrol est un site personnel dont le contenu n'engage que moi. Le texte est mis à disposition sous licence CreativeCommons(BY-NC-SA). Plus d'info sur les conditions d'utilisation et sur l'auteur.
Références
Ces références et liens indiquent des documents consultés lors de la rédaction de cette page, ou qui peuvent apporter un complément d'information, mais les auteurs de ces sources ne peuvent être tenus responsables du contenu de cette page.
L'auteur de ce site est seul responsable de la manière dont sont présentés ici les différents concepts, et des libertés qui sont prises avec les ouvrages de référence. N'oubliez pas que vous devez croiser les informations de sources multiples afin de diminuer les risques d'erreurs.