final LayoutElement currentNode,
final StyleKey key)
{
//Log.debug ("Processing: " + currentNode);
final LayoutStyle layoutContext = currentNode.getLayoutStyle();
final LayoutOutputMetaData outputMetaData = process.getOutputMetaData();
final CSSValue cssValue = layoutContext.getValue(key);
if (cssValue instanceof CSSValueList)
{
final CSSValueList list = (CSSValueList) cssValue;
for (int i = 0; i < list.getLength(); i++)
{
final CSSValue item = list.getItem(i);
if (item instanceof CSSConstant)
{
final CSSConstant c = (CSSConstant) lookupValue((CSSConstant) item);
final CSSValue family = outputMetaData.getNormalizedFontFamilyName(c);
if (family != null)
{
layoutContext.setValue(key, family);
return;
}
// Ignore, although this is not ok.
DebugLog.log("Invalid state after setting predefined font family.");
}
else if (item instanceof CSSStringValue)
{
final CSSStringValue sval = (CSSStringValue) item;
final CSSValue value = process.getOutputMetaData().getNormalizedFontFamilyName(sval);
if (value != null)
{
layoutContext.setValue(key, value);
return;
}
}
}
}
else if (cssValue instanceof CSSConstant)
{
if (FontFamilyValues.NONE.equals(cssValue))
{
// that means: No text at all.
return;
}
}
layoutContext.setValue(key, outputMetaData.getDefaultFontFamily());
}