Package snap.swing

Class AWTFontFile

java.lang.Object
snap.gfx.FontFile
snap.swing.AWTFontFile

public class AWTFontFile extends FontFile
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 Details

    • AWTFontFile

      public AWTFontFile(String aName)
      Creates a font file for a given font name.
  • Method Details

    • getName

      public String getName()
      Returns the name of this font.
      Specified by:
      getName in class FontFile
    • getNameEnglish

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

      public String getFamily()
      Returns the family name of this font.
      Specified by:
      getFamily in class FontFile
    • getFamilyEnglish

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

      public String getPSName()
      Returns the PostScript name of this font.
      Overrides:
      getPSName in class FontFile
    • charAdvanceImpl

      protected double charAdvanceImpl(char aChar)
      Returns the char advance for the given char.
      Specified by:
      charAdvanceImpl in class FontFile
    • getGlyphBounds

      public Rect getGlyphBounds(String aString)
      Returns the bounds rect for glyphs in given string.
      Specified by:
      getGlyphBounds in class FontFile
    • getCharPathImpl

      protected Shape getCharPathImpl(char c)
      Returns the path for a given char at 1000pt.
      Specified by:
      getCharPathImpl in class FontFile
    • getOutline

      public Shape getOutline(CharSequence aStr, double aSize, double aX, double aY, double aCharSpacing)
      Returns the path for given string in given point size with character spacing.
      Overrides:
      getOutline in class FontFile
    • getAscent

      public double getAscent()
      Returns the max distance above the baseline that this font goes.
      Specified by:
      getAscent in class FontFile
    • getDescent

      public double getDescent()
      Returns the max distance below the baseline that this font goes.
      Specified by:
      getDescent in class FontFile
    • getLeading

      public double getLeading()
      Returns the default distance between lines for this font.
      Specified by:
      getLeading in class FontFile
    • getMaxAdvance

      public double getMaxAdvance()
      Returns the max advance of characters in this font.
      Overrides:
      getMaxAdvance in class FontFile
    • getUnderlineThickness

      public double getUnderlineThickness()
      Returns the default thickness that an underline should be drawn.
      Overrides:
      getUnderlineThickness in class FontFile
    • canDisplayImpl

      protected boolean canDisplayImpl(char aChar)
      Returns if this font can display the given char.
      Overrides:
      canDisplayImpl in class FontFile
    • getNative

      public Font getNative()
      Returns the awt font.
      Specified by:
      getNative in class FontFile
    • getNativeName

      public String getNativeName()
      Returns the awt font.
      Overrides:
      getNativeName in class FontFile
    • getNative

      public Font getNative(double aSize)
      Returns the awt font.
      Specified by:
      getNative in class FontFile
    • toString

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