First phase moving from STBTT to FreeType

This commit is contained in:
2023-05-22 11:25:59 -07:00
parent 4a0c817a1c
commit 8328dba55c
22 changed files with 332 additions and 21 deletions

View File

@ -15,7 +15,7 @@ TrueTypeAsset::TrueTypeAsset(AssetManager *assMan, std::string name) :
void TrueTypeAsset::updateSync() {
if(this->state != 0x04) return;
this->font.texture.setSize(this->width, this->height, TEXTURE_FORMAT_RGBA);
this->font.texture.setSize(this->width, this->height, TEXTURE_FORMAT_R);
this->font.texture.buffer(this->pixels);
auto i = this->pixels;
memoryCopy(
@ -71,9 +71,9 @@ void TrueTypeAsset::updateAsync() {
this->state = 0x03;
this->font.fontSize = fontSize;
this->pixels = (struct Color*)(this->buffer + i);
this->pixels = (uint8_t*)(this->buffer + i);
this->characterData = (truetypechar_t*)(
(uint8_t*)this->pixels + (this->width * this->height * sizeof(struct Color))
(uint8_t*)this->pixels + (this->width * this->height * sizeof(uint8_t))
);
this->state = 0x04;
}

View File

@ -14,7 +14,7 @@ namespace Dawn {
AssetLoader loader;
uint8_t *buffer = nullptr;
truetypechar_t *characterData = nullptr;
struct Color *pixels = nullptr;
uint8_t *pixels = nullptr;
int32_t width, height;
public: