Text-Renderer/src/Font.hpp

56 lines
987 B
C++
Raw Permalink Normal View History

2019-10-22 15:34:51 +02:00
//
// Copyright (c) 2019 Julian Hinxlage. All rights reserved.
//
2020-01-07 13:23:25 +01:00
#ifndef TEXTRENDERER_FONT_HPP
#define TEXTRENDERER_FONT_HPP
2019-10-22 15:34:51 +02:00
2020-01-07 13:23:25 +01:00
#include "Bitmap.hpp"
2019-10-22 15:34:51 +02:00
2019-10-24 12:15:07 +02:00
/**
* @author: Julian Hinxlage
* @since: v0.0.0
* @brief: this class provides pixel access based on characters
*/
2019-10-22 15:34:51 +02:00
class Font {
2019-12-17 12:06:44 +01:00
private:
2019-10-22 15:34:51 +02:00
Bitmap bitmap;
//space between characters
int xOffset;
int yOffset;
//size of a character
int xSize;
int ySize;
//count of characters per row
int xCount;
//count of rows
int yCount;
//pixel offset of first character
int xStart;
int yStart;
2019-10-23 11:42:32 +02:00
unsigned int fillValue;
2019-10-23 13:39:51 +02:00
char firstChar;
2019-10-29 13:24:09 +01:00
int pixelSize;
int gap;
2019-10-23 11:42:32 +02:00
2019-11-19 13:28:48 +01:00
bool invertedColors;
2019-12-17 12:06:44 +01:00
public:
2019-10-22 15:34:51 +02:00
Font();
2019-10-23 13:03:16 +02:00
explicit Font(const std::string &file, const std::string &configFile);
void load(const std::string &file, const std::string &configFile);
2019-10-22 15:34:51 +02:00
int width();
int height();
2019-10-23 11:42:32 +02:00
bool getPixel(char character, int x, int y);
2019-10-22 15:34:51 +02:00
};
2020-01-07 13:23:25 +01:00
#endif //TEXTRENDERER_FONT_HPP