if (!(tempFont instanceof CustomFont)) {
throw new IllegalArgumentException(
"FontDescriptor must be instance of CustomFont, but is a "
+ desc.getClass().getName());
}
CustomFont font = (CustomFont)tempFont;
InputStream in = null;
try {
// Get file first
if (font.getEmbedFileName() != null) {
try {
in = getDocument().resolveURI(font.getEmbedFileName());
} catch (Exception e) {
log.error("Failed to embed fontfile: "
+ font.getEmbedFileName()
+ "(" + e.getMessage() + ")");
}
}
// Get resource
if (in == null && font.getEmbedResourceName() != null) {
try {
in = new java.io.BufferedInputStream(
this.getClass().getResourceAsStream(
font.getEmbedResourceName()));
} catch (Exception e) {
log.error(
"Failed to embed fontresource: "
+ font.getEmbedResourceName()
+ "(" + e.getMessage() + ")");
}
}
if (in == null) {