Printable Calendar Generator
2026-05-27
A project that has caught my attention recently has been a printable calendar generator. Calendars that you can typically pick up in the store are nice, but what if it does not fit your needs? What if you want to create a different layout? Printing out your calendars can also be more economical. One can obviously maintain a digital calendar (which I do), but the physicality of nurturing these “living documents” merits consideration. This program is called calp, which is a shorthand for calendar print. Just another minimal, UNIX-y name, even though this project doesn’t profess to adhere to strict minimalist conventions. Everyone should be weary of an imaginary date in the future, similar to Y2K, where pretentious people run out of short 3-4 letter names to call their handcrafted C programs.
An alternative to this project is Callirhoe by geotz. Callirhoe floors calp in terms of sheer features, and is written in Python. I am mostly working on calp for my own amusement and using it as an exercise in program design. I have certainly learned a lot so far!
The source can be viewed at https://git.foswret.com/calp.
Backend
The program is written in C with the aid of the PangoCairo library. Cairo is a graphics rendering library, and Pango is a text rendering engine that works nicely with Cairo.
I initially tackled this project in late 2025, but have since rewritten it in this first half of 2026. I did this mostly to rectify issues of program design that I thought would be better dealt with by doing a rewrite.
Abstraction
In order to make calendar rendering customizable and reproducable, the position of “objects” on the page are handled through discrete functions. Their position and dimensions, referred to as “extents” by both the Pango and Cairo APIs, are calculated at the beginning of runtime and all at once. These extents are centered around the size of paper specified, in order to make sure that everything fits.
As of writing, this project is in its infant stages. I want to eventually work on:
- Color Palette support
- Holiday-file parsing
- .ics file input
- Moon phases, sunrise/sunset icons
- Custom layout support
The biggest hurdle is the mechanisms by which text files will be parsed. I haven’t yet decided if a home-grown implementation or a library like ezini or inih would be better.
I have come to see that implementing certain features actually involve some cellestial body calculations. Two books that seem to be invaluable resources are “Astronomy on the Personal Computer” (2000) and “Practical Astronomy with your Calculator or Spreadsheet” (2011). I found a very beautiful moon-phase calculator by Devine of 100 Rabbits.