public class FontEncoding extends Object implements Serializable
Modifier and Type | Field and Description |
---|---|
protected String |
baseEncoding
Base font encoding.
|
protected int[] |
codeToUnicode |
protected String[] |
differences
Encoding names.
|
static String |
FONT_SPECIFIC |
protected boolean |
fontSpecific
true if the font must use its built in encoding.
|
static String |
NOTDEF
A not defined character in a custom PDF encoding.
|
protected IntHashtable |
unicodeDifferences
Encodings unicode differences
|
protected IntHashtable |
unicodeToCode
Mapping map from unicode to simple code according to the encoding.
|
Modifier | Constructor and Description |
---|---|
protected |
FontEncoding() |
Modifier and Type | Method and Description |
---|---|
boolean |
addSymbol(int code, int unicode) |
boolean |
canDecode(int code)
Check whether a byte code can be converted to unicode symbol according to the encoding.
|
boolean |
canEncode(int unicode)
Check whether a unicode symbol or font specific code can be converted to byte according to the encoding.
|
int |
convertToByte(int unicode)
Converts a unicode symbol or font specific code to byte according to the encoding.
|
byte[] |
convertToBytes(String text)
Converts a String to a byte array according to the encoding.
|
static FontEncoding |
createEmptyFontEncoding() |
static FontEncoding |
createFontEncoding(String baseEncoding) |
static FontEncoding |
createFontSpecificEncoding()
This encoding will base on font encoding (FontSpecific encoding in Type 1 terminology)
|
protected void |
fillCustomEncoding() |
protected void |
fillNamedEncoding() |
protected void |
fillStandardEncoding() |
String |
getBaseEncoding() |
String |
getDifference(int index) |
int |
getUnicode(int index)
Gets unicode value for corresponding font's char code.
|
int |
getUnicodeDifference(int index) |
boolean |
hasDifferences() |
boolean |
isFontSpecific() |
protected static String |
normalizeEncoding(String enc)
Normalize the encoding names.
|
public static final String FONT_SPECIFIC
public static final String NOTDEF
protected String baseEncoding
protected boolean fontSpecific
true
if the font must use its built in encoding. In that case the encoding
is only used to map a char to the position inside the font, not to the expected char name.
protected IntHashtable unicodeToCode
protected int[] codeToUnicode
protected String[] differences
protected IntHashtable unicodeDifferences
public static FontEncoding createFontEncoding(String baseEncoding)
public static FontEncoding createEmptyFontEncoding()
public static FontEncoding createFontSpecificEncoding()
public String getBaseEncoding()
public boolean isFontSpecific()
public boolean addSymbol(int code, int unicode)
public int getUnicode(int index)
index
- font's char code
public int getUnicodeDifference(int index)
public boolean hasDifferences()
public String getDifference(int index)
public byte[] convertToBytes(String text)
String
to a byte
array according to the encoding. String could contain a unicode symbols or font specific codes.
text
- the String
to be converted.
byte
representing the conversion according to the encoding
public int convertToByte(int unicode)
byte
according to the encoding.
unicode
- a unicode symbol or FontSpecif code to be converted.
byte
representing the conversion according to the encoding
public boolean canEncode(int unicode)
byte
according to the encoding.
unicode
- a unicode symbol or font specific code to be checked.
true
if ch
could be encoded.
public boolean canDecode(int code)
byte
code can be converted to unicode symbol according to the encoding.
code
- a byte code to be checked.
true
if code
could be decoded.
protected void fillCustomEncoding()
protected void fillNamedEncoding()
protected void fillStandardEncoding()
Copyright © 1998–2018 iText Group NV. All rights reserved.