* @param v the value to convert
* @param d HORIZONTAL_LENGTH, VERTICAL_LENGTH, or OTHER_LENGTH
* @param ctx the context
*/
protected static float pixelsToEms(float v, short d, Context ctx) {
CSSPrimitiveValue fontSize = ctx.getFontSize();
short type = fontSize.getPrimitiveType();
switch (type) {
case CSSPrimitiveValue.CSS_IDENT:
float fs = ctx.getMediumFontSize();
fs = TextUtilities.parseFontSize(fontSize.getStringValue(), fs);
return v / cssToUserSpace(fs,
CSSPrimitiveValue.CSS_PT,
d,
ctx);
default:
return v / cssToUserSpace(fontSize.getFloatValue(type),
type,
d,
ctx.getParentElementContext());
}
}