View Single Post
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