Interface FontMetrics

  • All Known Implementing Classes:
    AWTFontMetrics, BaseFontFontMetrics, EmptyFontMetrics, MonospaceFontMetrics, TrueTypeFontMetrics

    public interface FontMetrics
    Font-metrics are computed for a certain font-size and style. There are no general metrics, which are assumed to be globally available.

    The use of these font metrics is application dependent. As building these metrics usually is memory and CPU intensive, this must be done in an application specific context. You certainly want to cache the font data.

    Author:
    Thomas Morgner
    • Method Detail

      • getAscent

        long getAscent()
        The font ascent is the distance from the font's baseline to the top of most alphanumeric characters. The ascent is always a positive number.
        Returns:
        the ascent.
      • getDescent

        long getDescent()
        The font descent is the distance from the font's baseline to the bottom of most alphanumeric characters. The descent is always a positive number.
        Returns:
        the descent.
      • getLeading

        long getLeading()
        The standard leading, or interline spacing, is the logical amount of space to be reserved between the descent of one line of text and the ascent of the next line. The height metric is calculated to include this extra space. The leading is always a positive number.
        Returns:
        the leading.
      • getXHeight

        long getXHeight()
        The height of the lowercase 'x'. This is used as hint, which size the lowercase characters will have.
        Returns:
      • getOverlinePosition

        long getOverlinePosition()
      • getUnderlinePosition

        long getUnderlinePosition()
      • getStrikeThroughPosition

        long getStrikeThroughPosition()
      • getMaxAscent

        long getMaxAscent()
      • getMaxDescent

        long getMaxDescent()
      • getMaxHeight

        long getMaxHeight()
      • getMaxCharAdvance

        long getMaxCharAdvance()
      • getCharWidth

        long getCharWidth​(int codePoint)
      • getKerning

        long getKerning​(int previous,
                        int codePoint)
      • getItalicAngle

        long getItalicAngle()
      • getBaselines

        BaselineInfo getBaselines​(int codePoint,
                                  BaselineInfo info)
        Baselines are defined for scripts, not glyphs. A glyph carries script information most of the time (unless it is a neutral characters or just weird).
        Parameters:
        codePoint -
        info -
        Returns:
      • isUniformFontMetrics

        boolean isUniformFontMetrics()
        Is it guaranteed that the font always returns the same baseline info objct?
        Returns:
        true, if the baseline info in question is always the same, false otherwise.