10. Automatic cover image generation for ePub
Last change to the code was made during my last day at OUCS. I have added an automatic generation of cover images for ePub documents. This takes an image template and adds into the image the name of the author and the title of the publication, which are extracted from the <teiHeader> tag. To do this, I am using Java's ImageIO and Graphics classes from javax and awt libraries. Currently it tries to fit into the image the maximum possible font (but not higher than the maximum set by maxAuthorFontSize and maxTitleFontSize variables). It allows 1 line for author and 2 lines for title. After the title and author fit into the image's width, it tries to align them to the center both horizontally and vertically. For vertical alingment, you need to define the vertical size of the region inside the code, where the marginY variable is being calculated.