diff --git a/main/main.cpp b/main/main.cpp index e7b311b..a9a229c 100644 --- a/main/main.cpp +++ b/main/main.cpp @@ -1,4 +1,3 @@ -#include "add.h" #include "Bitmap.h" #include "Font.h" @@ -12,7 +11,8 @@ * Currently only to test. */ int main() { - Font font("../res/font2.bmp","../res/font2.toml"); + Font font("../res/profont-IIx.bmp","../res/profont-IIx.toml"); + //Font font("../res/font2.bmp","../res/font2.toml"); std::string str; std::cout << "string to draw: "; diff --git a/res/profont-IIx.bmp b/res/profont-IIx.bmp new file mode 100644 index 0000000..c7eb8ec Binary files /dev/null and b/res/profont-IIx.bmp differ diff --git a/res/profont-IIx.toml b/res/profont-IIx.toml new file mode 100644 index 0000000..5bed19f --- /dev/null +++ b/res/profont-IIx.toml @@ -0,0 +1,12 @@ +xOffset = 6 +yOffset = 6 +xSize = 18 +ySize = 27 +xCount = 32 +yCount = 9 +xStart = 7 +yStart = 9 +fillValue = 4294967295 +firstChar = 25 +pixelSize = 1 +invertedColors = 1 \ No newline at end of file diff --git a/src/Font.cpp b/src/Font.cpp index f0d6318..0a601b7 100644 --- a/src/Font.cpp +++ b/src/Font.cpp @@ -37,6 +37,7 @@ void Font::load(const std::string &file, const std::string &configFile) { firstChar = (char)config->get_as("firstChar").value_or(0); pixelSize = config->get_as("pixelSize").value_or(0); gap = config->get_as("gap").value_or(-1); + invertedColors = config->get_as("invertedColors").value_or(0); } int Font::width() { @@ -69,6 +70,11 @@ bool Font::getPixel(char character, int x, int y) { int xPos = xIndex * (xSize + xOffset) + xStart; int yPos = yIndex * (ySize + yOffset) + yStart; - return bitmap.getPixel((xPos + x) * pixelSize, (yPos + y) * pixelSize) == fillValue; + bool value = bitmap.getPixel((xPos + x) * pixelSize, (yPos + y) * pixelSize) == fillValue; + if(invertedColors){ + return !value; + }else{ + return value; + } } diff --git a/src/Font.h b/src/Font.h index 30789d5..e4c45d5 100644 --- a/src/Font.h +++ b/src/Font.h @@ -38,6 +38,8 @@ public: int pixelSize; int gap; + bool invertedColors; + Font(); explicit Font(const std::string &file, const std::string &configFile); void load(const std::string &file, const std::string &configFile);