java.awt.font

Class LineMetrics


  • public abstract class LineMetrics
    extends Object
    The LineMetrics class allows access to the metrics needed to layout characters along a line and to layout of a set of lines. A LineMetrics object encapsulates the measurement information associated with a run of text.

    Fonts can have different metrics for different ranges of characters. The getLineMetrics methods of Font take some text as an argument and return a LineMetrics object describing the metrics of the initial number of characters in that text, as returned by getNumChars().

    • Constructor Detail

      • LineMetrics

        public LineMetrics()
    • Method Detail

      • getNumChars

        public abstract int getNumChars()
        Returns the number of characters (char values) in the text whose metrics are encapsulated by this LineMetrics object.
        Returns:
        the number of characters (char values) in the text with which this LineMetrics 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.
      • 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 is CENTER_BASELINE then offsets[HANGING_BASELINE] is usually negative, offsets[CENTER_BASELINE] is zero, and offsets[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.

Document created the 11/06/2005, last modified the 04/03/2020
Source of the printed document:https://www.gaudry.be/en/java-api-rf-java/awt/font/LineMetrics.html

The infobrol is a personal site whose content is my sole responsibility. The text is available under CreativeCommons license (BY-NC-SA). More info on the terms of use and the author.

References

  1. View the html document Language of the document:fr Manuel PHP : https://docs.oracle.com

These references and links indicate documents consulted during the writing of this page, or which may provide additional information, but the authors of these sources can not be held responsible for the content of this page.
The author This site is solely responsible for the way in which the various concepts, and the freedoms that are taken with the reference works, are presented here. Remember that you must cross multiple source information to reduce the risk of errors.

Contents Haut