protected Font parseFont(Node root) {
if (LOGGER.isLoggable(Level.FINEST)) {
LOGGER.finest("parsing font");
}
Font font = factory.getDefaultFont();
NodeList list = findElements(((Element) root), "CssParameter");
int length = list.getLength();
for (int i = 0; i < length; i++) {
Node child = list.item(i);
if ((child == null) || (child.getNodeType() != Node.ELEMENT_NODE)) {
continue;
}
Element param = (Element) child;
org.w3c.dom.NamedNodeMap map = param.getAttributes();
final int mapLength = map.getLength();
for (int k = 0; k < mapLength; k++) {
String res = map.item(k).getNodeValue();
if (res.equalsIgnoreCase("font-family")) {
font.setFontFamily(parseCssParameter(child));
} else if (res.equalsIgnoreCase("font-style")) {
font.setFontStyle(parseCssParameter(child));
} else if (res.equalsIgnoreCase("font-size")) {
font.setFontSize(parseCssParameter(child));
} else if (res.equalsIgnoreCase("font-weight")) {
font.setFontWeight(parseCssParameter(child));
}
}
}
return font;