View Single Post
Old 06-22-2007, 12:17 PM   #12
mogui
eNigma
mogui is no ebook tyro.mogui is no ebook tyro.mogui is no ebook tyro.mogui is no ebook tyro.mogui is no ebook tyro.mogui is no ebook tyro.mogui is no ebook tyro.mogui is no ebook tyro.mogui is no ebook tyro.mogui is no ebook tyro.
 
mogui's Avatar
 
Posts: 503
Karma: 1335
Join Date: Dec 2006
Location: The Philippines
Device: HTC G1 Android FBReader
Dealing with ugly line spacing

Let me give an example:
My favorite file format for the Reader is plain old ASCII text. The title on the Reader turns out to be the same as the filename. I like that. I can make text files from many other formats. The middle font size on the Reader is right for normal reading and then I can go one bigger if the lighting is bad. I don't have to experiment a lot when I am in a hurry to read something.

So I got a book in lit format and converted it to lrf. The resultant line formatting was just plain ugly. There were sentence fragments everywhere and way too many spaces between lines. I decided to tighten it up.

I used Amber lit converter (abclit) to convert the original lit file to text. Then I opened the file in PSPad (see earlier post for source). I used the hex display mode to examine the character structure of the ugliness. I noticed that there were $0d$0a pairs everywhere. That is a carriage return line feed combination.

But at the beginning of every real paragraph there was an $a0 character. That is a space character with the high order bit set, I don't know why anybody put that character in there. It is not common. But I liked it because it gave me a way to reformat everything easily.

First I used search and replace to find all the $0d$0a pairs and replace them with $20 (space). Then I replaced all the $a0 characters with $0d$0a pairs. The result was pure beauty! The paragraphs all flowed well and there were no unwanted line spaces.

It took five minutes!

Last edited by mogui; 06-22-2007 at 12:20 PM.
mogui is offline   Reply With Quote