Backup font based on imgui stuff
This commit is contained in:
@@ -100,7 +100,8 @@ Font CreateFont(Atlas *atlas, int32_t size, String path) {
|
||||
result.glyphs.allocator = allocator;
|
||||
String file = ReadFile(allocator, path);
|
||||
if (file.len == 0) {
|
||||
return result;
|
||||
file = GetDefaultFont(scratch);
|
||||
Assert(file.len != 0);
|
||||
}
|
||||
|
||||
stbtt_fontinfo stb_font;
|
||||
|
||||
@@ -385,9 +385,10 @@ void ReloadFont(int32_t size) {
|
||||
Atlas atlas = CreateAtlas(scratch, {2048, 2048});
|
||||
MainFont = CreateFont(&atlas, size, FontPath);
|
||||
{
|
||||
GLint filter = GL_NEAREST; // GL_LINEAR
|
||||
glCreateTextures(GL_TEXTURE_2D, 1, &atlas.texture_id);
|
||||
glTextureParameteri(atlas.texture_id, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||
glTextureParameteri(atlas.texture_id, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||
glTextureParameteri(atlas.texture_id, GL_TEXTURE_MIN_FILTER, filter);
|
||||
glTextureParameteri(atlas.texture_id, GL_TEXTURE_MAG_FILTER, filter);
|
||||
glTextureParameteri(atlas.texture_id, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
|
||||
glTextureParameteri(atlas.texture_id, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
||||
glTextureStorage2D(atlas.texture_id, 1, GL_R8, (GLsizei)atlas.size.x, (GLsizei)atlas.size.y);
|
||||
|
||||
Reference in New Issue
Block a user