Leco 60 time, Roboto date with month name, taller bar with bottom-line empty blocks

- Time: FONT_KEY_LECO_60_BOLD_NUMBERS_AM_PM (emery), Leco 42 fallback
- Date: embedded Roboto Bold 36, format changed to "D MMM" (e.g. 23 MAY)
- Countdown bar: height 8 → 14px; empty blocks show bottom line only

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-23 19:08:42 +02:00
parent 0becfa0243
commit 8d509af3f8
3 changed files with 40 additions and 14 deletions
+8 -1
View File
@@ -26,7 +26,14 @@
"APPOINTMENT_MINUTES"
],
"resources": {
"media": []
"media": [
{
"type": "font",
"name": "FONT_ROBOTO_BOLD_36",
"file": "fonts/Roboto-Bold.ttf",
"maxHeight": 36
}
]
}
}
}
Binary file not shown.
+32 -13
View File
@@ -5,6 +5,12 @@ static TextLayer *s_time_layer;
static TextLayer *s_date_layer;
static Layer *s_bar_layer;
static Layer *s_battery_layer;
static GFont s_date_font;
static const char * const MONTHS[] = {
"JAN","FEB","MAR","APR","MAY","JUN",
"JUL","AUG","SEP","OCT","NOV","DEC"
};
static int s_battery_level = 100;
static int s_bar_fill = 30; // 030: minutes remaining
@@ -49,8 +55,8 @@ static void bar_draw(Layer *layer, GContext *ctx) {
graphics_context_set_fill_color(ctx, GColorWhite);
graphics_fill_rect(ctx, block, 0, GCornerNone);
} else {
graphics_context_set_stroke_color(ctx, GColorWhite);
graphics_draw_rect(ctx, block);
graphics_context_set_fill_color(ctx, GColorWhite);
graphics_fill_rect(ctx, GRect(x, bounds.size.h - 1, block_w, 1), 0, GCornerNone);
}
}
}
@@ -88,8 +94,8 @@ static void update_display(struct tm *tick_time) {
strftime(time_buf, sizeof(time_buf), "%H:%M", tick_time);
text_layer_set_text(s_time_layer, time_buf);
static char date_buf[6];
strftime(date_buf, sizeof(date_buf), "%d/%m", tick_time);
static char date_buf[8];
snprintf(date_buf, sizeof(date_buf), "%d %s", tick_time->tm_mday, MONTHS[tick_time->tm_mon]);
text_layer_set_text(s_date_layer, date_buf);
update_bar();
@@ -108,27 +114,39 @@ static void main_window_load(Window *window) {
Layer *root = window_get_root_layer(window);
GRect bounds = layer_get_bounds(root);
// Time — Leco 42, centred, flush to bar
s_time_layer = text_layer_create(GRect(0, 34, bounds.size.w, 52));
// Shared horizontal geometry matching the bar's block layout
int block_w = (bounds.size.w - 29) / 30;
int bar_w = 30 * block_w + 29;
int bar_x = (bounds.size.w - bar_w) / 2;
// Time — right-aligned to bar, almost touching bar
// Leco 60 is emery-exclusive; fall back to Leco 42 on other platforms
#ifdef PBL_PLATFORM_EMERY
s_time_layer = text_layer_create(GRect(bar_x, 18, bar_w, 68));
text_layer_set_font(s_time_layer, fonts_get_system_font(FONT_KEY_LECO_60_BOLD_NUMBERS_AM_PM));
#else
s_time_layer = text_layer_create(GRect(bar_x, 44, bar_w, 44));
text_layer_set_font(s_time_layer, fonts_get_system_font(FONT_KEY_LECO_42_NUMBERS));
#endif
text_layer_set_background_color(s_time_layer, GColorClear);
text_layer_set_text_color(s_time_layer, GColorWhite);
text_layer_set_font(s_time_layer, fonts_get_system_font(FONT_KEY_LECO_42_NUMBERS));
text_layer_set_text_alignment(s_time_layer, GTextAlignmentCenter);
text_layer_set_text_alignment(s_time_layer, GTextAlignmentRight);
text_layer_set_text(s_time_layer, "00:00");
layer_add_child(root, text_layer_get_layer(s_time_layer));
// Countdown bar — 30 blocks, right-to-left
s_bar_layer = layer_create(GRect(0, 90, bounds.size.w, 8));
s_bar_layer = layer_create(GRect(0, 90, bounds.size.w, 14));
layer_set_update_proc(s_bar_layer, bar_draw);
layer_add_child(root, s_bar_layer);
// Date — Leco 28 Light, right-aligned, flush to bar
s_date_layer = text_layer_create(GRect(0, 102, bounds.size.w, 34));
// Date — Roboto Bold 36 custom font, right-aligned to bar
s_date_font = fonts_load_custom_font(resource_get_handle(RESOURCE_ID_FONT_ROBOTO_BOLD_36));
s_date_layer = text_layer_create(GRect(bar_x, 106, bar_w, 42));
text_layer_set_background_color(s_date_layer, GColorClear);
text_layer_set_text_color(s_date_layer, GColorWhite);
text_layer_set_font(s_date_layer, fonts_get_system_font(FONT_KEY_LECO_28_LIGHT_NUMBERS));
text_layer_set_font(s_date_layer, s_date_font);
text_layer_set_text_alignment(s_date_layer, GTextAlignmentRight);
text_layer_set_text(s_date_layer, "01/01");
text_layer_set_text(s_date_layer, "1 JAN");
layer_add_child(root, text_layer_get_layer(s_date_layer));
// Battery icon — bottom right, only visible below 20%
@@ -142,6 +160,7 @@ static void main_window_unload(Window *window) {
text_layer_destroy(s_date_layer);
layer_destroy(s_bar_layer);
layer_destroy(s_battery_layer);
fonts_unload_custom_font(s_date_font);
}
static void init(void) {