|
![]() |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.lowagie.text.pdf.BaseFont
com.lowagie.text.pdf.CJKFont
class CJKFont
Creates a CJK font compatible with the fonts in the Adobe Asian font Pack.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class com.lowagie.text.pdf.BaseFont |
---|
BaseFont.StreamFont |
Field Summary | |
---|---|
(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
|
Constructor Summary | |
---|---|
CJKFont(String fontName,
String enc,
boolean emb)
Creates a CJK font. |
Method Summary | |
---|---|
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. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
static 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
Constructor Detail |
---|
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 embedded
DocumentException
- on errorMethod Detail |
---|
private static void loadProperties()
public static boolean isCJKFont(String fontName, String enc)
fontName
- the font nameenc
- the encoding
true
if it is CJK fontpublic int getWidth(int char1)
char
in normalized 1000 units.
getWidth
in class BaseFont
char1
- the unicode char
to get the width of
public int getWidth(String text)
BaseFont
String
in normalized 1000 units.
getWidth
in class BaseFont
text
- the String
to get the width of
int getRawWidth(int c, String name)
BaseFont
c
or the name
. If the name
is null it's a symbolic font.
getRawWidth
in class BaseFont
c
- the unicode charname
- the glyph name
public int getKerning(int char1, int char2)
BaseFont
getKerning
in class BaseFont
char1
- the first charchar2
- the second char
private 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
BaseFont
writeFont
in class BaseFont
writer
- the writer for this documentref
- the font indirect referenceparams
- several parameters that depend on the font type
DocumentException
- error in generating the object
IOException
- on errorpublic PdfStream getFullFontStream()
getFullFontStream
in class BaseFont
private 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 BaseFont
key
- the parameter to be extractedfontSize
- the font size in points
public String getPostscriptFontName()
BaseFont
getPostscriptFontName
in class BaseFont
public String[][] getFullFontName()
getFullFontName
in class BaseFont
public String[][] getAllNameEntries()
getAllNameEntries
in class BaseFont
public String[][] getFamilyFontName()
getFamilyFontName
in class BaseFont
static 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)
static HashMap readFontProperties(String name)
public int getUnicodeEquivalent(int c)
BaseFont
getUnicodeEquivalent
in class BaseFont
c
- the CID code
public int getCidCode(int c)
BaseFont
getCidCode
in class BaseFont
c
- the Unicode
public boolean hasKernPairs()
hasKernPairs
in class BaseFont
false
public boolean charExists(int c)
charExists
in class BaseFont
c
- the character to check
true
if the character has a glyph,
false
otherwisepublic boolean setCharAdvance(int c, int advance)
setCharAdvance
in class BaseFont
c
- the characteradvance
- the character advance normalized to 1000 units
true
if the advance was set,
false
otherwise. Will always return false
public void setPostscriptFontName(String name)
setPostscriptFontName
in class BaseFont
name
- the new font namepublic boolean setKerning(int char1, int char2, int kern)
BaseFont
setKerning
in class BaseFont
char1
- the first charchar2
- the second charkern
- the kerning to apply in normalized 1000 units
true
if the kerning was applied, false
otherwisepublic int[] getCharBBox(int c)
BaseFont
null
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 BaseFont
c
- the character to get the contour bounding box from
null
protected int[] getRawCharBBox(int c, String name)
getRawCharBBox
in class BaseFont
|
Hosted by Hostbasket | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |