From c719c8f655eb49557c561f75c23ce80fe1d46824 Mon Sep 17 00:00:00 2001 From: Shaohua Tong Date: Tue, 19 Nov 2019 17:47:26 +0100 Subject: [PATCH] add Bold and underline in TextRenderer --- src/TextRenderer.cpp | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/src/TextRenderer.cpp b/src/TextRenderer.cpp index c662dc4..b3a90b1 100644 --- a/src/TextRenderer.cpp +++ b/src/TextRenderer.cpp @@ -56,15 +56,18 @@ bool** TextRenderer::getCharacter(unsigned char character, Font font) { void TextRenderer::fontProcessing(bool **characterBitmap) { if(isBold()) { - + for (int i = fontHeight - 1; i >= 0; i--) { + for (int j = fontWidth - 1; j >= 0; j--) { + if (i != fontHeight - 1 && j != fontWidth - 1 && characterBitmap[i][j]) { + characterBitmap[i + 1][j] = true; + characterBitmap[i][j + 1] = true; + } + } + } } - - if(isItalics()) { - - } - if(isUnderline()) { - + for (int j = 0; j < fontWidth; j++) + characterBitmap[fontHeight - 1][j] = true; } } @@ -72,10 +75,6 @@ bool TextRenderer::isBold() { return type & BOLD != 0; } -bool TextRenderer::isItalics() { - return type & ITALICS != 0; -} - bool TextRenderer::isUnderline() { return type & UNDERLINE != 0; } @@ -96,5 +95,4 @@ void TextRenderer::translateToSharedMemory(bool **characterBitmap, int startX, i currentX = startX; currentY++; } -} - +} \ No newline at end of file