diff --git a/docker/post_build.sh.in b/docker/post_build.sh.in index 5d82f3be9b..40c7dbbbbb 100755 --- a/docker/post_build.sh.in +++ b/docker/post_build.sh.in @@ -16,6 +16,7 @@ cp "$BUILD_DIR/src/pinetime-mcuboot-recovery-loader-image-$PROJECT_VERSION.bin" cp "$BUILD_DIR/src/pinetime-mcuboot-recovery-loader-dfu-$PROJECT_VERSION.zip" "$OUTPUT_DIR/pinetime-mcuboot-recovery-loader-dfu-$PROJECT_VERSION.zip" cp "$BUILD_DIR/src/resources/infinitime-resources-$PROJECT_VERSION.zip" "$OUTPUT_DIR/infinitime-resources-$PROJECT_VERSION.zip" +cp -a "$BUILD_DIR/src/resources/lang_pack/" "$OUTPUT_DIR/" mkdir -p "$OUTPUT_DIR/src" cp $BUILD_DIR/src/*.bin "$OUTPUT_DIR/src/" diff --git a/src/displayapp/DisplayApp.cpp b/src/displayapp/DisplayApp.cpp index a930fe961c..939d3c3747 100644 --- a/src/displayapp/DisplayApp.cpp +++ b/src/displayapp/DisplayApp.cpp @@ -443,7 +443,8 @@ void DisplayApp::LoadScreen(Apps app, DisplayApp::FullRefreshDirections directio systemTask->nimble().alertService(), motorController, *systemTask, - Screens::Notifications::Modes::Normal); + Screens::Notifications::Modes::Normal, + filesystem); break; case Apps::NotificationsPreview: currentScreen = std::make_unique(this, @@ -451,7 +452,8 @@ void DisplayApp::LoadScreen(Apps app, DisplayApp::FullRefreshDirections directio systemTask->nimble().alertService(), motorController, *systemTask, - Screens::Notifications::Modes::Preview); + Screens::Notifications::Modes::Preview, + filesystem); break; case Apps::Timer: currentScreen = std::make_unique(timer); diff --git a/src/displayapp/screens/Notifications.cpp b/src/displayapp/screens/Notifications.cpp index 037c43a7f6..c7d2347ed8 100644 --- a/src/displayapp/screens/Notifications.cpp +++ b/src/displayapp/screens/Notifications.cpp @@ -15,7 +15,8 @@ Notifications::Notifications(DisplayApp* app, Pinetime::Controllers::AlertNotificationService& alertNotificationService, Pinetime::Controllers::MotorController& motorController, System::SystemTask& systemTask, - Modes mode) + Modes mode, + Controllers::FS& filesystem) : app {app}, notificationManager {notificationManager}, alertNotificationService {alertNotificationService}, @@ -23,6 +24,14 @@ Notifications::Notifications(DisplayApp* app, systemTask {systemTask}, mode {mode} { + lfs_file f = {}; + if (filesystem.FileOpen(&f, "/fonts/lang_pack.bin", LFS_O_RDONLY) >= 0) { + filesystem.FileClose(&f); + lang_pack = lv_font_load("F:/fonts/lang_pack.bin"); + jetbrains_mono_bold_20.fallback = lang_pack; + } + + notificationManager.ClearNewNotificationFlag(); auto notification = notificationManager.GetLastNotification(); if (notification.valid) { @@ -67,6 +76,10 @@ Notifications::~Notifications() { motorController.StopRinging(); systemTask.PushMessage(System::Messages::EnableSleeping); lv_obj_clean(lv_scr_act()); + + if (lang_pack != nullptr) { + lv_font_free(lang_pack); + } } void Notifications::Refresh() { diff --git a/src/displayapp/screens/Notifications.h b/src/displayapp/screens/Notifications.h index 114316b35b..46dd10bdf7 100644 --- a/src/displayapp/screens/Notifications.h +++ b/src/displayapp/screens/Notifications.h @@ -25,7 +25,8 @@ namespace Pinetime { Pinetime::Controllers::AlertNotificationService& alertNotificationService, Pinetime::Controllers::MotorController& motorController, System::SystemTask& systemTask, - Modes mode); + Modes mode, + Controllers::FS& filesystem); ~Notifications() override; void Refresh() override; @@ -90,6 +91,7 @@ namespace Pinetime { bool dismissingNotification = false; lv_task_t* taskRefresh; + lv_font_t* lang_pack = nullptr; }; } } diff --git a/src/libs/lvgl b/src/libs/lvgl index 7c96fb87e3..1fe2029b42 160000 --- a/src/libs/lvgl +++ b/src/libs/lvgl @@ -1 +1 @@ -Subproject commit 7c96fb87e33733a7a67b33bf8057e598c6843e3a +Subproject commit 1fe2029b42ad6ce354346e853d87a3226dfb46a0 diff --git a/src/resources/CMakeLists.txt b/src/resources/CMakeLists.txt index 0983aaffe6..2a0fdd88f9 100644 --- a/src/resources/CMakeLists.txt +++ b/src/resources/CMakeLists.txt @@ -27,3 +27,16 @@ add_custom_target(GenerateResources COMMENT "Generate fonts and images for resource package" ) +# generate language pack fonts +set(LANG_PACK_JSON_DIR ${CMAKE_CURRENT_SOURCE_DIR}/lang_pack) +file(GLOB LANG_PACK_JSON_LIST "${LANG_PACK_JSON_DIR}/*") + +foreach(LANG_PACK_JSON IN LISTS LANG_PACK_JSON_LIST) + get_filename_component(LANG_PACK ${LANG_PACK_JSON} NAME_WE) + add_custom_command(TARGET GenerateResources + COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/lang_pack + COMMAND "${Python3_EXECUTABLE}" ${CMAKE_CURRENT_SOURCE_DIR}/generate-fonts.py --lv-font-conv "${LV_FONT_CONV}" ${CMAKE_CURRENT_SOURCE_DIR}/lang_pack/${LANG_PACK}.json + COMMAND "${Python3_EXECUTABLE}" ${CMAKE_CURRENT_SOURCE_DIR}/generate-package.py --config ${CMAKE_CURRENT_SOURCE_DIR}/lang_pack/${LANG_PACK}.json --output ./lang_pack/${LANG_PACK}.zip + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + ) +endforeach() diff --git a/src/resources/JetBrainsMono-Bold.ttf b/src/resources/JetBrainsMono-Bold.ttf new file mode 100644 index 0000000000..0a9280916c Binary files /dev/null and b/src/resources/JetBrainsMono-Bold.ttf differ diff --git a/src/resources/lang_pack/greek.json b/src/resources/lang_pack/greek.json new file mode 100644 index 0000000000..9e68d77b81 --- /dev/null +++ b/src/resources/lang_pack/greek.json @@ -0,0 +1,14 @@ +{ + "lang_pack" : { + "sources": [ + { + "file": "JetBrainsMono-Bold.ttf", + "range": "0x391-0x3a9, 0x3b1-0x3c9" + } + ], + "bpp": 1, + "size": 20, + "format": "bin", + "target_path": "/fonts/" + } +} diff --git a/src/resources/lang_pack/latin.json b/src/resources/lang_pack/latin.json new file mode 100644 index 0000000000..3da4d05758 --- /dev/null +++ b/src/resources/lang_pack/latin.json @@ -0,0 +1,14 @@ +{ + "lang_pack" : { + "sources": [ + { + "file": "JetBrainsMono-Bold.ttf", + "range": "0xc0-0xff" + } + ], + "bpp": 1, + "size": 20, + "format": "bin", + "target_path": "/fonts/" + } +}