added profont-IIx font
This commit is contained in:
parent
69ed7aea40
commit
26c7fa69c4
|
@ -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: ";
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 933 KiB |
|
@ -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
|
|
@ -37,6 +37,7 @@ void Font::load(const std::string &file, const std::string &configFile) {
|
|||
firstChar = (char)config->get_as<int>("firstChar").value_or(0);
|
||||
pixelSize = config->get_as<int>("pixelSize").value_or(0);
|
||||
gap = config->get_as<int>("gap").value_or(-1);
|
||||
invertedColors = config->get_as<int>("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;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue