Package snap.gfx

Class FontFile

java.lang.Object
snap.gfx.FontFile
Direct Known Subclasses:
AWTFontFile

public abstract class FontFile extends Object
This class represents all the information about a font that is independent of size. This allows Font to be lighter weight (essentially just a font file at a given size).
  • Constructor Summary

    Constructors
    Constructor
    Description
    Constructor.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    canDisplay(char aChar)
    Returns if this font can display the given char.
    protected boolean
    canDisplayImpl(char aChar)
    Returns if this font can display the given char.
    double
    charAdvance(char aChar)
    Returns the char advance for the given char.
    protected abstract double
    charAdvanceImpl(char aChar)
    Returns the char advance for the given char.
    protected static FontFile
    Returns Arial FontFile.
    abstract double
    Returns the max distance above the baseline that this font goes.
    Returns the bold version of this font.
    double
    getCharKern(char aChar1, char aChar2)
    Returns the kerning for the given pair of characters (no way to do this in Java!).
    getCharPath(char aChar)
    Returns the path for a given character.
    protected abstract Shape
    Returns the path for a given char (does the real work, but doesn't cache).
    abstract double
    Returns the max distance below the baseline that this font goes.
    abstract String
    Returns the family name of this font.
    Returns the family name of this font in English.
    static FontFile
    Returns a font file for a given font name.
    abstract Rect
    Returns the bounds rect for glyphs in given string.
    Returns the italic version of this font.
    abstract double
    Returns the default distance between lines for this font.
    double
    Returns the distance from the top of a line of text to the to top of a successive line of text.
    double
    Returns the height of a line of text in this font.
    double
    Returns the max advance of characters in this font.
    abstract String
    Returns the name of this font.
    Returns the name of this font in English.
    abstract Object
    Returns the system native version of this font file.
    abstract Object
    getNative(double aSize)
    Returns the system native version of font for given size.
    Returns the system native name of this font file.
    getOutline(CharSequence aStr, double aSize, double aX, double aY, double aCharSpacing)
    Returns the path for given string with character spacing.
    Returns the PostScript name of this font.
    double
    Returns the distance above the baseline that a strikethrough should be drawn.
    double
    Returns the distance below the baseline that an underline should be drawn.
    double
    Returns the default thickness that an underline should be drawn.
    boolean
    Returns whether this font is considered bold.
    boolean
    Returns whether this font is considered italic.
    Returns the font name of this font file.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • FontFile

      public FontFile()
      Constructor.
  • Method Details

    • getFontFile

      public static FontFile getFontFile(String aName)
      Returns a font file for a given font name.
    • getName

      public abstract String getName()
      Returns the name of this font.
    • getNameEnglish

      public String getNameEnglish()
      Returns the name of this font in English.
    • getFamily

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

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

      public String getPSName()
      Returns the PostScript name of this font.
    • charAdvance

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

      protected abstract double charAdvanceImpl(char aChar)
      Returns the char advance for the given char.
    • getGlyphBounds

      public abstract Rect getGlyphBounds(String aString)
      Returns the bounds rect for glyphs in given string.
    • getCharKern

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

      public Shape getCharPath(char aChar)
      Returns the path for a given character.
    • getCharPathImpl

      protected abstract Shape getCharPathImpl(char c)
      Returns the path for a given char (does the real work, but doesn't cache).
    • getOutline

      public Shape getOutline(CharSequence aStr, double aSize, double aX, double aY, double aCharSpacing)
      Returns the path for given string with character spacing.
    • getAscent

      public abstract double getAscent()
      Returns the max distance above the baseline that this font goes.
    • getDescent

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

      public abstract double getLeading()
      Returns the default distance between lines for this font.
    • 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.
    • canDisplayImpl

      protected boolean canDisplayImpl(char aChar)
      Returns if this font can display the given char.
    • getBold

      public FontFile getBold()
      Returns the bold version of this font.
    • getItalic

      public FontFile getItalic()
      Returns the italic version of this font.
    • getNative

      public abstract Object getNative()
      Returns the system native version of this font file.
    • getNativeName

      public String getNativeName()
      Returns the system native name of this font file.
    • getNative

      public abstract Object getNative(double aSize)
      Returns the system native version of font for given size.
    • toString

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

      protected static FontFile getArialFontFile()
      Returns Arial FontFile.