Fix font scaling issues; prepare date to be moved depending on time width

This commit is contained in:
2026-03-19 00:26:07 -04:00
parent 231d35e580
commit 01aa8a48b9
3 changed files with 8 additions and 7 deletions

View File

@@ -572,8 +572,9 @@
"type": "bitmap"
},
{
"characterRegex": "[:0-9]",
"file": "fonts/RetroComputerTime.ttf",
"name": "FONT_RETRO_COMPUTER_32",
"name": "FONT_RETRO_COMPUTER_34",
"targetPlatforms": [
"emery",
"gabbro"

View File

@@ -197,21 +197,21 @@ static void main_window_load(Window *window) {
bitmap_layer_set_bitmap(s_guy_butt_layer, s_butt_current);
// format time layer
s_time_layer = text_layer_create(GRect(0, PBL_IF_ROUND_ELSE(110, 94), PBL_IF_ROUND_ELSE(260, 200), 32));
s_time_layer = text_layer_create(GRect(0, PBL_IF_ROUND_ELSE(109, 93), PBL_IF_ROUND_ELSE(260, 200), 34));
text_layer_set_background_color(s_time_layer, GColorClear);
text_layer_set_font(s_time_layer, s_custom_font);
text_layer_set_text_alignment(s_time_layer, GTextAlignmentCenter);
// format date layer
s_date_layer = text_layer_create(GRect(PBL_IF_ROUND_ELSE(20, 6), PBL_IF_ROUND_ELSE(120, 104), PBL_IF_ROUND_ELSE(260, 200), 14));
s_date_layer = text_layer_create(GRect(0, PBL_IF_ROUND_ELSE(121, 105), PBL_IF_ROUND_ELSE(69, 39), 14));
text_layer_set_background_color(s_date_layer, GColorClear);
text_layer_set_font(s_date_layer, fonts_get_system_font(FONT_KEY_GOTHIC_14));
text_layer_set_text_alignment(s_date_layer, GTextAlignmentLeft);
text_layer_set_text_alignment(s_date_layer, GTextAlignmentCenter);
// create time bar layer
GRect time_bar_frame = GRect(0, PBL_IF_ROUND_ELSE(115, 99), PBL_IF_ROUND_ELSE(260, 200), 30);
s_time_bar_layer = layer_create(time_bar_frame);
s_time_bar_layer = layer_create(GRect(0, PBL_IF_ROUND_ELSE(115, 99), PBL_IF_ROUND_ELSE(260, 200), 30));
layer_set_update_proc(s_time_bar_layer, time_bar_update_proc);
text_layer_set_text_alignment(s_date_layer, GTextAlignmentCenter);
// add layers as children to window
layer_add_child(window_layer, bitmap_layer_get_layer(s_guy_head_layer));
@@ -273,7 +273,7 @@ static void init() {
s_random_color_next = s_dark_bg_colors[rand() % s_color_count];
// load custom font
s_custom_font = fonts_load_custom_font(resource_get_handle(RESOURCE_ID_FONT_RETRO_COMPUTER_32));
s_custom_font = fonts_load_custom_font(resource_get_handle(RESOURCE_ID_FONT_RETRO_COMPUTER_34));
// show the Window on the watch, with animated=true
window_stack_push(s_main_window, true);