summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAldrik Ramaekers <aldrikboy@gmail.com>2024-03-08 21:32:36 +0100
committerAldrik Ramaekers <aldrikboy@gmail.com>2024-03-08 21:32:36 +0100
commitdc5396903791c1b2a1808e724d9b6cf07d7604a7 (patch)
tree5d722fd6e0d3196473aa5f97864645ccdc13b37c
parent0b429e06b8c4b66a9f7fe89b5504315ab4f69616 (diff)
config dir on linux, fix font issue
-rw-r--r--imgui/imgui_spectrum.cpp24
-rw-r--r--src/linux/main_linux.cpp9
2 files changed, 13 insertions, 20 deletions
diff --git a/imgui/imgui_spectrum.cpp b/imgui/imgui_spectrum.cpp
index 4a1f02a..92667e0 100644
--- a/imgui/imgui_spectrum.cpp
+++ b/imgui/imgui_spectrum.cpp
@@ -11,22 +11,14 @@ namespace ImGui {
ImFontConfig config;
config.MergeMode = true;
- {
- ImFontGlyphRangesBuilder builder;
- ImVector<ImWchar> ranges;
- builder.AddRanges(io.Fonts->GetGlyphRangesDefault());
- builder.AddRanges(io.Fonts->GetGlyphRangesGreek());
- builder.BuildRanges(&ranges);
+ ImFont* font = io.Fonts->AddFontFromMemoryCompressedTTF(
+ SourceSansProRegular_compressed_data,
+ SourceSansProRegular_compressed_size,
+ size, nullptr, nullptr);
- ImFont* font = io.Fonts->AddFontFromMemoryCompressedTTF(
- SourceSansProRegular_compressed_data,
- SourceSansProRegular_compressed_size,
- size, nullptr, ranges.Data);
-
- IM_ASSERT(font != nullptr);
- io.FontDefault = font;
-
- }
+ IM_ASSERT(font != nullptr);
+ io.FontDefault = font;
+ io.Fonts->Build();
// Uncomment if you want these glyphs. Fonts can be found in fonts/ folder.
// io.Fonts->AddFontFromMemoryCompressedTTF(
@@ -40,7 +32,7 @@ namespace ImGui {
// size, &config, io.Fonts->GetGlyphRangesJapanese());
- io.Fonts->Build();
+
}
void StyleColorsSpectrum() {
diff --git a/src/linux/main_linux.cpp b/src/linux/main_linux.cpp
index f1fc01d..2d8cae0 100644
--- a/src/linux/main_linux.cpp
+++ b/src/linux/main_linux.cpp
@@ -29,8 +29,10 @@ bool program_running = true;
char config_path[MAX_INPUT_LENGTH];
static const char* _ts_platform_get_config_file_path(char* buffer) {
- char *env = getenv("HOME");
- snprintf(buffer, MAX_INPUT_LENGTH, "%s%s", env, "text-search/imgui.ini");
+ snprintf(buffer, MAX_INPUT_LENGTH, "%s", "/etc/opt/text-search/imgui.ini");
+ if (!ts_platform_dir_exists(buffer)) {
+ mkdir(buffer, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
+ }
return buffer;
}
@@ -88,7 +90,7 @@ int main(int, char**)
// Setup Dear ImGui style
ImGui::Spectrum::StyleColorsSpectrum();
- //ImGui::Spectrum::LoadFont(18.0f);
+ ImGui::Spectrum::LoadFont(18.0f);
ts_init();
ts_load_images();
@@ -100,7 +102,6 @@ int main(int, char**)
{
glfwPollEvents();
- // Start the Dear ImGui frame
ImGui_ImplOpenGL3_NewFrame();
ImGui_ImplGlfw_NewFrame();
ImGui::NewFrame();