Misc
This commit is contained in:
@@ -403,6 +403,7 @@ void GenerateConfig() {
|
||||
style.add({"IndentSize", "4"});
|
||||
style.add({"TrimWhitespaceOnSave", "1"});
|
||||
style.add({"FontSize", "12"});
|
||||
style.add({"FontFilter", "0"}); // nearest = 0, linear = 1 - seems like nearest always better?
|
||||
style.add({"Font", "C:/Windows/Fonts/consola.ttf"});
|
||||
|
||||
{
|
||||
|
||||
@@ -98,7 +98,7 @@ Font CreateFont(Atlas *atlas, int32_t size, String path) {
|
||||
|
||||
Font result = {};
|
||||
result.glyphs.allocator = allocator;
|
||||
String file = ReadFile(allocator, path);
|
||||
String file = ReadFile(scratch, path);
|
||||
if (file.len == 0) {
|
||||
file = GetDefaultFont(scratch);
|
||||
Assert(file.len != 0);
|
||||
|
||||
@@ -387,7 +387,8 @@ void ReloadFont() {
|
||||
Atlas atlas = CreateAtlas(scratch, {2048, 2048});
|
||||
MainFont = CreateFont(&atlas, (uint32_t)size, StyleFont);
|
||||
{
|
||||
GLint filter = GL_NEAREST; // GL_LINEAR
|
||||
GLint filter = GL_NEAREST;
|
||||
if (StyleFontFilter == 1) filter = GL_LINEAR;
|
||||
glCreateTextures(GL_TEXTURE_2D, 1, &atlas.texture_id);
|
||||
glTextureParameteri(atlas.texture_id, GL_TEXTURE_MIN_FILTER, filter);
|
||||
glTextureParameteri(atlas.texture_id, GL_TEXTURE_MAG_FILTER, filter);
|
||||
|
||||
@@ -60,6 +60,7 @@ Style.DrawScrollbar = 1
|
||||
Style.IndentSize = 4
|
||||
Style.TrimWhitespaceOnSave = 1
|
||||
Style.FontSize = 12
|
||||
Style.FontFilter = 0
|
||||
Style.Font = "C:/Windows/Fonts/consola.ttf"
|
||||
|
||||
-- @todo: should we rewrite linux paths to windows on windows and vice-versa?
|
||||
@@ -244,5 +245,6 @@ void ReloadStyle() {
|
||||
StyleIndentSize = GetStyleInt("IndentSize", StyleIndentSize);
|
||||
StyleTrimWhitespaceOnSave = GetStyleInt("TrimWhitespaceOnSave", StyleTrimWhitespaceOnSave);
|
||||
StyleFontSize = GetStyleInt("FontSize", StyleFontSize);
|
||||
StyleFontFilter = GetStyleInt("FontFilter", StyleFontFilter);
|
||||
StyleFont = GetStyleString("Font", StyleFont);
|
||||
}
|
||||
@@ -57,4 +57,5 @@ Int StyleDrawScrollbar = 1;
|
||||
Int StyleIndentSize = 4;
|
||||
Int StyleTrimWhitespaceOnSave = 1;
|
||||
Int StyleFontSize = 12;
|
||||
Int StyleFontFilter = 0;
|
||||
String StyleFont = "C:/Windows/Fonts/consola.ttf";
|
||||
@@ -282,6 +282,7 @@ void ReloadLuaConfig() {
|
||||
lua_pop(LuaState, 1);
|
||||
}
|
||||
ReloadStyle();
|
||||
// @todo: maybe don't reload font if nothing changed
|
||||
ReloadFont();
|
||||
ForItem(window, Windows) {
|
||||
if (!window.visible || window.absolute_position || window.is_title_bar) continue;
|
||||
|
||||
Reference in New Issue
Block a user