} else if (tokenType == PSEOFTOKEN) {
eof = true;
}
}
} catch (Exception e) {
throw new FontFormatException(e.toString());
}
/* Ignore all fonts besides Type1 (e.g. Type3 fonts) */
if (!"1".equals(fontType)) {
throw new FontFormatException("Unsupported font type");
}
if (psName == null) { //no explicit FontName
// Try to extract font name from the first text line.
// According to Type1 spec first line consist of
// "%!FontType1-SpecVersion: FontName FontVersion"
// or
// "%!PS-AdobeFont-1.0: FontName version"
bb.position(0);
if (bb.getShort() != 0x2521) { //if pfb (do not start with "%!")
//skip segment header and "%!"
bb.position(8);
//NB: assume that first segment is ASCII one
// (is it possible to have valid Type1 font with first binary segment?)
}
String formatType = getSimpleToken(bb);
if (!formatType.startsWith("FontType1-") && !formatType.startsWith("PS-AdobeFont-")) {
throw new FontFormatException("Unsupported font format [" + formatType + "]");
}
psName = getSimpleToken(bb);
}
//if we got to the end of file then we did not find at least one of FullName or FamilyName