This class contains some helper methods handling Type1-Fonts.
Method from org.apache.fontbox.cff.Type1FontUtil Detail: |
public static byte[] charstringDecrypt(byte[] buffer,
int n) {
return decrypt(buffer, 4330, n);
}
|
public static byte[] charstringEncrypt(byte[] buffer,
int n) {
return encrypt(buffer, 4330, n);
}
|
public static byte[] eexecDecrypt(byte[] buffer) {
return decrypt(buffer, 55665, 4);
}
|
public static byte[] eexecEncrypt(byte[] buffer) {
return encrypt(buffer, 55665, 4);
}
|
public static byte[] hexDecode(String string) {
if (string.length() % 2 != 0)
{
throw new IllegalArgumentException();
}
byte[] bytes = new byte[string.length() / 2];
for (int i = 0; i < string.length(); i += 2)
{
bytes[i / 2] = (byte) Integer.parseInt(string.substring(i, i + 2), 16);
}
return bytes;
}
Converts a string representing a hex value into a byte array. |
public static String hexEncode(byte[] bytes) {
StringBuilder sb = new StringBuilder();
for (int i = 0; i < bytes.length; i++)
{
String string = Integer.toHexString(bytes[i] & 0xff);
if (string.length() == 1)
{
sb.append("0");
}
sb.append(string.toUpperCase());
}
return sb.toString();
}
Converts a byte-array into a string with the corresponding hex value. |