Adds support for underlined characters.
@@ -113,6 +113,7 @@ public final class ColoredImageCache {
BufferedImage bufferedImage;
bufferedImage = applyColorSwap(character, font);
bufferedImage = applyFlips(character, font, bufferedImage);
+ bufferedImage = applyUnderline(character, bufferedImage);
image = convertToVolatileImage(bufferedImage);
cachedImages.put(hash, image);
@@ -222,6 +223,21 @@ public final class ColoredImageCache {
return image;
}
+ private static BufferedImage applyUnderline(final @NonNull AsciiCharacter character, final @NonNull BufferedImage image) {
+ if (character.isUnderlined()) {
+ final Graphics2D gc = image.createGraphics();
+
+ gc.setColor(character.getForegroundColor());
+
+ final int y = image.getHeight() - character.getUnderlineThickness();
+ gc.fillRect(0, y, image.getWidth(), character.getUnderlineThickness());
+
+ gc.dispose();
+ }
+
+ return image;
+ }
+
/**
* Makes a clone of an image.
*
