Class RMFontFile


  • public class RMFontFile
    extends java.lang.Object
    This class represents all the information about a font that is independent of size. This allows RMFont to be lighter weight (essentially just a font file at a given size).
    Since:
    7.8.5 The ReportMill implementation of this would often come up with horribly bad matches for fonts, such as changing Tahoma Italic to Goudy Old Style (wtf?). Since we're holding on to the java Font anyway, rewrote to use that as the key, not the name.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      boolean canDisplay​(char aChar)
      Returns if this font can display the given char.
      double charAdvance​(char aChar)
      Returns the char advance for the given char.
      double charKern​(char aChar1, char aChar2)
      Returns the kerning for the given pair of characters (no way to do this in Java!).
      RMPath charPath​(char aChar)
      Returns the path for a given character.
      RMFontFile getBold()
      Returns the bold version of this font.
      java.lang.String getFamily()
      Returns the family name of this font.
      java.lang.String getFamilyEnglish()
      Returns the family name of this font in English.
      static RMFontFile getFontFile​(java.awt.Font aFont)
      Returns a font file for a given font.
      static RMFontFile getFontFile​(java.lang.String aName)
      Deprecated.
      java.lang.String getFontName()
      Returns the name of this font.
      java.lang.String getFontNameEnglish()
      Returns the name of this font in English.
      int getFontStyle()  
      double getHeight()
      Returns the height of this font file.
      RMFontFile getItalic()
      Returns the italic version of this font.
      double getLeading()
      Returns the default distance between lines for this font.
      double getLineAdvance()
      Returns the distance from the top of a line of text to the to top of a successive line of text.
      double getLineHeight()
      Returns the height of a line of text in this font.
      java.lang.String getLogicalName()
      Gets the logical name of this font.
      double getMaxAdvance()
      Returns the max advance of characters in this font.
      double getMaxAscent()
      Returns the max distance above the baseline that this font goes.
      double getMaxDescent()
      Returns the max distance below the baseline that this font goes.
      java.lang.String getPSName()
      Returns the PostScript name of this font.
      double getStrikethroughOffset()
      Returns the distance above the baseline that a strikethrough should be drawn.
      double getUnderlineOffset()
      Returns the distance below the baseline that an underline should be drawn.
      double getUnderlineThickness()
      Returns the default thickness that an underline should be drawn.
      boolean isBold()
      Returns whether this font is considered bold.
      boolean isItalic()
      Returns whether this font is considered italic.
      RMFontFile setStyle​(int style)
      Returns this if the style is already set, else creates a new font with the style set
      RMFontFile toggleStyle​(int style)
      Creates a new font with the given style (Font.BOLD or Font.ITALIC) toggled.
      java.lang.String toString()
      Returns the font name of this font file.
      RMFontFile unsetStyle​(int style)
      Returns this if the style is not already set, else creates a new font with the style unset
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Method Detail

      • getFontFile

        @Deprecated
        public static RMFontFile getFontFile​(@Nonnull
                                             java.lang.String aName)
        Deprecated.
        Returns a font file for a given font name.
      • getFontFile

        public static RMFontFile getFontFile​(@Nonnull
                                             java.awt.Font aFont)
        Returns a font file for a given font.
      • getFontName

        public java.lang.String getFontName()
        Returns the name of this font.
      • getFontNameEnglish

        public java.lang.String getFontNameEnglish()
        Returns the name of this font in English.
      • getLogicalName

        public java.lang.String getLogicalName()
        Gets the logical name of this font. This is the name used to create a new font.
      • getFamily

        public java.lang.String getFamily()
        Returns the family name of this font.
      • getFamilyEnglish

        public java.lang.String getFamilyEnglish()
        Returns the family name of this font in English.
      • getPSName

        public java.lang.String getPSName()
        Returns the PostScript name of this font.
      • getFontStyle

        public int getFontStyle()
      • charAdvance

        public double charAdvance​(char aChar)
        Returns the char advance for the given char.
      • charKern

        public double charKern​(char aChar1,
                               char aChar2)
        Returns the kerning for the given pair of characters (no way to do this in Java!).
      • charPath

        @Nullable
        public RMPath charPath​(char aChar)
        Returns the path for a given character.
      • getMaxAscent

        public double getMaxAscent()
        Returns the max distance above the baseline that this font goes.
      • getMaxDescent

        public double getMaxDescent()
        Returns the max distance below the baseline that this font goes.
      • getLeading

        public double getLeading()
        Returns the default distance between lines for this font.
      • getHeight

        public double getHeight()
        Returns the height of this font file.
      • getLineHeight

        public double getLineHeight()
        Returns the height of a line of text in this font.
      • getLineAdvance

        public double getLineAdvance()
        Returns the distance from the top of a line of text to the to top of a successive line of text.
      • getMaxAdvance

        public double getMaxAdvance()
        Returns the max advance of characters in this font.
      • getUnderlineOffset

        public double getUnderlineOffset()
        Returns the distance below the baseline that an underline should be drawn.
      • getUnderlineThickness

        public double getUnderlineThickness()
        Returns the default thickness that an underline should be drawn.
      • getStrikethroughOffset

        public double getStrikethroughOffset()
        Returns the distance above the baseline that a strikethrough should be drawn.
      • isBold

        public boolean isBold()
        Returns whether this font is considered bold.
      • isItalic

        public boolean isItalic()
        Returns whether this font is considered italic.
      • canDisplay

        public boolean canDisplay​(char aChar)
        Returns if this font can display the given char.
      • getBold

        @Nonnull
        public RMFontFile getBold()
        Returns the bold version of this font.
      • getItalic

        @Nonnull
        public RMFontFile getItalic()
        Returns the italic version of this font.
      • setStyle

        @Nonnull
        public RMFontFile setStyle​(int style)
        Returns this if the style is already set, else creates a new font with the style set
      • unsetStyle

        @Nonnull
        public RMFontFile unsetStyle​(int style)
        Returns this if the style is not already set, else creates a new font with the style unset
      • toggleStyle

        @Nonnull
        public RMFontFile toggleStyle​(int style)
        Creates a new font with the given style (Font.BOLD or Font.ITALIC) toggled.
      • toString

        public java.lang.String toString()
        Returns the font name of this font file.
        Overrides:
        toString in class java.lang.Object