View Single Post
Old 04-28-2012, 08:04 AM   #318
NuPogodi
Connoisseur
NuPogodi knows the complete value of PI to the endNuPogodi knows the complete value of PI to the endNuPogodi knows the complete value of PI to the endNuPogodi knows the complete value of PI to the endNuPogodi knows the complete value of PI to the endNuPogodi knows the complete value of PI to the endNuPogodi knows the complete value of PI to the endNuPogodi knows the complete value of PI to the endNuPogodi knows the complete value of PI to the endNuPogodi knows the complete value of PI to the endNuPogodi knows the complete value of PI to the end
 
Posts: 58
Karma: 31942
Join Date: Feb 2012
Device: Kindle 3, Tolino Shine, Kobo Glo
Thanks for new release. I do not need add 'lost' extentions by myself anymore. So I've made only a couple of minor improvements which make my life more comportable:

1. The default font in crereader.lua (line 54, "FreeSerif") is still worth of replacing by "Droid Sans"

2. As zip-extentions are now allowed, crereader.lua feeds non-existing zip.css to crengine. The best way to solve this problem is to unzip the selected file & to look for the extention of the contained filestream. As I have no ideas how to realize this feature in terms of lua, I've solved this problem in a 'dirty' way, i.e. I've added few lines which allow me to localize the needed style.css for files like "anyfile.extention.zip"

Just insert in crereader.lua (line 34, just before your comment "these two format use the same css file")
Quote:
-- try to find double extentions like filename.extention.zip
if file_type == "zip" then
-- store filename without zip-extention to fn
local fn = string.lower(string.sub(filename,0,-4))
-- if no double extention then default file_type
file_type = string.lower(string.match(fn, ".+%.([^.]+)") or "fb2")
end
BTW, I'm afraid that already reported problem of the font selection is somehow related to absent css-styles. At least, adding the above code solves this problem for *.fb2.zip-files (see absolutely adequate screenshot, the cff-fonts are not deleted)

3. It should also be useful (say, for illustration & debug purposes) to make screenshots. I've again used the 'dirty' method - just added a hotkey (Shift-P) which stored the /dev/fb0-content to raw-file (crereader.lua, line 315)
Quote:
self.commands:del(KEY_P, MOD_SHIFT, "P") -- screenshot

-- make screenshot
self.commands:add(KEY_P, MOD_SHIFT, "P",
"make screenshot",
function(cr)
os.execute("mkdir ".."/mnt/us/kindlepdfviewer/screenshots")
local d = os.date("%Y%m%d%H%M%S")
showInfoMsgWithDelay("making screenshot...", 2000, 1)
os.execute("dd ".."if=/dev/fb0 ".."of=/mnt/us/kindlepdfviewer/screenshots/" .. d .. ".raw")
end
But I still hope that I'll have an opportunity to make screenshots directly (*.png or *.bmp), rather than raw-files that require succeeding conversion.

Last edited by NuPogodi; 04-28-2012 at 08:22 AM.
NuPogodi is offline   Reply With Quote