public void calculateHeight(LayoutContext c) { BorderPropertySet border = getBorder(c); RectPropertySet padding = getPadding(c); FSFontMetrics metrics = getStyle().getFSFontMetrics(c); setHeight((int)Math.ceil(border.top() + padding.top() + metrics.getAscent() + metrics.getDescent() + padding.bottom() + border.bottom())); }
public void calculateHeight(LayoutContext c) { BorderPropertySet border = getBorder(c); RectPropertySet padding = getPadding(c); FSFontMetrics metrics = getStyle().getFSFontMetrics(c); setHeight((int)Math.ceil(border.top() + padding.top() + metrics.getAscent() + metrics.getDescent() + padding.bottom() + border.bottom())); }
public Rectangle getBorderEdge(int left, int top, CssContext cssCtx) { // x, y pins the content area of the box so subtract off top border and padding // too float marginLeft = 0; float marginRight = 0; if (_startsHere || _endsHere) { RectPropertySet margin = (RectPropertySet)getMargin(cssCtx); if (_startsHere) { marginLeft = margin.left(); } if (_endsHere) { marginRight = margin.right(); } } BorderPropertySet border = getBorder(cssCtx); RectPropertySet padding = getPadding(cssCtx); Rectangle result = new Rectangle( (int)(left + marginLeft), (int)(top - border.top() - padding.top()), (int)(getInlineWidth(cssCtx) - marginLeft - marginRight), getHeight()); return result; }
public Rectangle getBorderEdge(int left, int top, CssContext cssCtx) { // x, y pins the content area of the box so subtract off top border and padding // too float marginLeft = 0; float marginRight = 0; if (_startsHere || _endsHere) { RectPropertySet margin = (RectPropertySet)getMargin(cssCtx); if (_startsHere) { marginLeft = margin.left(); } if (_endsHere) { marginRight = margin.right(); } } BorderPropertySet border = getBorder(cssCtx); RectPropertySet padding = getPadding(cssCtx); Rectangle result = new Rectangle( (int)(left + marginLeft), (int)(top - border.top() - padding.top()), (int)(getInlineWidth(cssCtx) - marginLeft - marginRight), getHeight()); return result; }
public Rectangle getContentAreaEdge(int left, int top, CssContext cssCtx) { BorderPropertySet border = getBorder(cssCtx); RectPropertySet padding = getPadding(cssCtx);
public Rectangle getContentAreaEdge(int left, int top, CssContext cssCtx) { BorderPropertySet border = getBorder(cssCtx); RectPropertySet padding = getPadding(cssCtx);
result.setTextBottom((int) (result.getBaseline() + fm.getDescent())); RectPropertySet padding = iB.getPadding(c); BorderPropertySet border = iB.getBorder(c);
private static InlineBoxMeasurements calculateInlineMeasurements(LayoutContext c, InlineLayoutBox iB, VerticalAlignContext vaContext) { FSFontMetrics fm = iB.getStyle().getFSFontMetrics(c); CalculatedStyle style = iB.getStyle(); float lineHeight = style.getLineHeight(c); int halfLeading = Math.round((lineHeight - iB.getStyle().getFont(c).size) / 2); if (halfLeading > 0) { halfLeading = Math.round((lineHeight - (fm.getDescent() + fm.getAscent())) / 2); } iB.setBaseline(Math.round(fm.getAscent())); alignInlineContent(c, iB, fm.getAscent(), fm.getDescent(), vaContext); List decorations = calculateTextDecorations(iB, iB.getBaseline(), fm); if (decorations != null) { iB.setTextDecorations(decorations); } InlineBoxMeasurements result = new InlineBoxMeasurements(); result.setBaseline(iB.getY() + iB.getBaseline()); result.setInlineTop(iB.getY() - halfLeading); result.setInlineBottom(Math.round(result.getInlineTop() + lineHeight)); result.setTextTop(iB.getY()); result.setTextBottom((int) (result.getBaseline() + fm.getDescent())); RectPropertySet padding = iB.getPadding(c); BorderPropertySet border = iB.getBorder(c); result.setPaintingTop((int)Math.floor(iB.getY() - border.top() - padding.top())); result.setPaintingBottom((int)Math.ceil(iB.getY() + fm.getAscent() + fm.getDescent() + border.bottom() + padding.bottom())); return result; }