private static void renderText(List<DisplayCommand> displayList, InlineBox layoutBox) { // there needs to be some major refactoring before this is less ugly. // TODO eliminate the current wonky lookup for extracting a node // TODO include the parent box when rendering text without using this // check // FIXME text rendering is not contained because inline layout and // cascading(?) do not exist yet. Node sourceNode = layoutBox.getStyledNode().getNode(); if (sourceNode.getType() == NodeType.TEXT) { Optional<Color> colorVal = getColor(layoutBox, "color"); Color fontColor = colorVal.orElse(Color.BLACK); Dimensions dims = layoutBox.getDimensions(); Rect paddingBox = dims.paddingBox(); String text = ((TextNode) sourceNode).getText(); Deque<LineBox> lines = layoutBox.getLines(); // displayList.add(new RenderText(text, lines, paddingBox, // fontColor)); } }