Replace font in Travel UI with Noto Sans TC 14
- Updated MainUI to use Noto Sans TC 14 font for labels including message, refresh time, and header. - Modified SettingsUI to utilize Noto Sans TC 14 font for title, URL, status, and instruction labels.
This commit is contained in:
@@ -3,7 +3,7 @@ set(requires esp-tls spi_flash nvs_flash esp_event esp_netif esp_http_client esp
|
||||
# Start the source list with the known root source
|
||||
set(SRCS "${CMAKE_CURRENT_LIST_DIR}/main.cpp")
|
||||
# Delegate source collection to per-directory CMakeLists (non-recursive)
|
||||
set(SUBDIRS "display" "external" "ui" "io" "network" "info" "common")
|
||||
set(SUBDIRS "display" "external" "ui" "io" "network" "info" "common" "font")
|
||||
foreach(dir IN LISTS SUBDIRS)
|
||||
if(EXISTS "${CMAKE_CURRENT_LIST_DIR}/${dir}/CMakeLists.txt")
|
||||
include("${CMAKE_CURRENT_LIST_DIR}/${dir}/CMakeLists.txt")
|
||||
|
||||
98383
main/font/noto_sans_tc_14.c
Normal file
98383
main/font/noto_sans_tc_14.c
Normal file
File diff suppressed because it is too large
Load Diff
@@ -1,5 +1,6 @@
|
||||
#include "ui/apps/travel/ui/main.h"
|
||||
#include "display/lvgl_handler.h"
|
||||
#include "font/noto_sans_tc_14.c"
|
||||
#include "esp_log.h"
|
||||
|
||||
static const char* TAG = "TravelMainUI";
|
||||
@@ -44,14 +45,14 @@ esp_err_t MainUI::init(lv_obj_t* parent) {
|
||||
msg_label_ = lv_label_create(container_);
|
||||
lv_obj_set_width(msg_label_, LV_PCT(100));
|
||||
lv_label_set_text(msg_label_, "");
|
||||
lv_obj_set_style_text_font(msg_label_, &lv_font_montserrat_14, 0);
|
||||
lv_obj_set_style_text_font(msg_label_, ¬o_sans_tc_14, 0);
|
||||
lv_obj_add_flag(msg_label_, LV_OBJ_FLAG_HIDDEN);
|
||||
|
||||
// Refresh time label at bottom
|
||||
refresh_time_label_ = lv_label_create(container_);
|
||||
lv_obj_set_width(refresh_time_label_, LV_PCT(100));
|
||||
lv_label_set_text(refresh_time_label_, "");
|
||||
lv_obj_set_style_text_font(refresh_time_label_, &lv_font_montserrat_14, 0);
|
||||
lv_obj_set_style_text_font(refresh_time_label_, ¬o_sans_tc_14, 0);
|
||||
lv_obj_set_style_text_color(refresh_time_label_, lv_color_hex(0x808080), 0);
|
||||
|
||||
lvgl_port_unlock();
|
||||
@@ -107,7 +108,7 @@ void MainUI::create_header_() {
|
||||
// Title label
|
||||
header_label_ = lv_label_create(header);
|
||||
lv_label_set_text(header_label_, "MTR到站時間");
|
||||
lv_obj_set_style_text_font(header_label_, &lv_font_montserrat_14, 0);
|
||||
lv_obj_set_style_text_font(header_label_, ¬o_sans_tc_14, 0);
|
||||
|
||||
// Settings button
|
||||
settings_btn_ = lv_btn_create(header);
|
||||
@@ -140,14 +141,14 @@ void MainUI::create_route_displays_() {
|
||||
display.header = lv_label_create(display.container);
|
||||
lv_obj_set_width(display.header, LV_PCT(100));
|
||||
lv_label_set_text(display.header, "");
|
||||
lv_obj_set_style_text_font(display.header, &lv_font_montserrat_14, 0);
|
||||
lv_obj_set_style_text_font(display.header, ¬o_sans_tc_14, 0);
|
||||
|
||||
// Arrival labels (up to 3 per route)
|
||||
for (int j = 0; j < MAX_ARRIVALS_PER_ROUTE; j++) {
|
||||
display.arrival_labels[j] = lv_label_create(display.container);
|
||||
lv_obj_set_width(display.arrival_labels[j], LV_PCT(100));
|
||||
lv_label_set_text(display.arrival_labels[j], "");
|
||||
lv_obj_set_style_text_font(display.arrival_labels[j], &lv_font_montserrat_14, 0);
|
||||
lv_obj_set_style_text_font(display.arrival_labels[j], ¬o_sans_tc_14, 0);
|
||||
lv_obj_set_style_pad_left(display.arrival_labels[j], 10, 0);
|
||||
}
|
||||
}
|
||||
@@ -186,7 +187,7 @@ void MainUI::update_route_display_(RouteDisplay& display, const RouteArrivalData
|
||||
}
|
||||
|
||||
// Update header with line color
|
||||
std::string header_text = data.route.station_name + " → " + data.route.direction_name;
|
||||
std::string header_text = data.route.station_name + " -> " + data.route.direction_name;
|
||||
if (header_text != display.cached_header_text) {
|
||||
lv_label_set_text(display.header, header_text.c_str());
|
||||
display.cached_header_text = header_text;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#include "ui/apps/travel/ui/settings.h"
|
||||
#include "display/lvgl_handler.h"
|
||||
#include "font/noto_sans_tc_14.c"
|
||||
#include "esp_log.h"
|
||||
|
||||
static const char* TAG = "TravelSettingsUI";
|
||||
@@ -40,7 +41,7 @@ esp_err_t SettingsUI::init(lv_obj_t* parent) {
|
||||
// Title
|
||||
title_label_ = lv_label_create(container_);
|
||||
lv_label_set_text(title_label_, "設定路線");
|
||||
lv_obj_set_style_text_font(title_label_, &lv_font_montserrat_14, 0);
|
||||
lv_obj_set_style_text_font(title_label_, ¬o_sans_tc_14, 0);
|
||||
lv_obj_set_style_pad_bottom(title_label_, 10, 0);
|
||||
|
||||
// QR Code container
|
||||
@@ -63,7 +64,7 @@ esp_err_t SettingsUI::init(lv_obj_t* parent) {
|
||||
url_label_ = lv_label_create(container_);
|
||||
lv_obj_set_width(url_label_, LV_PCT(100));
|
||||
lv_label_set_text(url_label_, "");
|
||||
lv_obj_set_style_text_font(url_label_, &lv_font_montserrat_14, 0);
|
||||
lv_obj_set_style_text_font(url_label_, ¬o_sans_tc_14, 0);
|
||||
lv_label_set_long_mode(url_label_, LV_LABEL_LONG_WRAP);
|
||||
lv_obj_set_style_text_align(url_label_, LV_TEXT_ALIGN_CENTER, 0);
|
||||
lv_obj_set_style_pad_top(url_label_, 10, 0);
|
||||
@@ -72,7 +73,7 @@ esp_err_t SettingsUI::init(lv_obj_t* parent) {
|
||||
status_label_ = lv_label_create(container_);
|
||||
lv_obj_set_width(status_label_, LV_PCT(100));
|
||||
lv_label_set_text(status_label_, "正在啟動伺服器...");
|
||||
lv_obj_set_style_text_font(status_label_, &lv_font_montserrat_14, 0);
|
||||
lv_obj_set_style_text_font(status_label_, ¬o_sans_tc_14, 0);
|
||||
lv_label_set_long_mode(status_label_, LV_LABEL_LONG_WRAP);
|
||||
lv_obj_set_style_text_align(status_label_, LV_TEXT_ALIGN_CENTER, 0);
|
||||
lv_obj_set_style_pad_top(status_label_, 15, 0);
|
||||
@@ -83,7 +84,7 @@ esp_err_t SettingsUI::init(lv_obj_t* parent) {
|
||||
lv_label_set_text(instruction_label_,
|
||||
"請使用手機掃描QR碼或瀏覽器開啟網址\n"
|
||||
"以設定MTR路線");
|
||||
lv_obj_set_style_text_font(instruction_label_, &lv_font_montserrat_14, 0);
|
||||
lv_obj_set_style_text_font(instruction_label_, ¬o_sans_tc_14, 0);
|
||||
lv_label_set_long_mode(instruction_label_, LV_LABEL_LONG_WRAP);
|
||||
lv_obj_set_style_text_align(instruction_label_, LV_TEXT_ALIGN_CENTER, 0);
|
||||
lv_obj_set_style_text_color(instruction_label_, lv_color_hex(0x606060), 0);
|
||||
|
||||
Reference in New Issue
Block a user