- BufferedImage image = null;
-
- image = glyphCache.get(cell);
- if (image == null) {
- // Generate glyph and draw it to an image.
- image = new BufferedImage(textWidth * 2, textHeight * 2,
- BufferedImage.TYPE_INT_ARGB);
- Graphics2D gr2 = image.createGraphics();
- gr2.setFont(doubleFont);
-
- // Draw the background rectangle, then the foreground character.
- if (getScreen() instanceof ECMA48Terminal) {
- // BUG: the background color is coming in the same as the
- // foreground color. For now, don't draw it.
- } else {
- gr2.setColor(SwingTerminal.attrToBackgroundColor(cell));
- gr2.fillRect(0, 0, image.getWidth(), image.getHeight());
- }
- gr2.setColor(SwingTerminal.attrToForegroundColor(cell));
- char [] chars = new char[1];
- chars[0] = cell.getChar();
- gr2.drawChars(chars, 0, 1, doubleTextAdjustX,
- (textHeight * 2) - doubleMaxDescent + doubleTextAdjustY);
-
- if (cell.isUnderline() && (line.getDoubleHeight() != 1)) {
- gr2.fillRect(0, textHeight - 2, textWidth, 2);
- }
- gr2.dispose();
-
- // Now save this generated image, using a new key that will not
- // be mutated by invertCell().
- Cell key = new Cell();
- key.setTo(cell);
- glyphCache.put(key, image);
+ BufferedImage image;
+ if (line.getDoubleHeight() == 1) {
+ // Double-height top half: don't draw the underline.
+ Cell newCell = new Cell(cell);
+ newCell.setUnderline(false);
+ image = doubleFont.getImage(newCell, textWidth * 2, textHeight * 2,
+ cursorBlinkVisible);
+ } else {
+ image = doubleFont.getImage(cell, textWidth * 2, textHeight * 2,
+ cursorBlinkVisible);