Enumeration list = subsetters.keys();
while (list.hasMoreElements()) {
FontEntry entry = (FontEntry) list.nextElement();
if (!entry.subsetter.used)
continue;
BufferedDataSource bds = new BufferedDataSource();
try {
OpenTypeFont font = entry.subsetter.font;
String resName = entry.familyName.replaceAll(" ", "-") + "-" + entry.weight;
switch (entry.style) {
case FontPropertyConstants.STYLE_ITALIC:
resName += "-Italic";
break;
case FontPropertyConstants.STYLE_OBLIQUE:
resName += "-Oblique";
break;
}
String primaryUUID = epub.getPrimaryIdentifier();
if (primaryUUID != null && primaryUUID.startsWith("urn:uuid:")) {
resName = resName + "-" + primaryUUID.substring(9);
}
bds.getOutputStream().write(font.getSubsettedFont());
String folder = epub.getContentFolder() == null ? "" : epub.getContentFolder() + "/";
FontResource fontResource = epub.createFontResource(folder + "fonts/" + resName + ".otf", bds);
FontFaceRule face = styleResource.getStylesheet().createFontFace(fontResource);
face.set("font-family", new CSSQuotedString(entry.familyName));
switch (entry.weight) {