*/
public void resolve (final DocumentContext process,
final LayoutElement currentNode,
final StyleKey key)
{
final LayoutStyle layoutContext = currentNode.getLayoutStyle();
final CSSValue value = layoutContext.getValue(key);
if (LineHeight.NONE.equals(value))
{
// query the anchestor, if there's one ..
handleNone(process, currentNode);
return;
}
if (LineHeight.NORMAL.equals(value))
{
handleNormal(process, currentNode);
return;
}
if (value instanceof CSSNumericValue == false)
{
// fall back to normal ..
handleNormal(process, currentNode);
return;
}
final CSSNumericValue nval = (CSSNumericValue) value;
if (isLengthValue(nval))
{
layoutContext.setValue(LineStyleKeys.LINE_HEIGHT, nval);
return;
}
final double factor;
if (nval.getType().equals(CSSNumericType.PERCENTAGE))
{
factor = nval.getValue() / 100d;
}
else if (nval.getType().equals(CSSNumericType.NUMBER))
{
factor = nval.getValue();
}
else
{
handleNormal(process, currentNode);
return;
}
final LayoutOutputMetaData metaData = process.getOutputMetaData();
final int resolution = (int) metaData.getNumericFeatureValue(OutputProcessorFeature.DEVICE_RESOLUTION);
final double fontSize = StyleSheetUtility.convertLengthToDouble(value, resolution);
layoutContext.setValue(LineStyleKeys.LINE_HEIGHT,
CSSNumericValue.createValue(CSSNumericType.PT, fontSize * factor));
}