CJKFont(String fontName, String enc, boolean emb) throws DocumentException {
loadProperties();
fontType = FONT_TYPE_CJK;
String nameBase = getBaseName(fontName);
if (!isCJKFont(nameBase, enc))
throw new DocumentException(MessageLocalization.getComposedMessage("font.1.with.2.encoding.is.not.a.cjk.font", fontName, enc));
if (nameBase.length() < fontName.length()) {
style = fontName.substring(nameBase.length());
fontName = nameBase;
}
this.fontName = fontName;
encoding = CJK_ENCODING;
vertical = enc.endsWith("V");
CMap = enc;
if (enc.startsWith("Identity-")) {
cidDirect = true;
String s = cjkFonts.getProperty(fontName);
s = s.substring(0, s.indexOf('_'));
char c[] = allCMaps.get(s);
if (c == null) {
c = readCMap(s);
if (c == null)
throw new DocumentException(MessageLocalization.getComposedMessage("the.cmap.1.does.not.exist.as.a.resource", s));
c[CID_NEWLINE] = '\n';
allCMaps.put(s, c);
}
translationMap = c;
}
else {
char c[] = allCMaps.get(enc);
if (c == null) {
String s = cjkEncodings.getProperty(enc);
if (s == null)
throw new DocumentException(MessageLocalization.getComposedMessage("the.resource.cjkencodings.properties.does.not.contain.the.encoding.1", enc));
StringTokenizer tk = new StringTokenizer(s);
String nt = tk.nextToken();
c = allCMaps.get(nt);
if (c == null) {
c = readCMap(nt);