Package com.itextpdf.io.font
Class FontCache
java.lang.Object
com.itextpdf.io.font.FontCache
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidClears the cache by removing fonts that were added viasaveFont(FontProgram, String).static CMapByteCidgetByte2CidCmap(String cmap) static CMapCidBytegetCid2Byte(String cmap) static CMapCidUnigetCid2UniCmap(String uniMap) Parses CMap with a given name producing it in a form of cid to unicode mapping.static StringgetCompatibleCidFont(String cmap) Finds a CJK font family which is compatible to the given CMap.getCompatibleCmaps(String fontName) Finds all CMap names that belong to the same registry to which a given font belongs.static FontProgramstatic CMapUniCidgetUni2CidCmap(String uniMap) protected static booleanisPredefinedCidFont(String fontName) Checks if the font with the given name and encoding is one of the predefined CID fonts.static FontProgramsaveFont(FontProgram font, String fontName)
-
Constructor Details
-
FontCache
public FontCache()
-
-
Method Details
-
isPredefinedCidFont
Checks if the font with the given name and encoding is one of the predefined CID fonts.- Parameters:
-
fontName- the font name. - Returns:
-
trueif it is CJKFont.
-
getCompatibleCidFont
Finds a CJK font family which is compatible to the given CMap.- Parameters:
-
cmap- a name of the CMap for which compatible font is searched. - Returns:
- a CJK font name if there's known compatible font for the given cmap name, or null otherwise.
-
getCompatibleCmaps
Finds all CMap names that belong to the same registry to which a given font belongs.- Parameters:
-
fontName- a name of the font for which CMap's are searched. - Returns:
- a set of CMap names corresponding to the given font.
-
getAllPredefinedCidFonts
-
getRegistryNames
-
getCid2UniCmap
Parses CMap with a given name producing it in a form of cid to unicode mapping.- Parameters:
-
uniMap- a CMap name. It is expected that CMap identified by this name defines unicode to cid mapping. - Returns:
- an object for convenient mapping from cid to unicode. If no CMap was found for provided name an exception is thrown.
-
getUni2CidCmap
-
getByte2CidCmap
-
getCid2Byte
-
clearSavedFonts
public static void clearSavedFonts()Clears the cache by removing fonts that were added viasaveFont(FontProgram, String).Be aware that in multithreading environment this method call will affect the result of
getFont(String). This in its turn affects creation of fonts via factories whencachedargument is set to true (which is by default). -
getFont
-
saveFont
-