Update fonts

This commit is contained in:
MrLetsplay 2022-11-05 22:10:14 +01:00
parent f15e895af5
commit eb45f02afa

View File

@ -5,13 +5,12 @@
#include <GLFW/glfw3.h>
#include <iostream>
#include <glm/gtc/type_ptr.hpp>
#include <codecvt>
#include <locale>
#include "shader.h"
#include "engine.h"
#include "constants.h"
#include "internal.h"
#include "unicode.h"
namespace kek {
@ -70,8 +69,6 @@ TextMetrics TextObject::getMetrics(int sizePixels) {
return TextMetrics((int) (sizeRatio * offsetX), (int) (sizeRatio * offsetY), (int) (sizeRatio * width), (int) (sizeRatio * height));
}
static std::wstring_convert<std::codecvt_utf8<char32_t>, char32_t> utf32cvt;
struct RenderChar {
float data[24];
@ -111,7 +108,7 @@ void TextObject::allocateBuffer(TextBlock *block, int numChars) {
void TextObject::loadChars() {
std::map<unsigned int, std::vector<RenderChar>> chars;
std::u32string str = utf32cvt.from_bytes(text);
std::u32string str = Unicode::convertStdToU32(text);
float x = 0, y = 0;
int lineHeight = font->getDefaultMetrics().lineHeight;