I'm working with building pdf:s via reportlab and I'm currently trying to clean up the code. I want to build a light little class for handling the fonts (accessing and registering appropriately). I would like all available fonts to behave as properties and register themselves (a method call) when they are first accessed.
The list of available-fonts is a simple tuple of strings like so:
available_fonts = (
"Roboto-Regular",
"Roboto-Bold",
"Roboto-Italic",
"Roboto-Light",
"Roboto-LightItalic",
"Roboto-Thin",
"Roboto-ThinItalic"
)
My python sense tells me that there is a neat solution to this :). I'm thinking of methods with the @property decorator but I would prefer not to have to write the methods for each font, it seems non-dry and harder to maintain.
Help would be much appreciated!