Package com.teamten.font
Class SizedFont
java.lang.Object
com.teamten.font.SizedFont
The combination of a font and a size. Provides some
Font-like methods that omit the font size,
since it's already part of this object's state.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidDraw the text.booleangetCharacterMetrics(int ch) Return the size of a code point in the specified font size.getFont()The font.longgetKerning(int leftChar, int rightChar) Get the kerning between the two code points.doublegetSize()The size in points.longThe width of a space in scaled points.getStringMetrics(String text) Get the size of the text in the specified font size.inthashCode()toString()transformLigatures(String text) Replaces all ligatures (supported by this font) in the string.Create a new object, replacing the font.withScaledSize(double scale) Create a new object, scaling the size.
-
Constructor Details
-
SizedFont
-
-
Method Details
-
getFont
The font. -
getSize
public double getSize()The size in points. -
withFont
Create a new object, replacing the font. -
withScaledSize
Create a new object, scaling the size. -
getKerning
public long getKerning(int leftChar, int rightChar) Get the kerning between the two code points. The result is in scaled points. -
transformLigatures
Replaces all ligatures (supported by this font) in the string. -
getSpaceWidth
public long getSpaceWidth()The width of a space in scaled points. -
getCharacterMetrics
Return the size of a code point in the specified font size. -
draw
public void draw(String text, long x, long y, org.apache.pdfbox.pdmodel.PDPageContentStream contents) throws IOException Draw the text.- Parameters:
text- the text to draw.x- the left-hand edge of the text in scaled points.y- the baseline of the text in scaled points.contents- the stream to write to.- Throws:
IOException
-
getStringMetrics
Get the size of the text in the specified font size. Does not include kerning. -
toString
-
equals
-
hashCode
public int hashCode()
-