View Full Version : Open source LRF viewer


kovidgoyal
09-22-2007, 09:13 PM
libprs500 0.4.1 has an open source cross-platform LRF viewer that supports hyphenation (for english) and uses real fonts instead of the SONY's limited three. Use it from the command line (for the moment) by

lrfviewer mybook.lrf


Note that this is an initial implementation and so its bound to be buggy. I've only tested it with LRF files generated by recent versions of libprs500. Also the current implementation is slow/memory intensive, so I doubt its suitable for use on handhelds. I will work on speeding it up when I get the time.

It doesn't support the DrawChar tag as yet (Used to make drop-caps) and the search functionality is not implemented.

JSWolf
09-22-2007, 10:11 PM
Is it going to support full justification instead of left justification?

Bob Russell
09-22-2007, 10:30 PM
Wonderful.... this provides a spark of hope for long term readability of the non-DRM'd BBeB files! :)

kovidgoyal
09-22-2007, 11:04 PM
Is it going to support full justification instead of left justification?

Not sure what you mean by "full" justification. It already supports hyphenation.

JSWolf
09-22-2007, 11:06 PM
Not sure what you mean by "full" justification. It already supports hyphenation.
The Sony Reader supports full justification but not hyphenation.

Full justification is where the right edge is not ragged. Like in most dead tree books.

RWood
09-22-2007, 11:11 PM
This is a wonderful addition to libprs500. Karma is on its way.

kovidgoyal
09-22-2007, 11:13 PM
The Sony Reader supports full justification but not hyphenation.

Full justification is where the right edge is not ragged. Like in most dead tree books.

That's achieved by hyphenation, so yes. :)

kovidgoyal
09-22-2007, 11:13 PM
This is a wonderful addition to libprs500. Karma is on its way.

Thanks.

JSWolf
09-22-2007, 11:34 PM
That's achieved by hyphenation, so yes. :)
Yes to full justification is going to be added to the viewer in some later version?

kovidgoyal
09-22-2007, 11:43 PM
It's already there.

JSWolf
09-22-2007, 11:53 PM
If you look at the photo I have attached, what you will see is left justified, not full justified.

kovidgoyal
09-23-2007, 12:06 AM
Ahh I see, you mean adjusting the space between words so that the line ends at the same point. Yeah I can do that, but I'm not sure it's a desirable goal. The SONY reader does it and I think it looks worse. Of course, with hyphenation it doesn't look as bad since the adjustments to wordspacing are typically smaller.

JSWolf
09-23-2007, 12:10 AM
If Sony supported Hyphenation, then the word spacing would almost be the same on every line. You might have the odd line here or there where auto-hyphenation won't work, but it would look better overall. The best way to do hyphenation is to use a dictionary to lookup the words.

kovidgoyal
09-23-2007, 12:21 AM
My viewer does precisely that. It uses the Liang hyphenation algorithm, which is the same as that used in Tex. However to achieve perfect justification you have to combine that with flexible word spacing, which works well in books that have small print, but I don't think it looks so good at the larger sizes at which electronic documents are typically viewed.

JSWolf
09-23-2007, 12:24 AM
Well to be honest, other then the hyphenation, it looks like we are viewing on a simulated Libre. I do think full justification would look fine. I get it justified using MS Reader on my computer and I have no complaints that it's not left justified.

kovidgoyal
09-23-2007, 01:03 AM
Hmm well lets see, I may add an option to turn it on/off.

JSWolf
09-23-2007, 01:08 AM
Hmm well lets see, I may add an option to turn it on/off.
That would be great! Thanks!

Mitchll
09-23-2007, 02:26 PM
Can this be accessed through the GUI or is it just through command line?

Thanks for all the great work!

Mitchll

kovidgoyal
09-23-2007, 02:33 PM
At the moment only through the commandline, once it stabilizes more I'll integrate it into the GUI.

whiteinge
09-23-2007, 08:30 PM
Wow, that's really great. Thanks a lot for putting that together!

kovidgoyal
09-24-2007, 12:30 AM
version 0.4.3 with full justification, search and a faster layout engine. Will hit the servers in an hour.

JSWolf
09-24-2007, 10:50 AM
Very nice!

kovidgoyal
09-26-2007, 07:05 PM
Integrated with the main libprs500 GUI in 0.4.4

andym
09-27-2007, 06:43 AM
Hmm well lets see, I may add an option to turn it on/off.

Kovid. I've looked at a couple of examples of books produced by BookDesigner and the full justification is hardcoded into the text. Being able to turn it on and off is got to be a better option - personally I'd rather have the ragged margin than ridiculous amounts of space between words.

JSWolf
09-27-2007, 10:20 AM
Kovid. I've looked at a couple of examples of books produced by BookDesigner and the full justification is hardcoded into the text. Being able to turn it on and off is got to be a better option - personally I'd rather have the ragged margin than ridiculous amounts of space between words.
The open source LRF viewer supports hyphenation, so you won't get the huge spaces in lines.

andym
09-27-2007, 11:50 AM
The open source LRF viewer supports hyphenation, so you won't get the huge spaces in lines.

Lots of spaces versus lots of hyphens versus justification versus smaller font size: there's always a trade-off to be made somewhere, and as as with all things the choice should be with the reader wherever possible.

tsgreer
09-27-2007, 12:44 PM
Kovid, you are like a machine over there man!! You are doing everything that Sony should be doing. You rock. So will this view show us exactly what the file will look like on the Reader? Or is it just a viewer for .lrf files.

The reason I ask is that it is time consuming to make a book then load it onto the Reader, only to find out the spacing is wrong or something. It would be cool if I could just check it in the viewer first...

tsgreer
09-27-2007, 01:10 PM
Wow, I just started using this. I like the interface and you even included a text search function. Very cool. I have actually been using color graphics in my lrf files (hey someday Readers are gonna be color right?!), and your viewer does a great job of rendering those perfect too.

So when Sony dives in and tries to hire you away from us, you won't forget us little people right?!?! :)

kovidgoyal
09-27-2007, 01:26 PM
Lots of spaces versus lots of hyphens versus justification versus smaller font size: there's always a trade-off to be made somewhere, and as as with all things the choice should be with the reader wherever possible.

I can add an option to turn off full justification. If you open a ticket for it, I'll make sure it gets into the next version.

kovidgoyal
09-27-2007, 01:58 PM
Kovid, you are like a machine over there man!! You are doing everything that Sony should be doing. You rock. So will this view show us exactly what the file will look like on the Reader? Or is it just a viewer for .lrf files.

The reason I ask is that it is time consuming to make a book then load it onto the Reader, only to find out the spacing is wrong or something. It would be cool if I could just check it in the viewer first...

That was one of the primary reasons I made the viewer. As I hated having to load books on the reader or boot windows to see the end result of a conversion. However, the rendering is not going to be exactly the same as SONY's reader, primarily because my reader supports hyphenation. You can turn it off with the --disable-hyphenation command-line option.

Another point off difference is that my reader uses different default fonts (the liberation family) as these have real italic and bold typefaces and support a far larger range of unicode characters. But their size characteristics are very similar to the Reader's default fonts, so it should not make much difference.

mani234
01-18-2009, 06:10 AM
Thanks Hope it works