diff options
Diffstat (limited to 'src/calp.c')
| -rw-r--r-- | src/calp.c | 43 |
1 files changed, 26 insertions, 17 deletions
@@ -3,6 +3,8 @@ #include <stdio.h> #include <stdlib.h> #include <stdbool.h> +#include <langinfo.h> +#include <locale.h> #include <cairo/cairo-pdf.h> #include <pango/pangocairo.h> @@ -10,6 +12,7 @@ #include "date.h" #include "color.h" #include "image.h" +#include "ezini.h" // Metric #define A4_WIDTH 210 @@ -33,10 +36,27 @@ int main (void) { width = (width / 25.4) * 72.0; height = (height / 25.4) * 72.0; - extern char *months[]; + //extern char *months[]; + + int num_of_months = 12; + char *months[num_of_months]; extern int days_in_month[12]; + const nl_item nl_abmons[12] = {ABMON_1, ABMON_2, ABMON_3, ABMON_4, + ABMON_5, ABMON_6, ABMON_7, ABMON_8, + ABMON_9, ABMON_10, ABMON_11, ABMON_12}; + const nl_item nl_months[12] = {MON_1, MON_2, MON_3, MON_4, MON_5, MON_6, + MON_7, MON_8, MON_9, MON_10, MON_11, MON_12}; + + int i; + setlocale(LC_ALL, ""); + for (i = 0; i < 12; i++) { + printf("%d\t%s\t%s\n", i+1, nl_langinfo(nl_abmons[i]), nl_langinfo(nl_months[i])); + months[i] = nl_langinfo(nl_months[i]); + } + + // Create dimensions struct to hold measurements struct dimensions dim; @@ -48,7 +68,7 @@ int main (void) { // Leap year adjustment: increment February day count by one if // it is a leap year. - int year = 3043; + int year = 14; if (isleap(year)) { days_in_month[1]++; } @@ -92,20 +112,9 @@ int main (void) { // Construction // ------------ - // Print dimensions, for debugging - - if (verbose_output) { - print_dimensions(&dim); - } - - - // Range of months to be rendered (Default: Full calendar year, 12 months) - int first_month = 0; - int end_month = num_of_months; - - + // Month generation loop - for (int i = first_month; i < end_month; i++) { + for (int i = 0; i < num_of_months; i++) { // Initialize month struct month.first_day = day_of_week(1, i + 1, year); month.num_of_days = days_in_month[i]; @@ -118,8 +127,8 @@ int main (void) { cairo_surface_t *header = cairo_surface_create_similar(surface, CAIRO_CONTENT_COLOR_ALPHA, dim.header_width, dim.header_height); cairo_t *ch = cairo_create(header); - //set_color(ch, BLUE); - //fill_bg(ch); + + set_color(ch, BLACK); draw_month_title(ch, &dim, "Sans", 40, months[i]); |
