Package loci.poi.hssf.usermodel
Class FontDetails
java.lang.Object
loci.poi.hssf.usermodel.FontDetails
Stores width and height details about a font.
- Author:
- Glen Stampoultzis (glens at apache.org)
-
Constructor Summary
ConstructorsConstructorDescriptionFontDetails(String fontName, int height) Construct the font details with the given name and height. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddChar(char c, int width) voidaddChars(char[] characters, int[] widths) protected static StringbuildFontCharactersProperty(String fontName) protected static StringbuildFontHeightProperty(String fontName) protected static StringbuildFontWidthsProperty(String fontName) static FontDetailscreate(String fontName, Properties fontMetricsProps) Create an instance ofFontDetailsby loading them from the provided property object.intgetCharWidth(char c) Retrieves the width of the specified character.intintgetStringWidth(String str) Gets the width of all characters in a string.
-
Constructor Details
-
FontDetails
Construct the font details with the given name and height.- Parameters:
fontName- The font name.height- The height of the font.
-
-
Method Details
-
getFontName
-
getHeight
public int getHeight() -
addChar
public void addChar(char c, int width) -
getCharWidth
public int getCharWidth(char c) Retrieves the width of the specified character. If the metrics for a particular character are not available it defaults to returning the width for the 'W' character. -
addChars
public void addChars(char[] characters, int[] widths) -
buildFontHeightProperty
-
buildFontWidthsProperty
-
buildFontCharactersProperty
-
create
Create an instance ofFontDetailsby loading them from the provided property object.- Parameters:
fontName- the font namefontMetricsProps- the property object holding the details of this particular font.- Returns:
- a new FontDetails instance.
-
getStringWidth
Gets the width of all characters in a string.- Parameters:
str- The string to measure.- Returns:
- The width of the string for a 10 point font.
-