summaryrefslogtreecommitdiff
path: root/source/html/epub-doc.c
diff options
context:
space:
mode:
authorTor Andersson <tor.andersson@artifex.com>2016-11-14 13:03:07 +0100
committerTor Andersson <tor.andersson@artifex.com>2016-11-14 13:23:57 +0100
commit2216f9402a9ddf232e15fdd508b9123011af8bd3 (patch)
tree3b4e44be0e332bb9d957864fcde41057ed0fcb79 /source/html/epub-doc.c
parent018253cfc8a34805c4fc1e0f955e3696db60886a (diff)
downloadmupdf-2216f9402a9ddf232e15fdd508b9123011af8bd3.tar.xz
Add/fix page coordinates to link targets.
Correctly transformed target coordinates for PDF. Target coordinates for EPUB and HTML.
Diffstat (limited to 'source/html/epub-doc.c')
-rw-r--r--source/html/epub-doc.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/source/html/epub-doc.c b/source/html/epub-doc.c
index a30fbcd3..f5f3ca67 100644
--- a/source/html/epub-doc.c
+++ b/source/html/epub-doc.c
@@ -35,7 +35,7 @@ struct epub_page_s
};
static int
-epub_resolve_link(fz_context *ctx, fz_document *doc_, const char *dest)
+epub_resolve_link(fz_context *ctx, fz_document *doc_, const char *dest, float *xp, float *yp)
{
epub_document *doc = (epub_document*)doc_;
epub_chapter *ch;
@@ -54,7 +54,11 @@ epub_resolve_link(fz_context *ctx, fz_document *doc_, const char *dest)
/* Search for a matching fragment */
float y = fz_find_html_target(ctx, ch->html, s+1);
if (y >= 0)
- return ch->start + y / ch->page_h;
+ {
+ int page = y / ch->page_h;
+ if (yp) *yp = y - page * ch->page_h;
+ return ch->start + page;
+ }
}
return ch->start;
}
@@ -68,7 +72,7 @@ epub_update_outline(fz_context *ctx, fz_document *doc, fz_outline *node)
{
while (node)
{
- node->page = epub_resolve_link(ctx, doc, node->uri);
+ node->page = epub_resolve_link(ctx, doc, node->uri, NULL, NULL);
epub_update_outline(ctx, doc, node->down);
node = node->next;
}