Examples of CSSNumericValue


Examples of org.pentaho.reporting.libraries.css.values.CSSNumericValue

    if (rawValue instanceof CSSNumericValue == false)
    {
      return CSSNumericValue.ZERO_LENGTH;
    }

    final CSSNumericValue value = (CSSNumericValue) rawValue;
    if (CSSNumericType.PERCENTAGE.equals(value.getType()))
    {
      return CSSNumericValue.createValue(basePercentage.getNumericType(), value.getValue() * basePercentage.getValue() / 100d);
    }

    if (baseElement != null)
    {
      final CSSValue baseVal = baseElement.getLayoutStyle().getValue(FontStyleKeys.FONT_SIZE);
      if (baseVal instanceof CSSNumericValue == false)
      {
        return CSSNumericValue.ZERO_LENGTH;
      }
      final CSSNumericValue baseNValue = (CSSNumericValue) baseVal;
      if (CSSNumericType.EM.equals(value.getType()))
      {
        // base is the font-size
        return CSSNumericValue.createValue(baseNValue.getNumericType(), value.getValue() * baseNValue.getValue());
      }
      if (CSSNumericType.EX.equals(value.getType()))
      {
        // base is the parent font's x-height.
        // todo: cheating for now: We assume a sensible default and do not ask the font system.
        return CSSNumericValue.createValue(baseNValue.getNumericType(), value.getValue() * baseNValue.getValue() * 0.58);
      }
      return baseNValue;
    }
    return CSSNumericValue.ZERO_LENGTH;
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.