|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.lowagie.text.pdf.PdfEncodings
public class PdfEncodings
Supports fast encodings for winansi and PDFDocEncoding. Supports conversions from CJK encodings to CID. Supports custom encodings.
Field Summary | |
---|---|
protected static int |
CIDCHAR
|
protected static int |
CIDNONE
|
protected static int |
CIDRANGE
|
static byte[][] |
CRLF_CID_NEWLINE
Assumes that '\\n' and '\\r\\n' are the newline sequences. |
Constructor Summary | |
---|---|
PdfEncodings()
|
Method Summary | |
---|---|
static void |
addExtraEncoding(java.lang.String name,
ExtraEncoding enc)
Adds an extra encoding. |
static void |
clearCmap(java.lang.String name)
Clears the CJK cmaps from the cache. |
static java.lang.String |
convertCmap(java.lang.String name,
byte[] seq)
Converts a byte array encoded as name
to a CID string. |
static java.lang.String |
convertCmap(java.lang.String name,
byte[] seq,
int start,
int length)
Converts a byte array encoded as name
to a CID string. |
static byte[] |
convertToBytes(char char1,
java.lang.String encoding)
Converts a String to a byte array according
to the font's encoding. |
static byte[] |
convertToBytes(java.lang.String text,
java.lang.String encoding)
Converts a String to a byte array according
to the font's encoding. |
static java.lang.String |
convertToString(byte[] bytes,
java.lang.String encoding)
Converts a byte array to a String according
to the some encoding. |
static boolean |
isPdfDocEncoding(java.lang.String text)
Checks is text only has PdfDocEncoding characters. |
static void |
loadCmap(java.lang.String name,
byte[][] newline)
Loads a CJK cmap to the cache with the option of associating sequences to the newline. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static final int CIDNONE
protected static final int CIDRANGE
protected static final int CIDCHAR
public static final byte[][] CRLF_CID_NEWLINE
Constructor Detail |
---|
public PdfEncodings()
Method Detail |
---|
public static final byte[] convertToBytes(java.lang.String text, java.lang.String encoding)
String
to a byte array according
to the font's encoding.
encoding
- the encodingtext
- the String
to be converted
byte
representing the conversion according to the font's encodingpublic static final byte[] convertToBytes(char char1, java.lang.String encoding)
String
to a byte array according
to the font's encoding.
encoding
- the encodingchar1
- the char
to be converted
byte
representing the conversion according to the font's encodingpublic static final java.lang.String convertToString(byte[] bytes, java.lang.String encoding)
String
according
to the some encoding.
bytes
- the bytes to convertencoding
- the encoding
String
public static boolean isPdfDocEncoding(java.lang.String text)
text
only has PdfDocEncoding characters.
text
- the String
to test
true
if only PdfDocEncoding characters are presentpublic static void clearCmap(java.lang.String name)
name
is the
empty string then all the cache is cleared. Calling this method
has no consequences other than the need to reload the cmap
if needed.
name
- the name of the cmap to clear or all the cmaps if the empty stringpublic static void loadCmap(java.lang.String name, byte[][] newline)
name
- the CJK cmap namenewline
- the sequences to be replaced by a newline in the resulting CID. See CRLF_CID_NEWLINE
public static java.lang.String convertCmap(java.lang.String name, byte[] seq)
byte
array encoded as name
to a CID string. This is needed to reach some CJK characters
that don't exist in 16 bit Unicode.
The font to use this result must use the encoding "Identity-H"
or "Identity-V".
See ftp://ftp.oreilly.com/pub/examples/nutshell/cjkv/adobe/.
name
- the CJK encoding nameseq
- the byte
array to be decoded
public static java.lang.String convertCmap(java.lang.String name, byte[] seq, int start, int length)
byte
array encoded as name
to a CID string. This is needed to reach some CJK characters
that don't exist in 16 bit Unicode.
The font to use this result must use the encoding "Identity-H"
or "Identity-V".
See ftp://ftp.oreilly.com/pub/examples/nutshell/cjkv/adobe/.
name
- the CJK encoding namestart
- the start offset in the datalength
- the number of bytes to convertseq
- the byte
array to be decoded
public static void addExtraEncoding(java.lang.String name, ExtraEncoding enc)
name
- the name of the encoding. The encoding recognition is case insensitiveenc
- the conversion class
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |