class CJKFont extends BaseFont
BaseFont.StreamFont| Modifier and Type | Field and Description |
|---|---|
(package private) static Hashtable |
allCMaps |
(package private) static Hashtable |
allFonts |
private static int |
BRACKET |
private boolean |
cidDirect |
(package private) static String |
CJK_ENCODING
The encoding used in the PDF document for CJK fonts
|
(package private) static Properties |
cjkEncodings |
(package private) static Properties |
cjkFonts |
private String |
CMap
The CMap name associated with this font
|
private static int |
FIRST |
private HashMap |
fontDesc |
private String |
fontName
The font name
|
private IntHashtable |
hMetrics |
private static boolean |
propertiesLoaded |
private static int |
SERIAL |
private String |
style
The style modifier
|
private char[] |
translationMap |
private static int |
V1Y |
private boolean |
vertical |
private IntHashtable |
vMetrics |
ASCENT, AWT_ASCENT, AWT_DESCENT, AWT_LEADING, AWT_MAXADVANCE, BBOXLLX, BBOXLLY, BBOXURX, BBOXURY, BuiltinFonts14, CACHED, CAPHEIGHT, CHAR_RANGE_ARABIC, CHAR_RANGE_CYRILLIC, CHAR_RANGE_HEBREW, CHAR_RANGE_LATIN, charBBoxes, CID_NEWLINE, compressionLevel, COURIER, COURIER_BOLD, COURIER_BOLDOBLIQUE, COURIER_OBLIQUE, CP1250, CP1252, CP1257, DESCENT, differences, directTextToByte, embedded, EMBEDDED, encoding, fastWinansi, FONT_TYPE_CJK, FONT_TYPE_DOCUMENT, FONT_TYPE_T1, FONT_TYPE_T3, FONT_TYPE_TT, FONT_TYPE_TTUNI, fontCache, fontSpecific, fontType, forceWidthsOutput, HELVETICA, HELVETICA_BOLD, HELVETICA_BOLDOBLIQUE, HELVETICA_OBLIQUE, IDENTITY_H, IDENTITY_V, ITALICANGLE, MACROMAN, NOT_CACHED, NOT_EMBEDDED, notdef, RESOURCE_PATH, specialMap, STRIKETHROUGH_POSITION, STRIKETHROUGH_THICKNESS, SUBSCRIPT_OFFSET, SUBSCRIPT_SIZE, subset, subsetRanges, SUPERSCRIPT_OFFSET, SUPERSCRIPT_SIZE, SYMBOL, TIMES_BOLD, TIMES_BOLDITALIC, TIMES_ITALIC, TIMES_ROMAN, UNDERLINE_POSITION, UNDERLINE_THICKNESS, unicodeDifferences, widths, WINANSI, ZAPFDINGBATS| Constructor and Description |
|---|
CJKFont(String fontName,
String enc,
boolean emb)
Creates a CJK font.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
charExists(int c)
Checks if a character exists in this font.
|
(package private) static String |
convertToHCIDMetrics(int[] keys,
IntHashtable h) |
(package private) static String |
convertToVCIDMetrics(int[] keys,
IntHashtable v,
IntHashtable h) |
(package private) static IntHashtable |
createMetric(String s) |
String[][] |
getAllNameEntries()
Gets all the entries of the names-table.
|
private float |
getBBox(int idx) |
int[] |
getCharBBox(int c)
Gets the smallest box enclosing the character contours.
|
int |
getCidCode(int c)
Gets the CID code given an Unicode.
|
private PdfDictionary |
getCIDFont(PdfIndirectReference fontDescriptor,
IntHashtable cjkTag) |
private float |
getDescNumber(String name) |
String[][] |
getFamilyFontName()
Gets the family name of the font.
|
private PdfDictionary |
getFontBaseType(PdfIndirectReference CIDFont) |
private PdfDictionary |
getFontDescriptor() |
float |
getFontDescriptor(int key,
float fontSize)
Gets the font parameter identified by
key. |
String[][] |
getFullFontName()
Gets the full name of the font.
|
PdfStream |
getFullFontStream()
You can't get the FontStream of a CJK font (CJK fonts are never embedded),
so this method always returns null.
|
int |
getKerning(int char1,
int char2)
Gets the kerning between two Unicode chars.
|
String |
getPostscriptFontName()
Gets the postscript font name.
|
protected int[] |
getRawCharBBox(int c,
String name) |
(package private) int |
getRawWidth(int c,
String name)
Gets the width from the font according to the Unicode char
c
or the name. |
int |
getUnicodeEquivalent(int c)
Gets the Unicode equivalent to a CID.
|
int |
getWidth(int char1)
Gets the width of a
char in normalized 1000 units. |
int |
getWidth(String text)
Gets the width of a
String in normalized 1000 units. |
boolean |
hasKernPairs()
Checks if the font has any kerning pairs.
|
static boolean |
isCJKFont(String fontName,
String enc)
Checks if its a valid CJK font.
|
private static void |
loadProperties() |
(package private) static char[] |
readCMap(String name) |
(package private) static HashMap |
readFontProperties(String name) |
boolean |
setCharAdvance(int c,
int advance)
Sets the character advance.
|
boolean |
setKerning(int char1,
int char2,
int kern)
Sets the kerning between two Unicode chars.
|
void |
setPostscriptFontName(String name)
Sets the font name that will appear in the pdf font dictionary.
|
(package private) void |
writeFont(PdfWriter writer,
PdfIndirectReference ref,
Object[] params)
Outputs to the writer the font dictionaries and streams.
|
addSubsetRange, convertToBytes, convertToBytes, correctArabicAdvance, createEncoding, createFont, createFont, createFont, createFont, createFont, createFont, createFont, createSubsetPrefix, enumerateTTCNames, enumerateTTCNames, getAllFontNames, getAllNameEntries, getAscent, getAscentPoint, getBaseName, getCodePagesSupported, getCompressionLevel, getDescent, getDescentPoint, getDifferences, getDocumentFonts, getDocumentFonts, getEncoding, getFontType, getFullFontName, getResourceStream, getResourceStream, getUnicodeDifferences, getUnicodeDifferences, getWidthPoint, getWidthPoint, getWidthPointKerned, getWidths, isDirectTextToByte, isEmbedded, isFontSpecific, isForceWidthsOutput, isSubset, normalizeEncoding, setCompressionLevel, setDirectTextToByte, setForceWidthsOutput, setSubsetstatic final String CJK_ENCODING
private static final int FIRST
private static final int BRACKET
private static final int SERIAL
private static final int V1Y
static Properties cjkFonts
static Properties cjkEncodings
static Hashtable allCMaps
static Hashtable allFonts
private static boolean propertiesLoaded
private String fontName
private String style
private String CMap
private boolean cidDirect
private char[] translationMap
private IntHashtable vMetrics
private IntHashtable hMetrics
private HashMap fontDesc
private boolean vertical
CJKFont(String fontName, String enc, boolean emb) throws DocumentException
fontName - the name of the fontenc - the encoding of the fontemb - always false. CJK font and not embeddedDocumentException - on errorprivate static void loadProperties()
public static boolean isCJKFont(String fontName, String enc)
fontName - the font nameenc - the encodingtrue if it is CJK fontpublic int getWidth(int char1)
char in normalized 1000 units.public int getWidth(String text)
BaseFontString in normalized 1000 units.int getRawWidth(int c,
String name)
BaseFontc
or the name. If the name is null it's a symbolic font.getRawWidth in class BaseFontc - the unicode charname - the glyph namepublic int getKerning(int char1,
int char2)
BaseFontgetKerning in class BaseFontchar1 - the first charchar2 - the second charprivate PdfDictionary getFontDescriptor()
private PdfDictionary getCIDFont(PdfIndirectReference fontDescriptor, IntHashtable cjkTag)
private PdfDictionary getFontBaseType(PdfIndirectReference CIDFont)
void writeFont(PdfWriter writer, PdfIndirectReference ref, Object[] params) throws DocumentException, IOException
BaseFontwriteFont in class BaseFontwriter - the writer for this documentref - the font indirect referenceparams - several parameters that depend on the font typeDocumentException - error in generating the objectIOException - on errorpublic PdfStream getFullFontStream()
getFullFontStream in class BaseFontprivate float getDescNumber(String name)
private float getBBox(int idx)
public float getFontDescriptor(int key,
float fontSize)
key. Valid values
for key are ASCENT, CAPHEIGHT, DESCENT
and ITALICANGLE.getFontDescriptor in class BaseFontkey - the parameter to be extractedfontSize - the font size in pointspublic String getPostscriptFontName()
BaseFontgetPostscriptFontName in class BaseFontpublic String[][] getFullFontName()
getFullFontName in class BaseFontpublic String[][] getAllNameEntries()
getAllNameEntries in class BaseFontpublic String[][] getFamilyFontName()
getFamilyFontName in class BaseFontstatic char[] readCMap(String name)
static IntHashtable createMetric(String s)
static String convertToHCIDMetrics(int[] keys, IntHashtable h)
static String convertToVCIDMetrics(int[] keys, IntHashtable v, IntHashtable h)
public int getUnicodeEquivalent(int c)
BaseFontgetUnicodeEquivalent in class BaseFontc - the CID codepublic int getCidCode(int c)
BaseFontgetCidCode in class BaseFontc - the Unicodepublic boolean hasKernPairs()
hasKernPairs in class BaseFontfalsepublic boolean charExists(int c)
charExists in class BaseFontc - the character to checktrue if the character has a glyph,
false otherwisepublic boolean setCharAdvance(int c,
int advance)
setCharAdvance in class BaseFontc - the characteradvance - the character advance normalized to 1000 unitstrue if the advance was set,
false otherwise. Will always return falsepublic void setPostscriptFontName(String name)
setPostscriptFontName in class BaseFontname - the new font namepublic boolean setKerning(int char1,
int char2,
int kern)
BaseFontsetKerning in class BaseFontchar1 - the first charchar2 - the second charkern - the kerning to apply in normalized 1000 unitstrue if the kerning was applied, false otherwisepublic int[] getCharBBox(int c)
BaseFontnull if the font has not the information or the character has no
contours, as in the case of the space, for example. Characters with no contours may
also return [0,0,0,0].getCharBBox in class BaseFontc - the character to get the contour bounding box fromnullprotected int[] getRawCharBBox(int c,
String name)
getRawCharBBox in class BaseFont