Package snap.gfx
Class FontFile
java.lang.Object
snap.gfx.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 Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
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.getBold()
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
getCharPathImpl
(char c) 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
getFontFile
(String aName) Returns a font file for a given font name.abstract Rect
getGlyphBounds
(String aString) 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
getName()
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
isBold()
Returns whether this font is considered bold.boolean
isItalic()
Returns whether this font is considered italic.toString()
Returns the font name of this font file.
-
Constructor Details
-
FontFile
public FontFile()Constructor.
-
-
Method Details
-
getFontFile
Returns a font file for a given font name. -
getName
Returns the name of this font. -
getNameEnglish
Returns the name of this font in English. -
getFamily
Returns the family name of this font. -
getFamilyEnglish
Returns the family name of this font in English. -
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
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
Returns the path for a given character. -
getCharPathImpl
Returns the path for a given char (does the real work, but doesn't cache). -
getOutline
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
Returns the bold version of this font. -
getItalic
Returns the italic version of this font. -
getNative
Returns the system native version of this font file. -
getNativeName
Returns the system native name of this font file. -
getNative
Returns the system native version of font for given size. -
toString
Returns the font name of this font file. -
getArialFontFile
Returns Arial FontFile.
-