KOptInterface: Keep returning nil in get*Boxes when we don't actually

get any boxes

Exposed by #7624, but we were arguably putting garbage in the Cache
before that anyway, so, it w<asn't all that great either ;p.

Fix #7850
pull/7856/head
NiLuJe 3 years ago committed by Frans de Jonge
parent a4dc7375f1
commit e4a333a980

@ -516,6 +516,9 @@ function KoptInterface:getReflowedTextBoxes(doc, pageno)
--kc:setDebug()
local fullwidth, fullheight = kc:getPageDim()
local boxes, nr_word = kc:getReflowedWordBoxes("dst", 0, 0, fullwidth, fullheight)
if not boxes then
return nil
end
DocCache:insert(hash, CacheItem:new{ rfpgboxes = boxes, size = 192 * nr_word }) -- estimation
return boxes
end
@ -541,6 +544,9 @@ function KoptInterface:getNativeTextBoxes(doc, pageno)
--kc:setDebug()
local fullwidth, fullheight = kc:getPageDim()
local boxes, nr_word = kc:getNativeWordBoxes("dst", 0, 0, fullwidth, fullheight)
if not boxes then
return nil
end
DocCache:insert(hash, CacheItem:new{ nativepgboxes = boxes, size = 192 * nr_word }) -- estimation
return boxes
end
@ -569,8 +575,11 @@ function KoptInterface:getReflowedTextBoxesFromScratch(doc, pageno)
local kc = self:createContext(doc, pageno)
kc:copyDestBMP(reflowed_kc)
local boxes, nr_word = kc:getNativeWordBoxes("dst", 0, 0, fullwidth, fullheight)
DocCache:insert(hash, CacheItem:new{ scratchrfpgboxes = boxes, size = 192 * nr_word }) -- estimation
kc:free()
if not boxes then
return nil
end
DocCache:insert(hash, CacheItem:new{ scratchrfpgboxes = boxes, size = 192 * nr_word }) -- estimation
return boxes
end
else

Loading…
Cancel
Save