Register Guidelines E-Books Search Today's Posts Mark Forums Read

Go Back   MobileRead Forums > E-Book Software > Calibre

Notices

Reply
 
Thread Tools Search this Thread
Old 11-02-2009, 07:39 AM   #1
grimborg
Enthusiast
grimborg shares his or her toysgrimborg shares his or her toysgrimborg shares his or her toysgrimborg shares his or her toysgrimborg shares his or her toysgrimborg shares his or her toysgrimborg shares his or her toysgrimborg shares his or her toysgrimborg shares his or her toysgrimborg shares his or her toysgrimborg shares his or her toys
 
Posts: 41
Karma: 5514
Join Date: Oct 2009
Location: Groningen, Netherlands
Device: PRS-T1
This is how I reduce the font in a lrf file

I am using the Caecilia font and text is too big for me (PRS 505). I use this script to reduce the text by a ratio (85% works for me). Usage is: reducelrs < file.lrs > file_reduced.lrs

Code:
#!/usr/bin/perl -w
use strict;
my $ratio = 0.85;
while(<>) {
    if (/fontsize="(\d+)"/) {
        my $size = (int($1)*$ratio);
        s/fontsize="\d+"/fontsize="$size"/g;
    }
    print;
}
If you have a bunch of lrf files in the current directory you can do this:

Code:
mkdir -p done temp
cd temp
for i in ../*lrf;
    do cp "$i" .
    lrf2lrs *lrf
    a=`ls *lrs`
    mv "$a" a
    reducelrs < a > "$a"
    rm a
    lrs2lrf *lrs
    mv *lrf ../done
    rm *
done
cd ..
This will create two directories: temp and done. Temp is a temporary directory used for converting files. The resulting lrf files are left in done/

Tested only in GNU/Linux. I don't know how to do this in Windows. Works for me, but no warranties

Last edited by grimborg; 11-02-2009 at 09:25 AM.
grimborg is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
ttc font file can't be put into font folder droople Sigil 2 08-21-2010 10:05 AM
Embeding font into LRF nas_matko Calibre 28 09-21-2009 09:47 AM
Bold font in LRF - or just Calibre FizzyWater Calibre 6 03-24-2009 03:20 PM
feed to lrf, how do I change font (or have default font) lovemov Calibre 3 03-16-2009 10:57 PM
LRF with embedded font igorsk Sony Reader 8 10-26-2006 08:08 AM


All times are GMT -4. The time now is 09:57 AM.


MobileRead.com is a privately owned, operated and funded community.