From 866866f9d08e834c9388e119ef65958633b5c5ea Mon Sep 17 00:00:00 2001 From: Lu Wang Date: Tue, 18 Sep 2012 02:49:23 +0800 Subject: [PATCH] more precise annot link border --- src/HTMLRenderer/general.cc | 39 +++++++++++++++++++++---------------- 1 file changed, 22 insertions(+), 17 deletions(-) diff --git a/src/HTMLRenderer/general.cc b/src/HTMLRenderer/general.cc index ca9a800..a048708 100644 --- a/src/HTMLRenderer/general.cc +++ b/src/HTMLRenderer/general.cc @@ -56,6 +56,7 @@ HTMLRenderer::~HTMLRenderer() } static GBool annot_cb(Annot *, void *) { + return true; return false; }; @@ -296,28 +297,16 @@ void HTMLRenderer::processLink(AnnotLink * al) html_fout << ""; } - double x1,x2,y1,y2; - al->getRect(&x1, &y1, &x2, &y2); - - x1 = default_ctm[0] * x1 + default_ctm[2] * y1 + default_ctm[4]; - y1 = default_ctm[1] * x1 + default_ctm[3] * y1 + default_ctm[5]; - x2 = default_ctm[0] * x2 + default_ctm[2] * y2 + default_ctm[4]; - y2 = default_ctm[1] * x2 + default_ctm[3] * y2 + default_ctm[5]; - - // TODO, in html, border width is included - html_fout << "
getBorder(); if(border) { - double w = border->getWidth(); - if(w > 0) + width = border->getWidth() * (param->zoom); + if(width > 0) { - html_fout << "border-width:" << _round(w) << "px;"; + html_fout << "border-width:" << _round(width) << "px;"; auto style = border->getStyle(); switch(style) { @@ -370,6 +359,22 @@ void HTMLRenderer::processLink(AnnotLink * al) html_fout << "border-style:none;"; } + double x1,x2,y1,y2; + al->getRect(&x1, &y1, &x2, &y2); + + x1 = default_ctm[0] * x1 + default_ctm[2] * y1 + default_ctm[4]; + y1 = default_ctm[1] * x1 + default_ctm[3] * y1 + default_ctm[5]; + x2 = default_ctm[0] * x2 + default_ctm[2] * y2 + default_ctm[4]; + y2 = default_ctm[1] * x2 + default_ctm[3] * y2 + default_ctm[5]; + + // TODO: check overlap when x2-x1-width<0 or y2-y1-width<0 + html_fout << "position:absolute;" + << "left:" << _round(x1 - width/2) << "px;" + << "bottom:" << _round(y1 - width/2) << "px;" + << "width:" << _round(x2-x1-width) << "px;" + << "height:" << _round(y2-y1-width) << "px;"; + + html_fout << "\">
"; if(dest_str != "")