Browse Source

kopt: allow pdf auto straighten

pull/7775/merge
yparitcher 2 months ago
committed by poire-z
parent
commit
888802f618
2 changed files with 12 additions and 11 deletions
  1. +3
    -3
      frontend/document/koptinterface.lua
  2. +9
    -8
      frontend/ui/data/koptoptions.lua

+ 3
- 3
frontend/document/koptinterface.lua View File

@ -334,7 +334,7 @@ end
function KoptInterface:renderPage(doc, pageno, rect, zoom, rotation, gamma, render_mode, hinting)
if doc.configurable.text_wrap == 1 then
return self:renderReflowedPage(doc, pageno, rect, zoom, rotation, render_mode, hinting)
elseif doc.configurable.page_opt == 1 then
elseif doc.configurable.page_opt == 1 or doc.configurable.auto_straighten > 0 then
return self:renderOptimizedPage(doc, pageno, rect, zoom, rotation, render_mode, hinting)
else
return Document.renderPage(doc, pageno, rect, zoom, rotation, gamma, render_mode, hinting)
@ -439,7 +439,7 @@ function KoptInterface:hintPage(doc, pageno, zoom, rotation, gamma, render_mode)
if doc.configurable.text_wrap == 1 then
self:hintReflowedPage(doc, pageno, zoom, rotation, gamma, render_mode, true)
elseif doc.configurable.page_opt == 1 then
elseif doc.configurable.page_opt == 1 or doc.configurable.auto_straighten > 0 then
self:renderOptimizedPage(doc, pageno, nil, zoom, rotation, gamma, render_mode, true)
else
Document.hintPage(doc, pageno, zoom, rotation, gamma, render_mode)
@ -487,7 +487,7 @@ end
function KoptInterface:drawPage(doc, target, x, y, rect, pageno, zoom, rotation, gamma, render_mode)
if doc.configurable.text_wrap == 1 then
self:drawContextPage(doc, target, x, y, rect, pageno, zoom, rotation, render_mode)
elseif doc.configurable.page_opt == 1 then
elseif doc.configurable.page_opt == 1 or doc.configurable.auto_straighten > 0 then
self:drawContextPage(doc, target, x, y, rect, pageno, zoom, rotation, render_mode)
else
Document.drawPage(doc, target, x, y, rect, pageno, zoom, rotation, gamma, render_mode)

+ 9
- 8
frontend/ui/data/koptoptions.lua View File

@ -123,7 +123,7 @@ In 'semi-auto' and 'manual' modes, you may need to define areas once on an odd p
return optionsutil.enableIfEquals(configurable, "text_wrap", 0)
end,
buttonprogress = true,
fine_tune = true,
more_options = true,
values = {0, 12, 24, 36, 48, 60, 72, 84},
default_pos = 4,
default_value = 36,
@ -145,7 +145,7 @@ In 'semi-auto' and 'manual' modes, you may need to define areas once on an odd p
return optionsutil.enableIfEquals(configurable, "text_wrap", 0)
end,
buttonprogress = true,
fine_tune = true,
more_options = true,
values = {0, 12, 24, 36, 48, 60, 72, 84},
default_pos = 4,
default_value = 36,
@ -569,14 +569,15 @@ This can also be used to remove some gray background or to convert a grayscale o
{
name = "auto_straighten",
name_text = _("Auto Straighten"),
toggle = {_("0 deg"), _("5 deg"), _("10 deg")},
values = {0, 5, 10},
toggle = {_(""), _(""), _("10°"), _("15°"), _("25°")},
values = {0, 5, 10, 15, 25},
event = "DummyEvent",
args = {0, 5, 10, 15, 25},
more_options = true,
default_value = DKOPTREADER_CONFIG_AUTO_STRAIGHTEN,
show = false, -- does not work (and slows rendering)
enabled_func = function(configurable)
return optionsutil.enableIfEquals(configurable, "text_wrap", 1)
end,
name_text_hold_callback = optionsutil.showValues,
help_text = _([[Attempt to automatically straighten tilted source pages.
Will rotate up to specified value.]]),
},
{
name = "detect_indent",

Loading…
Cancel
Save