inline.rightPadding = (int)margin.right() + border.right + (int)padding.right(); inline.leftPadding = (int)margin.left() + border.left + (int)padding.left();
inline.rightPadding = (int)margin.right() + (int)border.right() + (int)padding.right(); inline.leftPadding = (int)margin.left() + (int)border.left() + (int)padding.left();
    private static InlineBox calculateInline(Context c, Content content, int avail, int max_width,                                             InlineBox prev_align, boolean isFirstLetter, CascadedStyle firstLetterStyle,                                             LineBox curr_line, int start, InlineBlockBox pendingBlockBox) {        InlineBox result;        // handle each case        if (content instanceof InlineBlockContent) {            //Uu.p("is replaced");            result = LineBreaker.generateReplacedInlineBox(c, content, avail, prev_align, curr_line, pendingBlockBox);        } else if (content instanceof FloatedBlockContent) {            //Uu.p("calcinline: is floated block");            result = FloatUtil.generateFloatedBlockInlineBox(c, content, avail, curr_line);        } else {            //OK, now we should have only TextContent left, fail fast if not            // Uu.p("real content = " + content);            TextContent textContent = (TextContent) content;            //might need to transform it            // get the text of the node            String text = textContent.getText();            // transform the text if required (like converting to caps)            // this must be done before any measuring since it might change the            // size of the text            //Uu.p("text from the node = \"" + text + "\"");            text = TextUtil.transformText(text, c.getCurrentStyle());            int end = text.length();            InlineTextBox inline = new InlineTextBox();            inline.setStyle(new Style(c.getCurrentStyle(), max_width, c.getCtx()));            inline.element = textContent.getElement();            if (inline.element != null) {                String id = c.getNamespaceHandler().getID(inline.element);                if (id != null && !id.equals("")) {                    c.addIDBox(id, inline);                }            }            inline.pseudoElement = textContent.getPseudoElement();            //Here we must set MasterText, it might have been restyled            inline.setMasterText(text);            // Uu.p("calculating inline: text = " + text);            // Uu.p("avail space = " + avail + " max = " + max_width + "   start index = " + start);            if (isFirstLetter && firstLetterStyle != null) {                //TODO: what if first letter is whitespace?                end = start + 1;                inline.setSubstring(start, end);                c.pushStyle(firstLetterStyle);                inline.setStyle(new Style(c.getCurrentStyle(), max_width, c.getCtx()));                prepareBox(prev_align, inline, c);                Border border = c.getCurrentStyle().getBorderWidth(c.getCtx());                //first letter is a pseudo-element, so has borders, etc.                //note: percentages here refer to width of containing block                RectPropertySet margin = c.getCurrentStyle().getMarginRect(max_width, max_width, c.getCtx());                RectPropertySet padding = c.getCurrentStyle().getPaddingRect(max_width, max_width, c.getCtx());                // CLEAN: cast to ints                inline.rightPadding = (int)margin.right() + border.right + (int)padding.right();                inline.leftPadding = (int)margin.left() + border.left + (int)padding.left();                c.popStyle();                result = inline;            } else {                inline.setSubstring(start, end);                inline.whitespace = WhitespaceStripper.getWhitespace(c.getCurrentStyle());                Breaker.breakText(c, inline, prev_align, avail, inline.getStyle().getFont(c.getCtx()));                prepareBox(prev_align, inline, c);            }            result = inline;        }        return result;    }