This commit is contained in:
SuIông N. 2024-09-30 00:33:08 -04:00 committed by GitHub
commit c5d5346590
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 64 additions and 5 deletions

View file

@ -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/"

View file

@ -541,7 +541,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<Screens::Notifications>(this,
@ -549,7 +550,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::QuickSettings:
currentScreen = std::make_unique<Screens::QuickSettings>(this,

View file

@ -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,
wakeLock(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) {
@ -66,6 +75,10 @@ Notifications::~Notifications() {
// make sure we stop any vibrations before exiting
motorController.StopRinging();
lv_obj_clean(lv_scr_act());
if (lang_pack != nullptr) {
lv_font_free(lang_pack);
}
}
void Notifications::Refresh() {

View file

@ -26,7 +26,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;
@ -91,6 +92,7 @@ namespace Pinetime {
bool dismissingNotification = false;
lv_task_t* taskRefresh;
lv_font_t* lang_pack = nullptr;
};
}
}

@ -1 +1 @@
Subproject commit 7c96fb87e33733a7a67b33bf8057e598c6843e3a
Subproject commit 1fe2029b42ad6ce354346e853d87a3226dfb46a0

View file

@ -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()

Binary file not shown.

View file

@ -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/"
}
}

View file

@ -0,0 +1,14 @@
{
"lang_pack" : {
"sources": [
{
"file": "JetBrainsMono-Bold.ttf",
"range": "0xc0-0xff"
}
],
"bpp": 1,
"size": 20,
"format": "bin",
"target_path": "/fonts/"
}
}