fontfaceDecls = contentDom.getRootElement().newOfficeFontFaceDeclsElement();
}
NodeList list = fontfaceDecls.getElementsByTagName("style:font-face");
for (int i = 0; i < list.getLength(); i++) {
StyleFontFaceElement node = (StyleFontFaceElement) list.item(i);
String familyname = node.getSvgFontFamilyAttribute();
String fontName = node.getStyleNameAttribute();
if (aFamilyName.equals(familyname)) {
return fontName;
}
if (aFontName.equals(fontName)) {
duplicated = true;
}
}
// Get a font name
while (duplicated) {
duplicated = false;
aFontName = aFontName + "_1";
for (int i = 0; i < list.getLength(); i++) {
StyleFontFaceElement node = (StyleFontFaceElement) list.item(i);
String fontName = node.getStyleNameAttribute();
if (aFontName.equals(fontName)) {
duplicated = true;
break;
}
}
}
StyleFontFaceElement newfont = fontfaceDecls.newStyleFontFaceElement(aFontName);
newfont.setSvgFontFamilyAttribute(aFamilyName);
return aFontName;
} catch (Exception e) {
Logger.getLogger(TextProperties.class.getName()).log(Level.SEVERE, e.getMessage(), e);
}
return null;