public static PropertyValue resolveAbsoluteFontSize(IdentValue fontSize, String[] fontFamilies) { boolean monospace = isMonospace(fontFamilies); if (monospace) { return (PropertyValue)FIXED_FONT_SIZES.get(fontSize); } else { return (PropertyValue)PROPORTIONAL_FONT_SIZES.get(fontSize); } }
private IdentValue resolveAbsoluteFontSize() { FSDerivedValue fontSize = valueByName(CSSName.FONT_SIZE); if (! (fontSize instanceof IdentValue)) { return null; } IdentValue fontSizeIdent = (IdentValue) fontSize; if (PrimitivePropertyBuilders.ABSOLUTE_FONT_SIZES.get(fontSizeIdent.FS_ID)) { return fontSizeIdent; } IdentValue parent = getParent().resolveAbsoluteFontSize(); if (parent != null) { if (fontSizeIdent == IdentValue.SMALLER) { return FontSizeHelper.getNextSmaller(parent); } else if (fontSize == IdentValue.LARGER) { return FontSizeHelper.getNextLarger(parent); } } return null; }
public FontSpecification getFont(CssContext ctx) { if (_font == null) { _font = new FontSpecification(); _font.families = valueByName(CSSName.FONT_FAMILY).asStringArray(); FSDerivedValue fontSize = valueByName(CSSName.FONT_SIZE); if (fontSize instanceof IdentValue) { PropertyValue replacement; IdentValue resolved = resolveAbsoluteFontSize(); if (resolved != null) { replacement = FontSizeHelper.resolveAbsoluteFontSize(resolved, _font.families); } else { replacement = FontSizeHelper.getDefaultRelativeFontSize((IdentValue) fontSize); } _font.size = LengthValue.calcFloatProportionalValue( this, CSSName.FONT_SIZE, replacement.getCssText(), replacement.getFloatValue(), replacement.getPrimitiveType(), 0, ctx); } else { _font.size = getFloatPropertyProportionalTo(CSSName.FONT_SIZE, 0, ctx); } _font.fontWeight = getIdent(CSSName.FONT_WEIGHT); _font.fontStyle = getIdent(CSSName.FONT_STYLE); _font.variant = getIdent(CSSName.FONT_VARIANT); } return _font; }
private IdentValue resolveAbsoluteFontSize() { FSDerivedValue fontSize = valueByName(CSSName.FONT_SIZE); if (! (fontSize instanceof IdentValue)) { return null; } IdentValue fontSizeIdent = (IdentValue) fontSize; if (PrimitivePropertyBuilders.ABSOLUTE_FONT_SIZES.get(fontSizeIdent.FS_ID)) { return fontSizeIdent; } IdentValue parent = getParent().resolveAbsoluteFontSize(); if (parent != null) { if (fontSizeIdent == IdentValue.SMALLER) { return FontSizeHelper.getNextSmaller(parent); } else if (fontSize == IdentValue.LARGER) { return FontSizeHelper.getNextLarger(parent); } } return null; }
public FontSpecification getFont(CssContext ctx) { if (_font == null) { _font = new FontSpecification(); _font.families = valueByName(CSSName.FONT_FAMILY).asStringArray(); FSDerivedValue fontSize = valueByName(CSSName.FONT_SIZE); if (fontSize instanceof IdentValue) { PropertyValue replacement; IdentValue resolved = resolveAbsoluteFontSize(); if (resolved != null) { replacement = FontSizeHelper.resolveAbsoluteFontSize(resolved, _font.families); } else { replacement = FontSizeHelper.getDefaultRelativeFontSize((IdentValue) fontSize); } _font.size = LengthValue.calcFloatProportionalValue( this, CSSName.FONT_SIZE, replacement.getCssText(), replacement.getFloatValue(), replacement.getPrimitiveType(), 0, ctx); } else { _font.size = getFloatPropertyProportionalTo(CSSName.FONT_SIZE, 0, ctx); } _font.fontWeight = getIdent(CSSName.FONT_WEIGHT); _font.fontStyle = getIdent(CSSName.FONT_STYLE); _font.variant = getIdent(CSSName.FONT_VARIANT); } return _font; }
public static PropertyValue resolveAbsoluteFontSize(IdentValue fontSize, String[] fontFamilies) { boolean monospace = isMonospace(fontFamilies); if (monospace) { return (PropertyValue)FIXED_FONT_SIZES.get(fontSize); } else { return (PropertyValue)PROPORTIONAL_FONT_SIZES.get(fontSize); } }