diff --git a/reader.lua b/reader.lua index 86dca3ab3..9d356ea8c 100755 --- a/reader.lua +++ b/reader.lua @@ -52,14 +52,11 @@ else end end -local Device = require("device") -local dpi_override = G_reader_settings:readSetting("screen_dpi") -if dpi_override ~= nil then - Device:setScreenDPI(dpi_override) -end - -local CanvasContext = require("document/canvascontext") -CanvasContext:init(Device) +-- should check DEBUG option in arg and turn on DEBUG before loading other +-- modules, otherwise DEBUG in some modules may not be printed. +local dbg = require("dbg") +if G_reader_settings:isTrue("debug") then dbg:turnOn() end +if G_reader_settings:isTrue("debug") and G_reader_settings:isTrue("debug_verbose") then dbg:setVerbose(true) end -- option parsing: local longopts = { @@ -86,12 +83,6 @@ local function showusage() print("See http://github.com/koreader/koreader for more info.") end --- should check DEBUG option in arg and turn on DEBUG before loading other --- modules, otherwise DEBUG in some modules may not be printed. -local dbg = require("dbg") -if G_reader_settings:isTrue("debug") then dbg:turnOn() end -if G_reader_settings:isTrue("debug") and G_reader_settings:isTrue("debug_verbose") then dbg:setVerbose(true) end - local Profiler = nil local ARGV = arg local argidx = 1 @@ -121,6 +112,15 @@ while argidx <= #ARGV do end end +local Device = require("device") +local dpi_override = G_reader_settings:readSetting("screen_dpi") +if dpi_override ~= nil then + Device:setScreenDPI(dpi_override) +end + +local CanvasContext = require("document/canvascontext") +CanvasContext:init(Device) + local ConfirmBox = require("ui/widget/confirmbox") local QuickStart = require("ui/quickstart") local UIManager = require("ui/uimanager")