From ff329ec93ddacae823704bac2d95e7a830a456b3 Mon Sep 17 00:00:00 2001 From: foswret Date: Sun, 3 May 2026 13:11:42 -0500 Subject: draw month title, move rendering of month as far down the page as possible --- src/calp.c | 29 ++++++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-) (limited to 'src/calp.c') diff --git a/src/calp.c b/src/calp.c index d1a1b62..af5be85 100644 --- a/src/calp.c +++ b/src/calp.c @@ -10,6 +10,11 @@ #define A4_WIDTH 210 #define A4_HEIGHT 297 +// Font Settings +#define FONT_FAMILY "Sans" +#define FONT_SIZE_NORMAL 10 +#define FONT_SIZE_LARGE 40 + int main (void) { // Definitions // ----------- @@ -17,7 +22,7 @@ int main (void) { double width = (A4_WIDTH / 25.4) * 72.0; double height = (A4_HEIGHT / 25.4) * 72.0; - //extern char *months[]; + extern char *months[]; int num_of_months = 12; extern int days_in_month[12]; @@ -38,7 +43,6 @@ int main (void) { - // Initialization // -------------- // Calculates measurements, stores them in dimensions struct. See "draw.h" @@ -52,23 +56,38 @@ int main (void) { cairo_surface_create_similar(surface, CAIRO_CONTENT_COLOR_ALPHA, dim.day_width, dim.day_height); cairo_t *cd = cairo_create(day); + // General rectangle struct for positioning. Used whenever dimensions need + // to be passed to another function + // PangoRectangle logical_extents; + // Fill background with white color cairo_set_source_rgb (paper, 255.0, 255.0, 255.0); fill_bg(paper); - + + + + // Construction + // ------------ // Print dimensions, for debugging //print_dimensions(&dim); // Draw all months for (int i = 0; i < num_of_months; i++) { + + cairo_set_source_rgb (paper, 0.0, 0.0, 0.0); + draw_month_title(paper, &dim, months[i]); + + calculate_minimum_rows(day_of_week(1, i + 1, year), days_in_month[i], &dim); + draw_month(paper, cd, day, &dim, days_in_month[i], day_of_week(1, i + 1, year)); - printf("%d\n", day_of_week(1, i + 1, year)); - // Goes to next page in pdf + + // Go to next page in pdf cairo_show_page(paper); } + // Clean up // -------- -- cgit v1.2.3