Class PdfEncodings
java.lang.Object
com.aowagie.text.pdf.PdfEncodings
Supports fast encodings for winansi and PDFDocEncoding.
Supports conversions from CJK encodings to CID.
Supports custom encodings.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static classprivate static classprivate static classprivate static class -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final intprivate static final intprivate static final intprivate static final HashMapprivate static HashMapprivate static final IntHashtableprivate static final char[](package private) static final IntHashtableprivate static final char[] -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static voidaddExtraEncoding(String name, ExtraEncoding enc) Adds an extra encoding.private static voidbreakLong(long n, int size, byte[] seqs) private static StringconvertCmap(String name, byte[] seq, int start, int length) Converts abytearray encoded asnameto a CID string.static final byte[]convertToBytes(char char1, String encoding) Converts aStringto a byte array according to the font's encoding.static final byte[]convertToBytes(String text, String encoding) Converts aStringto a byte array according to the font's encoding.static final StringconvertToString(byte[] bytes, String encoding) Converts a byte array to aStringaccording to the some encoding.private static StringdecodeSequence(byte[] seq, int start, int length, char[][] planes) private static voidencodeSequence(int size, byte[] seqs, char cid, ArrayList planes) private static voidencodeStream(InputStream in, ArrayList planes) static booleanisPdfDocEncoding(String text) Checks istextonly has PdfDocEncoding characters.private static char[][]private static void
-
Field Details
-
CIDNONE
private static final int CIDNONE- See Also:
-
CIDRANGE
private static final int CIDRANGE- See Also:
-
CIDCHAR
private static final int CIDCHAR- See Also:
-
winansiByteToChar
private static final char[] winansiByteToChar -
pdfEncodingByteToChar
private static final char[] pdfEncodingByteToChar -
winansi
-
pdfEncoding
-
extraEncodings
-
cmaps
-
-
Constructor Details
-
PdfEncodings
PdfEncodings()
-
-
Method Details
-
convertToBytes
-
convertToBytes
Converts aStringto a byte array according to the font's encoding.- Parameters:
char1- thecharto be convertedencoding- the encoding- Returns:
- an array of
byterepresenting the conversion according to the font's encoding
-
convertToString
-
isPdfDocEncoding
Checks istextonly has PdfDocEncoding characters.- Parameters:
text- theStringto test- Returns:
trueif only PdfDocEncoding characters are present
-
convertCmap
Converts abytearray encoded asnameto 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/.- Parameters:
name- the CJK encoding nameseq- thebytearray to be decodedstart- the start offset in the datalength- the number of bytes to convert- Returns:
- the CID string
-
decodeSequence
-
readCmap
- Throws:
IOException
-
readCmap
- Throws:
IOException
-
encodeStream
- Throws:
IOException
-
breakLong
private static void breakLong(long n, int size, byte[] seqs) -
encodeSequence
-
addExtraEncoding
Adds an extra encoding.- Parameters:
name- the name of the encoding. The encoding recognition is case insensitiveenc- the conversion class
-