diff options
| author | foswret | 2026-05-03 13:11:42 -0500 |
|---|---|---|
| committer | foswret | 2026-05-03 13:11:42 -0500 |
| commit | ff329ec93ddacae823704bac2d95e7a830a456b3 (patch) | |
| tree | 18de0192eae0b946c763aaccabd7467d96895ee8 /src/calp.c | |
| parent | 03ed4535c8489700058fb283837752035f3cf83d (diff) | |
draw month title, move rendering of month as far down the page as possible
Diffstat (limited to 'src/calp.c')
| -rw-r--r-- | src/calp.c | 29 |
1 files changed, 24 insertions, 5 deletions
@@ -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 // -------- |
