CalculatedStyle style = c.css.getStyle(LineBreaker.getElement(node)); Font font = FontUtil.getFont(c, style, node);
CalculatedStyle style = c.css.getStyle(node); Font font = FontUtil.getFont(c, style);
    private InlineBox calculateInline(Context c, Node node, int avail, int max_width,                                      LineBox line, InlineBox prev, Element containing_block, InlineBox prev_align) {        // calculate the starting index        int start = 0;        // if this is another box from the same node as the previous one        if (prev != null && prev.getNode() == node) {            start = prev.end_index;        }        // get the text of the node        String text = node.getNodeValue();        // 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        //u.p("text from the node = \"" + text + "\"");        text = TextUtil.transformText(c, node, text);        // u.p("calculating inline: text = " + text);        // u.p("avail space = " + avail + " max = " + max_width + "   start index = " + start);        // get the current font. required for sizing        CalculatedStyle style = c.css.getStyle(LineBreaker.getElement(node));        Font font = FontUtil.getFont(c, style, node);                // handle each case        if (LayoutUtil.isReplaced(c, node)) {            //u.p("is replaced");            return LineBreaker.generateReplacedInlineBox(c, node, avail, prev, text, prev_align, font);        }                //u.p("calc inline on node : " + node);        if (LayoutUtil.isFloatedBlock(node, c)) {            //u.p("calcinline: is floated block");            return FloatUtil.generateFloatedBlockInlineBox(c, node, avail, prev, text, prev_align, font);        }        if (LineBreaker.isFirstLetter(c, node, start)) {            //u.p("is first letter");            return LineBreaker.generateFirstLetterInlineBox(c, node, start, text, prev, prev_align, avail);        }        if (c.getRenderingContext().getLayoutFactory().isBreak(node)) {            // u.p("is break");            return LineBreaker.generateBreakInlineBox(node);        }                        // new whitespace code        if (Configuration.isTrue("xr.layout.whitespace.experimental", false)) {            WhitespaceStripper whitespace = new WhitespaceStripper();            // u.p("calling whitespace stripper on node: " + node);            // u.p(" prev = " + prev);            return whitespace.createInline(c, node, text, prev, prev_align, avail, max_width, font);        } else {            if (LineBreaker.isWhitespace(c, containing_block)) {                // u.p("is whitespace");                return LineBreaker.generateWhitespaceInlineBox(c, node, start, prev, text, prev_align, font);            }                        // ==== unbreakable long word =====            if (LineBreaker.isUnbreakableLine(c, node, start, text, avail, font)) {                // u.p("is unbreakable");                return LineBreaker.generateUnbreakableInlineBox(c, node, start, text, prev, prev_align, font);            }                        // rest of this string can fit on the line            if (LineBreaker.canFitOnLine(c, node, start, text, avail, font)) {                // u.p("can fit on line");                return LineBreaker.generateRestOfTextNodeInlineBox(c, node, start, text, prev, prev_align, font);            }                        // normal multiline break            // u.p("normal multi line break");            return LineBreaker.generateMultilineBreak(c, node, start, text, prev, prev_align, avail);        }    }