From: Caisking <3449750381@qq.com> Date: Wed, 24 Jul 2024 01:42:42 +0000 (+0800) Subject: 增加Gilroy字体配置。增加使用字体示例 X-Git-Tag: release_V1.2.70_20241020_135402~702^2~15 X-Git-Url: http://git.snicker.com.cn/css/static/gitweb.css?a=commitdiff_plain;h=4e904262148668b441163d26c728c82d07f64dea;p=mirrors%2FFD230.git 增加Gilroy字体配置。增加使用字体示例 --- diff --git a/code/sdk/application/wearable/fd230app/nativelauncher/src/NativeLauncher.cpp b/code/sdk/application/wearable/fd230app/nativelauncher/src/NativeLauncher.cpp index 373a5d552..e5477f0e3 100644 --- a/code/sdk/application/wearable/fd230app/nativelauncher/src/NativeLauncher.cpp +++ b/code/sdk/application/wearable/fd230app/nativelauncher/src/NativeLauncher.cpp @@ -128,8 +128,8 @@ #include "ConfigModel.h" #include "rebootdevice/include/RebootModel.h" -//#include "phone/include/PhoneView.h" -//#include "phone/include/PhonePresenter.h" +// #include "phone/include/PhoneView.h" +// #include "phone/include/PhonePresenter.h" #include "phone/include/PhoneCallView.h" #include "phone/include/PhoneCallPresenter.h" #include "phone/include/PhoneDirView.h" @@ -414,6 +414,7 @@ namespace OHOS // ConfigModel::GetInstance()->Init(); // 初始化语言 GraphicStartUp::InitFontEngine(MEM_POOL_UI_FONT, MEM_POOL_UI_FONT_SIZE, OHOS::VECTOR_FONT_DIR, DEFAULT_VECTOR_FONT_FILENAME); + GraphicStartUp::InitFontEngine(MEM_POOL_UI_FONT, MEM_POOL_UI_FONT_SIZE, OHOS::NEW_FONT_DIR, GILROY_BOLD_FONT); // 注册字体 WEARABLE_LOGI(WEARABLE_LOG_MODULE_LAUNCHER_FWK, "NativeLauncher::InitNativeLauncher"); /* -------------------------------------------------------------------------- */ // 从语言json配置里面读取语言包 diff --git a/code/sdk/application/wearable/fd230app/nativeui/traing/include/TraingModel.h b/code/sdk/application/wearable/fd230app/nativeui/traing/include/TraingModel.h index 827b975a1..c50131dda 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/traing/include/TraingModel.h +++ b/code/sdk/application/wearable/fd230app/nativeui/traing/include/TraingModel.h @@ -30,10 +30,6 @@ #include #include -#define GILROY_REGULAR_FONT "./font_library/gilroy-regular-3.ttf" -#define GILROY_BOLD_FONT "./font_library/gilroy-bold-4.ttf" -#define GILROY_MEDIUM_FONT "./font_library/gilroy-medium-2.ttf" - #define TRAINING_PATH "user/userdata/sport/TrainingData/" #ifdef __cplusplus @@ -333,11 +329,11 @@ namespace OHOS TraingModel(const TraingModel &) = delete; TraingModel &operator=(const TraingModel &) = delete; - std::string motionDuration; // 显示训练时长 - UIResourceTextId sportId_ = STR_EXTREME_SPORTS; // 训练项目 - Exercisetype sportType_ = Exercisetype::FITNESS; // 训练类型 - ExerciseState sportState_ = ExerciseState::General; // 训练状态 - ExerciseTag sportTagType_ = ExerciseTag::UNKNOW; // 训练目标类型 + std::string motionDuration; // 显示训练时长 + UIResourceTextId sportId_ = STR_EXERCISE_OUTDOORWALKING; // 训练项目 + Exercisetype sportType_ = Exercisetype::FITNESS; // 训练类型 + ExerciseState sportState_ = ExerciseState::General; // 训练状态 + ExerciseTag sportTagType_ = ExerciseTag::UNKNOW; // 训练目标类型 int sportTag_ = 0; // 训练目标 int freq = 0; // 训练发送数据频率 @@ -356,7 +352,7 @@ namespace OHOS std::priority_queue, std::greater> minHeap; // 最小堆,存储最小心率值 int totalHeartRate; // 总心率 int countHeartRate; // 心率计数 - const int windowSize = 5; // 移动平均窗口大小 + const int windowSize = 5; // 移动平均窗口大小 /*std::unique_ptr sportdata;*/ // 使用 std::unique_ptr 管理 SportData 对象 }; diff --git a/code/sdk/application/wearable/fd230app/nativeui/traing/training_card/src/TrainingControlView.cpp b/code/sdk/application/wearable/fd230app/nativeui/traing/training_card/src/TrainingControlView.cpp index 3a1b45acc..f875d99ea 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/traing/training_card/src/TrainingControlView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/traing/training_card/src/TrainingControlView.cpp @@ -56,7 +56,7 @@ namespace OHOS // 初始化Lable InitLabelExt(labeltitle, 83, 50, 300, 35, "label1", STR_TRAINING_IN_PROGRESS, DEFAULT_VECTOR_FONT_FILENAME, 30); - InitLabel(labeltimer, 78, 110, 290, 80, "label2", "00:00:00", DEFAULT_VECTOR_FONT_FILENAME, 65); + InitLabel(labeltimer, 45, 110, 360, 80, "label2", "00:00:00", GILROY_BOLD_FONT, 65); InitLabelExt(labelend, 81, 330, 130, 35, "label3", STR_FINISH, DEFAULT_VECTOR_FONT_FILENAME, 30); InitLabelExt(labelstop, 251, 330, 130, 35, "label4", STR_PAUSE, DEFAULT_VECTOR_FONT_FILENAME, 30); Add(labeltitle); diff --git a/code/sdk/application/wearable/fd230app/nativeui/traing/training_card/src/TrainingDataView.cpp b/code/sdk/application/wearable/fd230app/nativeui/traing/training_card/src/TrainingDataView.cpp index ab9a400a1..0a6c7920e 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/traing/training_card/src/TrainingDataView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/traing/training_card/src/TrainingDataView.cpp @@ -55,8 +55,8 @@ namespace OHOS InitLabel(curtimelabel, 155, 60, 150, 50, "label1", "23:54", DEFAULT_VECTOR_FONT_FILENAME, 40); - InitLabel(timerlabel, 40, 163, 400, 140, "label3", "00:00:00", DEFAULT_VECTOR_FONT_FILENAME, 90); - InitLabel(heartlabel, 85, 284, 230, 80, "label4", "144", DEFAULT_VECTOR_FONT_FILENAME, 60); + InitLabel(timerlabel, 40, 163, 400, 140, "label3", "00:00:00", GILROY_BOLD_FONT, 80); + InitLabel(heartlabel, 85, 284, 230, 80, "label4", "144", GILROY_BOLD_FONT, 60); InitLabel(ubpmlabel, 218, 284, 230, 80, "label5", "bpm", DEFAULT_VECTOR_FONT_FILENAME, 60); ubpmlabel->SetTextColor(Color::Gray()); Add(curtimelabel); diff --git a/code/sdk/application/wearable/fd230app/nativeui/traing/training_card/src/TrainingDetailView.cpp b/code/sdk/application/wearable/fd230app/nativeui/traing/training_card/src/TrainingDetailView.cpp index 89de4ddf9..82d72d391 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/traing/training_card/src/TrainingDetailView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/traing/training_card/src/TrainingDetailView.cpp @@ -53,9 +53,9 @@ namespace OHOS u_stepslabel->SetTextColor(Color::Gray()); u_calorielabel->SetTextColor(Color::Gray()); - InitLabel(milelabel, 17, 170, 200, 60, "label6", "13.21", DEFAULT_VECTOR_FONT_FILENAME, 60); - InitLabel(calorielabel, 230, 170, 200, 60, "label7", "28312", DEFAULT_VECTOR_FONT_FILENAME, 60); - InitLabel(steplabel, 133, 296, 200, 60, "label8", "210.03", DEFAULT_VECTOR_FONT_FILENAME, 60); + InitLabel(milelabel, 17, 160, 200, 80, "label6", "13.21", GILROY_BOLD_FONT, 65); + InitLabel(calorielabel, 230, 160, 200, 80, "label7", "28312", GILROY_BOLD_FONT, 65); + InitLabel(steplabel, 133, 285, 200, 80, "label8", "210.03", GILROY_BOLD_FONT, 65); Add(u_milelabel); Add(u_stepslabel); Add(u_calorielabel); @@ -63,7 +63,7 @@ namespace OHOS Add(steplabel); Add(calorielabel); - InitButtonExt(intensity_button, 103, 70, 260, 80, "button", STR_MEDIUM_STRENGTH, 30); + InitButtonExt(intensity_button, 103, 70, 260, 80, "button", STR_LOWER_STRENGTH, 30); Add(intensity_button); SetTouchable(true); diff --git a/code/sdk/middleware/services/gui/uikit/utils/interfaces/innerkits/graphic_config.h b/code/sdk/middleware/services/gui/uikit/utils/interfaces/innerkits/graphic_config.h index 01c86da2d..172333bec 100755 --- a/code/sdk/middleware/services/gui/uikit/utils/interfaces/innerkits/graphic_config.h +++ b/code/sdk/middleware/services/gui/uikit/utils/interfaces/innerkits/graphic_config.h @@ -503,6 +503,9 @@ namespace OHOS { #ifdef VERSION_IOT #define DEFAULT_VECTOR_FONT_FILENAME "HarmonyOS_Sans_SC_Regular.ttf" +#define GILROY_REGULAR_FONT "Gilroy_Regular.ttf" +#define GILROY_BOLD_FONT "Gilroy_Bold.ttf" +#define GILROY_MEDIUM_FONT "Gilroy_Medium.ttf" #else #if ENABLE_VECTOR_FONT #define DEFAULT_VECTOR_FONT_FILENAME "SourceHanSansSC-Regular.otf" @@ -575,6 +578,7 @@ static constexpr const char* DEFAULT_SCREENSHOT_PATH = "/storage/screenshot.bin" static constexpr const char* DEFAULT_DUMP_DOM_TREE_PATH = "/storage/dump_dom_tree.json"; /* Default file path for font */ static constexpr const char* VECTOR_FONT_DIR = "/user/res/"; +static constexpr const char* NEW_FONT_DIR = "user/res/font_library/"; #else /* Default file path for screenshots */ static constexpr const char* DEFAULT_SCREENSHOT_PATH = "/storage/screenshot.bin";