org.icepdf.core.util
Class FontUtil

java.lang.Object
  extended by org.icepdf.core.util.FontUtil

public class FontUtil
extends java.lang.Object

Font utility contains a bunch of commonly used font utility methods.

Since:
3.1

Constructor Summary
FontUtil()
           
 
Method Summary
static int guessAWTFontStyle(java.lang.String name)
          Utility method which maps know style strings to an AWT font style constants.
static java.lang.String guessFamily(java.lang.String name)
          Utility method for guessing a font family name from its base name.
static java.lang.String normalizeString(java.lang.String name)
          Utility method for normailing strings, to lowercase and remove any spaces.
static java.lang.String removeBaseFontSubset(java.lang.String name)
          For a font subset, the PostScript name of the font—the value of the font’s BaseFont entry and the font descriptor’s FontName entry shall begin with a tag followed by a plus sign (+).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FontUtil

public FontUtil()
Method Detail

guessAWTFontStyle

public static int guessAWTFontStyle(java.lang.String name)
Utility method which maps know style strings to an AWT font style constants. The style attribute read as follows from the java.awt.font constructor:

Parameters:
name - base name of font.
Returns:
integer representing dffs

guessFamily

public static java.lang.String guessFamily(java.lang.String name)
Utility method for guessing a font family name from its base name. Font names are usually made up of a familyName followed by a style name. For example:

Parameters:
name - base name of font.
Returns:
guess of the base fonts name.

removeBaseFontSubset

public static java.lang.String removeBaseFontSubset(java.lang.String name)
For a font subset, the PostScript name of the font—the value of the font’s BaseFont entry and the font descriptor’s FontName entry shall begin with a tag followed by a plus sign (+). The tag shall consist of exactly six uppercase letters; the choice of letters is arbitrary, but different subsets in the same PDF file shall have different tags

This method will strip the font subset from the font name and return the font name.

Parameters:
name - font name to strip of subset name.
Returns:
bare font name.

normalizeString

public static java.lang.String normalizeString(java.lang.String name)
Utility method for normailing strings, to lowercase and remove any spaces.

Parameters:
name - base name of font
Returns:
normalized copy of string.