/// <summary>Calculates the text rise value for <sup> and <sub> tags.</summary> /// <param name="stylesContainer">the styles container</param> /// <param name="vAlignVal">the vertical alignment value</param> /// <returns>the calculated text rise</returns> private static float CalcTextRiseForSupSub(IStylesContainer stylesContainer, String vAlignVal) { float parentFontSize = GetParentFontSize(stylesContainer); String superscriptPosition = "33%"; String subscriptPosition = "-20%"; String relativeValue = CssConstants.SUPER.Equals(vAlignVal) ? superscriptPosition : subscriptPosition; return(CssDimensionParsingUtils.ParseRelativeValue(relativeValue, parentFontSize)); }
/// <summary>Calculates text rise for percentage value text rise.</summary> /// <param name="stylesContainer">the styles container</param> /// <param name="rootFontSize">the root font size</param> /// <param name="vAlignVal">the vertical alignment value</param> /// <returns>the calculated text rise</returns> private static float CalcTextRiseForPercentageValue(IStylesContainer stylesContainer, float rootFontSize, String vAlignVal) { String ownFontSizeStr = stylesContainer.GetStyles().Get(CssConstants.FONT_SIZE); float fontSize = CssDimensionParsingUtils.ParseAbsoluteLength(ownFontSizeStr); String lineHeightStr = stylesContainer.GetStyles().Get(CssConstants.LINE_HEIGHT); float lineHeightActualValue = GetLineHeightActualValue(fontSize, rootFontSize, lineHeightStr); return(CssDimensionParsingUtils.ParseRelativeValue(vAlignVal, lineHeightActualValue)); }