Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docker/post_build.sh.in
Original file line number Diff line number Diff line change
Expand Up @@ -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/"
Expand Down
6 changes: 4 additions & 2 deletions src/displayapp/DisplayApp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -443,15 +443,17 @@ 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,
notificationManager,
systemTask->nimble().alertService(),
motorController,
*systemTask,
Screens::Notifications::Modes::Preview);
Screens::Notifications::Modes::Preview,
filesystem);
break;
case Apps::Timer:
currentScreen = std::make_unique<Screens::Timer>(timer);
Expand Down
15 changes: 14 additions & 1 deletion src/displayapp/screens/Notifications.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,23 @@ 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},
motorController {motorController},
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) {
Expand Down Expand Up @@ -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() {
Expand Down
4 changes: 3 additions & 1 deletion src/displayapp/screens/Notifications.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -90,6 +91,7 @@ namespace Pinetime {
bool dismissingNotification = false;

lv_task_t* taskRefresh;
lv_font_t* lang_pack = nullptr;
};
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/libs/lvgl
Submodule lvgl updated from 7c96fb to 1fe202
13 changes: 13 additions & 0 deletions src/resources/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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 added src/resources/JetBrainsMono-Bold.ttf
Binary file not shown.
14 changes: 14 additions & 0 deletions src/resources/lang_pack/greek.json
Original file line number Diff line number Diff line change
@@ -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/"
}
}
14 changes: 14 additions & 0 deletions src/resources/lang_pack/latin.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"lang_pack" : {
"sources": [
{
"file": "JetBrainsMono-Bold.ttf",
"range": "0xc0-0xff"
}
],
"bpp": 1,
"size": 20,
"format": "bin",
"target_path": "/fonts/"
}
}