GNOME Bugzilla – Bug 619407
Evince ignores page titles in djvu files
Last modified: 2013-05-08 19:52:28 UTC
Created attachment 161760 [details] A djvu file with alternate page numbering. The DJVU format allows to specify so called "titles" for document pages. These titles can be used to specify alternate page numbering, so that page numbers displayed in the viewer GUI correspond to those used in the book itself. Previously page titles were ignored by DJVU viewers, but now both djview and windjview support them pretty well. However, evince still ignores page titles and numbers pages sequentially from the beginning as if titles were not specified. Moreover, if a document has page titles, these titles can be used as references to the corresponding pages in the TOC. I am actually not sure if this is the correct behavior (DJVU spec is a bit obscure here), but at least in djview such references work as expected. In evince they, of course, are ignored or lead to wrong pages. See in the attachment a small djvu file with an excerption of diffferently named pages from the same book and the TOC where pages are referenced via their titles. I am also attaching a djvused script Which I used to produce this file.
Created attachment 161761 [details] The djvused script I've used to specify page titles and TOC
Alexey, sorry for the late response. I am just now taking care of the djvu backend. I have added support for the page titles, so evince now shows them, but I have an issue with the test file. You are using page titles as links, and afaik, this is not specified in the djvu spec. (looking version 3) there it says that href is either an url or a # followed by either a file identifier, or a page number, NOT a page title. I know that djview supports this test file, but there is some undefinition in the djvu spec.
Created attachment 236634 [details] [review] Add support for page labels Carlos, this patch adds support for page labels.
Review of attachment 236634 [details] [review]: Just a few comments, not a real review of the functionality :-) ::: backend/djvu/djvu-document.c @@ +216,3 @@ + if (djvu_document->n_pages > 0) { + djvu_document->fileinfo_pages = g_new0 (DjvuFileInfo, djvu_document->n_pages); + djvu_document->file_ids = g_hash_table_new (g_str_hash, g_str_equal); Is the patch incomplete? I don't see a file_ids member of DjvuDocument either in master or the patch? Also the hash table seems unused in the rest of the patch? @@ +417,3 @@ + + g_return_val_if_fail (page->index >= 0 && page->index < djvu_document->n_pages, NULL); + I'd use g_assert(), since this should never be called out-of-range (internal function). @@ +483,3 @@ + if (djvu_document->fileinfo_pages) + g_free (djvu_document->fileinfo_pages); + g_free already is NULL safe. ::: backend/djvu/djvu-document.h @@ +30,2 @@ typedef struct _DjvuDocument DjvuDocument; +typedef struct ddjvu_fileinfo_s DjvuFileInfo; Why this typedef? The existing code uses the existing djvu types as-is.
Created attachment 240602 [details] [review] ups. updated patch Oh... you are right... the hash_table line was not supposed to be there... I just missed it when rebasing the work. All comments addressed.
Review of attachment 240602 [details] [review]: I don't understand why the file title is the page label, is this only when there's a different file per page?
Carlos, each page is represented by a entry in the fileinfo array, which can be embedded in the djvu file or a different file. I mean, even if we only have one djvu which embeds all the images, we have one entry per page. The title is then the title of the page, but the most similar concept in evince would be the labels. For instance, in the test file, the page titles are iv, vi, etc... so they coincide with page labels (and djvuview uses them as labels also). Hope that makes sense
Comment on attachment 240602 [details] [review] ups. updated patch Ok. Thanks, and sorry for the delay reviewing it.