Comic Managemer: Improving the other exporters.

After finally having dealt with school, I wanted to spend some time on getting the other comics exporters up to snuff, after getting the ACBF exporter so far as I did.

This was partially motivated by me finding some extra information on ComicBookInfo and ComicInfo.xml, as well as discovering that both main catalogueing software that used either(ComicBookLovers and ComicBookRack respectively) are dead. Callibre, as to be expected, acknowledges neither these or CoMet or ACBF as metadata files, though there is a plugin that supports the ComicBookInfo json and the ComicInfo.xml files (Ideally someone would add CoMet and ACBF to that, but I am not really interested in installing the monster that is Callibre on my device right now).

I just went and modified the exporters for these two files so they’d be a bit more correct and left it at that. But, that leaves one more exporter…

Epub Export Improvements

So, the Comic Project Management Tools always contained an EPUB exporter. It was made by making something nice in Sigil, and copying the structure. This time around I decided to actually sit down and read the EPUB spec and figure out what could be done better.

EPUB structure.

So, EPUB is a zip that contains a mimetype, a container description, a bunch of xhtml files, a navigation file and a metadata file.

In 3.0 they’re phasing out the old style navigation file and introducing a new one, so I updated both so they can handle title pages like ACBF can.

For the metadata, there was a bunch of things I did wrong, like using the identifier improperly. Now the identifier uses the same UUID as ACBF does, there is a modified timestamp and a publishing timestamp that are both the proper value, and the author role is using the marc relator values.

As well, the series metadata is embedded properly(as a title designated ‘collection’), though not many thing can read this value.

Then for Comics, EPUB has two seperate mechanisms: Pre-pagination and Region Navigation.

Pagination and Spreads

Fixed Layout is something that was implemented for comics, children books and digitizing magazines. Looking around there seems to be some designers who rather want it because they don’t like this reflowable aspect of epub, stating there is no need for the reader to modify anything. I, someone who is dyslexic and really benefits from larger letters, don’t really know how to feel about people like this :/

Either way, it’s a bit insane to expect reading devices and program to layout comics by themselves, so it makes sense to define comic pages as pre-paginated.

To do that, you need to define rendition meta-properties in the metadata section. Then, for each page, you need to define that, if they are laid out in a spread(two pages next to one another), whether the page should go left, right, or be a total spread.

Showing two pages in readium. The pre-pagination ensures that the pages are set side by side in a spread despite being in seperate xhtml files.

To figure out the latter, the exporter checks the kra files’ keywords for “epub_spread”. The rest is figured out from the reading direction defined in the project metadata.

A “spread” page shown in Readium. Unlike the two separate pages, this one needs to fill both sides. To figure out which pages are like this, I implemented the “epub_spread” keyword to identify them. It’s better to let the artist handle this manually, because trying to figure it out yourself can lead to a lot of presumptions that may not always be correct.

The other thing that is necessary is to define a viewport meta in each xhtml file(or define a standard one for the whole document, but that doesn’t work for spreads). The epub exporter used to have both an image and a page number, but I removed the latter so that the image dimensions can be used for the viewport.

As shown in the screenshots above, Readium supports pre-pagination just fine and everything looks nice and pretty in it.

Region Navigation

The second thing EPUB 3 has for comics is region-based navigation.

This is basically an extra EPUB 3 navigation document(specifically a ‘data-nav’ document), but instead of a nav with a list of chapter entries, it is a nav with a list of panels, and the location of their bounding box, and, as a sublist, the list of text-areas/balloons and the location of their bounding box.

This is not unlike the ACBF frames and textarea definitions, and I was able to reuse all the variables I had put into place for that to program region navigation generation within 2 hours.

The big differences between EPUB and ACBF in this are that EPUB does not support storing a text field per textarea, it uses percentages instead of pixels and has far fewer types to the text, which are also so significantly different that I just didn’t implement anything beyond ‘panel’ and ‘text-area’. More will have to wait until we can add metadata to vector objects.

Like ACBF, EPUB regions can have a background color entry(a meta tag with ‘ahl:primary-color’ as property), so I implemented that for panels.

Sadly, I haven’t figured out whether there is an easily accessible reader software that supports this, or if there is one out there that does at all, but the epub passes epubCheck.


The final bit I did was run the exported file through epub check. I had to modify some entries and fix some IDs. The biggest thing necessary was that the mimetype file needs to be the first thing in the zipfile, so I had to modify the zipfile generation so that it added files just after they were made instead of packaging everything at the end.

Eventually though…

Epub Check validating the Generated File

There’s still more that can be done, like for example accessibility metadata entries, but for now I am pretty pleased with this.

It is in master, so Krita 4.2 will carry the updated plugin!

Loading Facebook Comments ...

Leave a Reply

Your email address will not be published. Required fields are marked *