// Percentages get resolved against the width of a standard space (0x20)
// character.
final LayoutContext layoutContext = currentNode.getLayoutContext();
final FontSpecification fontSpecification =
layoutContext.getFontSpecification();
final FontMetrics fm = process.getOutputMetaData().getFontMetrics(fontSpecification);
if (fm == null)
{
// we have no font family, so return.
layoutContext.setValue(TextStyleKeys.X_MIN_LETTER_SPACING, CSSNumericValue.ZERO_LENGTH);
layoutContext.setValue(TextStyleKeys.X_MAX_LETTER_SPACING, CSSNumericValue.ZERO_LENGTH);
layoutContext.setValue(TextStyleKeys.X_OPTIMUM_LETTER_SPACING, CSSNumericValue.ZERO_LENGTH);
return;
}
final double width = StrictGeomUtility.toExternalValue(fm.getCharWidth(0x20));
final CSSNumericValue percentageBase =
CSSNumericValue.createValue(CSSNumericType.PT, width);
final CSSNumericValue min = CSSValueResolverUtility.getLength
(resolveValue(layoutContext, TextStyleKeys.X_MIN_LETTER_SPACING), percentageBase);
final CSSNumericValue max = CSSValueResolverUtility.getLength