// // Copyright (c) 2019 Julian Hinxlage. All rights reserved. // #include "Font.h" Font::Font() { xOffset = 2; yOffset = 2; xSize = 5; ySize = 7; xCount = 18; yCount = 4; xStart = 1; yStart = 2; } Font::Font(const std::string &file) : Font() { bitmap.load(file); } void Font::load(const std::string &file) { bitmap.load(file); } int Font::width() { return xSize; } int Font::height() { return ySize; } unsigned int Font::getPixel(char character, int x, int y) { //index of character(x and y) int index = (character - ' '); int xIndex = index % xCount; int yIndex = index / xCount; //character index to pixel index conversion int xPos = xIndex * (xSize + xOffset) + xStart; int yPos = yIndex * (ySize + yOffset) + yStart; return bitmap.getPixel(xPos + x, yPos + y); }