public class FontSettings extends Object
Modifier and Type | Field and Description |
---|---|
static int |
CHINESE_SANSSERIF |
static int |
CHINESE_SERIF |
static int |
CHINESE_SIMPLIFIED |
static int |
JAPANESE_SANSSERIF |
static int |
JAPANESE_SERIF |
static int |
KOREAN_SANSSERIF |
static int |
KOREAN_SERIF |
Constructor and Description |
---|
FontSettings() |
Modifier and Type | Method and Description |
---|---|
static void |
addSubstituteFont(String fontName,
Font subFont)
Registers a substitute font to use when a font in a PDF file is not embedded
in the file and the font is not registered with the operating system.
|
static String |
getCJKSystemFontName(int cjkFontType)
Get the name of the system font that will be used to render non-embedded instances of the CJK font type indicated by cjkFontType
|
static List<LocalFont> |
getLocalFonts()
Returns a list of fonts found in the local environment that can be used for
adding text content to a PDF.
|
static List<String> |
getSubFontFamilyList()
Get ordered list of substitute font families.
|
static Font |
getSubstituteFont(String fontName)
Returns a substitute font, if one has been registered, for the given font name.
|
static List<String> |
getUserFontDirectories()
Returns list of user font directories
|
static boolean |
isUseSubstituteFont()
Returns the value of the flag that specifies whether or not the rendering
engine should use a substitute font when a font in the PDF cannot be
created.
|
static void |
setCJKSystemFontName(int cjkFontType,
String systemFontName)
Set the local system font systemFontName to use for a particular CJK font type cjkFontType
|
static void |
setSubFontFamilyList(List<String> subFontFamilies)
Set ordered list of substitute font families.
|
static void |
setUserFontDirectories(List<String> userFontDirs)
Set user font directories used in font embedding.
|
static void |
setUseSubstituteFont(boolean useSubstitute)
Tells the rendering engine to use a substitute font when a font in the
PDF cannot be created.
|
public static final int JAPANESE_SERIF
public static final int JAPANESE_SANSSERIF
public static final int CHINESE_SERIF
public static final int CHINESE_SANSSERIF
public static final int CHINESE_SIMPLIFIED
public static final int KOREAN_SERIF
public static final int KOREAN_SANSSERIF
public static void setUseSubstituteFont(boolean useSubstitute)
useSubstitute
- Flag indicating whether substitute fonts should be used.public static boolean isUseSubstituteFont()
setUseSubstituteFont(boolean)
public static void addSubstituteFont(String fontName, Font subFont)
fontName
- The name of the font in the PDF file.subFont
- The substitute font to use when the font is not present in the PDF file
or in the OS.public static Font getSubstituteFont(String fontName)
fontName
- The name of the fontpublic static void setCJKSystemFontName(int cjkFontType, String systemFontName)
cjkFontType
- the integer code for a particular CJK font type, e.g. Chinese SerifsystemFontName
- should either match one of the font names returned by GraphicsEnvironment.getLocalGraphicsEnvironment().getAvailableFontFamilyNames()
or else it should be null. If systemFontName matches a system font family name, then that font will be used to render non-embedded instances of cjkFontType.
If systemFontName is null, then that resets the font for cjkFontType to the default value, which may be none on some systems.
If systemFontName is any other value, then the call has no affect.public static String getCJKSystemFontName(int cjkFontType)
cjkFontType
- the integer code for a particular CJK font type, e.g. Chinese Serifpublic static void setUserFontDirectories(List<String> userFontDirs)
userFontDirs
- - List of font directory path stringspublic static List<String> getUserFontDirectories()
public static List<LocalFont> getLocalFonts() throws PDFException
PDFException
public static void setSubFontFamilyList(List<String> subFontFamilies)
subFontFamilies
- - list of substitute font family names