Package org.apache.fop.fonts
Class FontUtil
java.lang.Object
org.apache.fop.fonts.FontUtil
Font utilities.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final String[]
font constituent names which identify a font as being of "bold" weightprivate static final String[]
font constituent names which identify a font as being of "demi/semi" weightprivate static final String[]
font constituent names which identify a font as being of "extra bold" weightprivate static final String[]
font constituent names which identify a font as being of "italic" styleprivate static final String[]
font constituent names which identify a font as being of "light" weightprivate static final String[]
font constituent names which identify a font as being of "medium" weight -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic String
guessStyle
(String fontName) Guesses the font style of a font using its name.static int
guessWeight
(String fontName) Guesses the font weight of a font using its name.static int
parseCSS2FontWeight
(String text) Parses an CSS2 (SVG and XSL-FO) font weight (normal, bold, 100-900) to an integer.static String
stripWhiteSpace
(String str) Removes all white space from a string (used primarily for font names)
-
Field Details
-
ITALIC_WORDS
font constituent names which identify a font as being of "italic" style -
LIGHT_WORDS
font constituent names which identify a font as being of "light" weight -
MEDIUM_WORDS
font constituent names which identify a font as being of "medium" weight -
DEMI_WORDS
font constituent names which identify a font as being of "demi/semi" weight -
BOLD_WORDS
font constituent names which identify a font as being of "bold" weight -
EXTRA_BOLD_WORDS
font constituent names which identify a font as being of "extra bold" weight
-
-
Constructor Details
-
FontUtil
private FontUtil()
-
-
Method Details
-
parseCSS2FontWeight
Parses an CSS2 (SVG and XSL-FO) font weight (normal, bold, 100-900) to an integer. See http://www.w3.org/TR/REC-CSS2/fonts.html#propdef-font-weight TODO: Implement "lighter" and "bolder".- Parameters:
text
- the font weight to parse- Returns:
- an integer between 100 and 900 (100, 200, 300...)
-
stripWhiteSpace
Removes all white space from a string (used primarily for font names)- Parameters:
str
- the string- Returns:
- the processed result
-
guessStyle
Guesses the font style of a font using its name.- Parameters:
fontName
- the font name- Returns:
- "normal" or "italic"
-
guessWeight
Guesses the font weight of a font using its name.- Parameters:
fontName
- the font name- Returns:
- an integer between 100 and 900
-