summaryrefslogtreecommitdiff
path: root/src/fonts.cpp
diff options
context:
space:
mode:
authorAldrik Ramaekers <aldrikboy@gmail.com>2024-03-16 18:33:49 +0100
committerAldrik Ramaekers <aldrikboy@gmail.com>2024-03-16 18:33:49 +0100
commit7c3b90eb9834ae605c679be2c240d36715225acc (patch)
tree1114d70e857174daf0f8e9b8edd08dbe4e2037fe /src/fonts.cpp
parent253c967318e6a75c6c4947b01f12ee3797db1b40 (diff)
locale loading unix
Diffstat (limited to 'src/fonts.cpp')
-rw-r--r--src/fonts.cpp36
1 files changed, 36 insertions, 0 deletions
diff --git a/src/fonts.cpp b/src/fonts.cpp
index 3c1c520..34df8f4 100644
--- a/src/fonts.cpp
+++ b/src/fonts.cpp
@@ -9,6 +9,42 @@
#include <stdio.h>
+ts_font_range ts_locale_to_range(wchar_t* buffer) {
+ ts_font_range result = FONT_RANGE_ENGLISH;
+ if (wcscmp(buffer, L"el-GR") == 0) result = FONT_RANGE_GREEK;
+ if (wcscmp(buffer, L"ko-KR") == 0) result = FONT_RANGE_KOREAN;
+ if (wcscmp(buffer, L"ja-JP") == 0) result = FONT_RANGE_JAPANESE;
+
+ if (wcscmp(buffer, L"be-BY") == 0) result = FONT_RANGE_CYRILLIC;
+ if (wcscmp(buffer, L"bg-BG") == 0) result = FONT_RANGE_CYRILLIC;
+ if (wcscmp(buffer, L"ru-RU") == 0) result = FONT_RANGE_CYRILLIC;
+ if (wcscmp(buffer, L"ru-MD") == 0) result = FONT_RANGE_CYRILLIC;
+ if (wcscmp(buffer, L"ro-MD") == 0) result = FONT_RANGE_CYRILLIC;
+ if (wcscmp(buffer, L"kk-KZ") == 0) result = FONT_RANGE_CYRILLIC;
+ if (wcscmp(buffer, L"tt-RU") == 0) result = FONT_RANGE_CYRILLIC;
+ if (wcscmp(buffer, L"ky-KG") == 0) result = FONT_RANGE_CYRILLIC;
+ if (wcscmp(buffer, L"mn-MN") == 0) result = FONT_RANGE_CYRILLIC;
+ if (wcscmp(buffer, L"az-Cyrl-AZ") == 0) result = FONT_RANGE_CYRILLIC;
+ if (wcscmp(buffer, L"uz-Cyrl-UZ") == 0) result = FONT_RANGE_CYRILLIC;
+ if (wcscmp(buffer, L"sr-Cyrl-CS") == 0) result = FONT_RANGE_CYRILLIC;
+ if (wcscmp(buffer, L"sr-Latn-CS") == 0) result = FONT_RANGE_CYRILLIC;
+ if (wcscmp(buffer, L"az-AZ") == 0) result = FONT_RANGE_CYRILLIC;
+ if (wcscmp(buffer, L"uz-UZ") == 0) result = FONT_RANGE_CYRILLIC;
+ if (wcscmp(buffer, L"sr-CS") == 0) result = FONT_RANGE_CYRILLIC;
+
+ if (wcscmp(buffer, L"bo-CN") == 0) result = FONT_RANGE_CHINESE_SIMPLE;
+ if (wcscmp(buffer, L"zh-CN") == 0) result = FONT_RANGE_CHINESE_SIMPLE;
+ if (wcscmp(buffer, L"mn-Mong-CN") == 0) result = FONT_RANGE_CHINESE_SIMPLE;
+ if (wcscmp(buffer, L"zh-HK") == 0) result = FONT_RANGE_CHINESE_FULL;
+ if (wcscmp(buffer, L"zh-TW") == 0) result = FONT_RANGE_CHINESE_FULL;
+ if (wcscmp(buffer, L"zh-SG") == 0) result = FONT_RANGE_CHINESE_SIMPLE;
+ if (wcscmp(buffer, L"zh-MO") == 0) result = FONT_RANGE_CHINESE_FULL;
+
+ if (wcscmp(buffer, L"th-TH") == 0) result = FONT_RANGE_THAI;
+ if (wcscmp(buffer, L"vi-VN") == 0) result = FONT_RANGE_VIETNAMESE;
+ return result;
+}
+
void ts_load_fonts(float size, ts_font_range locale) {
ImGuiIO& io = ImGui::GetIO();
ImFontConfig config;