class CJKFont extends BaseFont
BaseFont.StreamFont| Modifier and Type | Field and Description |
|---|---|
(package private) static java.util.Hashtable |
allCMaps |
(package private) static java.util.Hashtable |
allFonts |
private static int |
BRACKET |
private boolean |
cidDirect |
(package private) static java.lang.String |
CJK_ENCODING
The encoding used in the PDF document for CJK fonts
|
(package private) static java.util.Properties |
cjkEncodings |
(package private) static java.util.Properties |
cjkFonts |
private java.lang.String |
CMap
The CMap name associated with this font
|
private static int |
FIRST |
private java.util.HashMap |
fontDesc |
private java.lang.String |
fontName
The font name
|
private IntHashtable |
hMetrics |
private static boolean |
propertiesLoaded |
private static int |
SERIAL |
private java.lang.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(java.lang.String fontName,
java.lang.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 java.lang.String |
convertToHCIDMetrics(int[] keys,
IntHashtable h) |
(package private) static java.lang.String |
convertToVCIDMetrics(int[] keys,
IntHashtable v,
IntHashtable h) |
(package private) static IntHashtable |
createMetric(java.lang.String s) |
java.lang.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(java.lang.String name) |
java.lang.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. |
java.lang.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.
|
java.lang.String |
getPostscriptFontName()
Gets the postscript font name.
|
protected int[] |
getRawCharBBox(int c,
java.lang.String name) |
(package private) int |
getRawWidth(int c,
java.lang.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(java.lang.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(java.lang.String fontName,
java.lang.String enc)
Checks if its a valid CJK font.
|
private static void |
loadProperties() |
(package private) static char[] |
readCMap(java.lang.String name) |
(package private) static java.util.HashMap |
readFontProperties(java.lang.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(java.lang.String name)
Sets the font name that will appear in the pdf font dictionary.
|
(package private) void |
writeFont(PdfWriter writer,
PdfIndirectReference ref,
java.lang.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 java.lang.String CJK_ENCODING
private static final int FIRST
private static final int BRACKET
private static final int SERIAL
private static final int V1Y
static java.util.Properties cjkFonts
static java.util.Properties cjkEncodings
static java.util.Hashtable allCMaps
static java.util.Hashtable allFonts
private static boolean propertiesLoaded
private java.lang.String fontName
private java.lang.String style
private java.lang.String CMap
private boolean cidDirect
private char[] translationMap
private IntHashtable vMetrics
private IntHashtable hMetrics
private java.util.HashMap fontDesc
private boolean vertical
CJKFont(java.lang.String fontName,
java.lang.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(java.lang.String fontName,
java.lang.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(java.lang.String text)
BaseFontString in normalized 1000 units.int getRawWidth(int c,
java.lang.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, java.lang.Object[] params) throws DocumentException, java.io.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 objectjava.io.IOException - on errorpublic PdfStream getFullFontStream()
getFullFontStream in class BaseFontprivate float getDescNumber(java.lang.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 java.lang.String getPostscriptFontName()
BaseFontgetPostscriptFontName in class BaseFontpublic java.lang.String[][] getFullFontName()
getFullFontName in class BaseFontpublic java.lang.String[][] getAllNameEntries()
getAllNameEntries in class BaseFontpublic java.lang.String[][] getFamilyFontName()
getFamilyFontName in class BaseFontstatic char[] readCMap(java.lang.String name)
static IntHashtable createMetric(java.lang.String s)
static java.lang.String convertToHCIDMetrics(int[] keys,
IntHashtable h)
static java.lang.String convertToVCIDMetrics(int[] keys,
IntHashtable v,
IntHashtable h)
static java.util.HashMap readFontProperties(java.lang.String name)
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(java.lang.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,
java.lang.String name)
getRawCharBBox in class BaseFont