Skip to content

Commit 3d9bd2a

Browse files
committed
fix extremely large font on certain reflowed pages
previously the zoom value from reflowing is calculated also with page height which actually does not make sense. Because reflowed pages will be shown in fit-to-width zoom mode not fit-to-height zoom mode so original page height has nothing to do with font size. With this patch font size in reflowing mode will be more consistent through the book.
1 parent b46fbf6 commit 3d9bd2a

2 files changed

Lines changed: 2 additions & 6 deletions

File tree

djvu.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -550,8 +550,7 @@ static int reflowPage(lua_State *L) {
550550
rh = (int)(kctx->bbox.y1 - kctx->bbox.y0);
551551

552552
double zoom = kctx->zoom*kctx->quality;
553-
float scale = ((2*zoom*kctx->dev_width) / (double)pw + \
554-
(2*zoom*kctx->dev_height) / (double)ph) / 2;
553+
float scale = (1.5*zoom*kctx->dev_width) / (double)pw;
555554
prect.w = pw * scale;
556555
prect.h = ph * scale;
557556
rrect.x = rx * scale;

ffi/mupdf.lua

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -761,10 +761,7 @@ function page_mt.__index:reflow(kopt_context)
761761
-- probe scale
762762
local zoom = kopt_context.zoom * kopt_context.quality
763763
M.fz_transform_rect(bounds, M.fz_identity)
764-
local scale = 1.0 / ((
765-
bounds[0].x1 / (2 * zoom * kopt_context.dev_width) +
766-
bounds[0].y1 / (2 * zoom * kopt_context.dev_height)
767-
) / 2 )
764+
local scale = (1.5 * zoom * kopt_context.dev_width) / bounds[0].x1
768765
-- store zoom
769766
kopt_context.zoom = scale
770767
-- do real scale

0 commit comments

Comments
 (0)