diff options
| author | Martin Stensgård <mastensg@mastensg.net> | 2025-04-20 16:45:23 +0200 |
|---|---|---|
| committer | Martin Stensgård <mastensg@mastensg.net> | 2025-04-20 16:45:23 +0200 |
| commit | b09f0e832dd0fef91aa8fa1b4e5e8625935eb307 (patch) | |
| tree | 9ecf04aae74fc08f34686b743b0fa119792ea10b | |
| parent | 9917ab8b4721042f5550aa10b83498782bb357bd (diff) | |
neue haas grotesk grid
| -rw-r--r-- | font/NHaasGroteskTXPro-55Rg.ttf | bin | 0 -> 278544 bytes | |||
| -rw-r--r-- | opplysning.c | 22 |
2 files changed, 16 insertions, 6 deletions
diff --git a/font/NHaasGroteskTXPro-55Rg.ttf b/font/NHaasGroteskTXPro-55Rg.ttf Binary files differnew file mode 100644 index 0000000..6164103 --- /dev/null +++ b/font/NHaasGroteskTXPro-55Rg.ttf diff --git a/opplysning.c b/opplysning.c index e8bc6df..5c2af13 100644 --- a/opplysning.c +++ b/opplysning.c @@ -131,7 +131,9 @@ main(void) int ncp = 0; int *cp = LoadCodepoints(the_alphabet, &ncp); Font font_h = LoadFontEx("font/adventpro-bold.ttf", 60, cp, ncp); - Font font_p = LoadFontEx("font/adventpro-semibold.ttf", 40, cp, ncp); + // Font font_p = LoadFontEx("font/adventpro-semibold.ttf", 40, cp, ncp); + Font font_p = + LoadFontEx("font/NHaasGroteskTXPro-55Rg.ttf", 40, cp, ncp); UnloadCodepoints(cp); Color bg = RAYWHITE; @@ -147,7 +149,8 @@ main(void) BeginDrawing(); ClearBackground(bg); - line(sw / 2 - 60, 0, font_h, fg, ts); + Vector2 v2_ts = MeasureTextEx(font_h, ts, font_h.baseSize, 0); + line(sw / 2 - v2_ts.x / 2, 0, font_h, fg, ts); int y = 0; int year = 0, month = 0, day = 0; @@ -163,14 +166,21 @@ main(void) snprintf(s, sizeof(s), "%s %u. %s", ukedag[e->wday], e->day, maaned[e->month]); - line(20, y += 50, font_h, hd, s); + line(25, y += 50, font_h, hd, s); y += 20; } { + y += 40; char s[64] = {0}; - snprintf(s, sizeof(s), "%02u:%02u %s", e->hour, - e->minute, e->title); - line(25, y += 40, font_p, fg, s); + snprintf(s, sizeof(s), "%02u:%02u", e->hour, + e->minute); + Vector2 m = MeasureTextEx(font_p, s, + font_p.baseSize, 0); + line(2.8 * font_p.baseSize - m.x, y, font_p, fg, + s); + + line(3.5 * font_p.baseSize, y, font_p, fg, + e->title); } } EndDrawing(); |
