Sunday, October 28, 2012

 

snip2code

A friend of mine is working on a new project: http://www.snip2code.com
It's very much oriented to programmers: it's the place to go when you're looking for a code snippet and you don't want to reinvent the wheel.

Give it a go if you think it sounds interesting

Sunday, March 15, 2009

 

74 bugs

In a previous post I've talked about a bug affecting the ttf-dejavu package; I've extended the test to all font files in the Debian archive and come up with the following numbers: of the 192 packages containg at least one TrueType font file, 74 are affected by the digits width problem for a total of 672 ttf files.

Result are available here

The bug can be reproduced with pango-view (ttf-tmuni was chosen in this example):

perl -e 'for my $i (0..9){print "$i" x 80; print "\n";}'  > sample.txt
pango-view --font="Tibetan Machine Uni" --waterfall --dpi=72 -q -o out.png sample.txt

Comments are welcome before I start filing the bugreports

Labels:


Monday, October 13, 2008

 

Font updates

With the help of Monsieur Perrier, both ttf-freefont and ttf-dejavu font packages have been updated and uploaded to experimental.
Both changelogs are full of fixes and improvements:
get them while they're hot!

Wednesday, March 26, 2008

 

Almost two years...

After almost two years, a new version of freefont has been released. Credits go to Steve White who took over the maintainance and to bubulle who took care of reviewing and uploading the new package, and who kept the project alive through the Debian BTS during all these months of inactivity.

Saturday, March 15, 2008

 

Font tips #3: digits width

A while back Frans filed an interesting bug explaining the reason why digits width should always be the same.

Finding out if the previous condition is true, is just a matter of creating a sample text file

FONT="DejaVu Sans Oblique"
OUTFNAME=$(echo ${FONT} | sed -e "s| |_|g")
numdigits=100
for i in $(seq 0 9) ; do
for j in $(seq 1 ${numdigits}) ; do
echo -n $i >> numeri.txt
done
printf "\n" >> numeri.txt
done

and creating a waterfall image:

pango-view --font="${FONT}" --waterfall --dpi=72 -q -o ${OUTFNAME}.png numeri.txt

The resulting image shows how Dejavu Oblique is victim of a regression at size 9 and 10 (credits to fjp who spotted it once more!)

bugreport filed.

Labels:


Thursday, February 21, 2008

 

Font tips #2: comparing fonts

Being able to compare images can be really useful sometimes; I found it extremely helpful when I wanted to know what changed between two releases of the same font.

Imagemagick does the trick via a set of really powerful command line tools.

Here's a very simple demonstration:

  
pango-view --font="DejaVu Sans Mono" -t "Hello World" -w 180 -q -o a.png
pango-view --font="DejaVu Sans Mono" -t "Hello world" -w 180 -q -o b.png
compare a.png b.png hello_diff.png

which results in the following output:

We can now apply the previous tip to something more useful; let's say we want to know how the glyphs in a font changed from a release to another. In a previous post I've explained how to render all the glyphs into a nice PDF using fntsample; we just need to create PDFs for both releases and compare them... ain't that easy?

# Let's suppose you have already created PDF files inside the following dirs
a=dejavu-2.22
b=dejavu-2.23

vsdir="${a}_vs_${b}"
mkdir $vsdir

for f in $(find $a -name '*.pdf') ; do
f=$(basename $f)
apng=${a}/${f/.pdf/}
bpng=${b}/${f/.pdf/}
mkdir ${apng} ${bpng}

echo "*** ${f} ***"

# pdf -> pngs
convert ${a}/${f} ${apng}/${f/.pdf/}.png
convert ${b}/${f} ${bpng}/${f/.pdf/}.png

# compare pngs and, if different, show whre they differ in a png
for p in $(find ${apng} -name '*.png') ; do
p=$(basename $p)
meas=$(compare -metric AE ${apng}/${p} ${bpng}/${p} ${vsdir}/${p} 2>&1)
if [ ${meas} -eq 0 ] ; then
rm ${vsdir}/${p} ${apng}/${p} ${bpng}/${p}
else
echo " - ${p}"
fi
done
done

This is what you get when a glyph was modified:

In case of newly introduced glyphs you get the following:


Wednesday, February 20, 2008

 

Font tips #1: PDF charts with fntsample

Around the end of 2006 I come up with the idea of setting up something I called font-machine: a collection of scripts / utilities, intended to improve quality of fonts by defining and implementing automatic tests able to catch errors and provide screenshots.

Some pioneering work on this area was done a while ago by Miriam who set up a page showing how fonts currently in Debian look like.

I did something similar focusing on the fonts used by the Debian graphical installer (will write a separate post to describe the way it works).

I'll start describing the tools which I've used more frequently; of course my preference goes to the ones which can be run non-interactively: those that can be invoked inside shell scrips and keep your CPU busy!

fntsample is probably one of the programs I've used more frequently during the last months: it was written by Eugeniy Meshcheryakov, who also made it available as a Debian package, and creates really nice and professional PDF / PS charts showing all the glyphs contained in a particular font file.

The following code snippet shows how you can use fntsample to create pdf charts for each of the ttf files contained in ttf-dejavu package (will often refer to this package since I maintain it :-) ):

font="http://ftp.de.debian.org/debian/pool/main/t/ttf-dejavu/ttf-dejavu-core_2.23-1_all.deb"
deb=$(basename ${font})
wget $font
dpkg -x ${deb} ${deb/.deb/}

outdir="out"
mkdir $outdir
for ttf in $(find ${deb/.deb/} -name '*.ttf') ; do
pdf="$(basename ${ttf} | sed -e "s|\.ttf$|\.pdf|")"
fntsample -f ${ttf} -o ${outdir}/${pdf} -l > ${outdir}/${pdf/.pdf/.outline}
pdfoutline ${outdir}/${pdf} ${outdir}/${pdf/.pdf/.outline} ${outdir}/${pdf}
done

Note that PDF files will have useful outlines (aka bookmarks) courtesy of the pdfoutline tool shipped with the fntsample package.

Results are IMHO very imperessive!

PS: looking at the above chart for Cyrillic, I've just noticed the glyphs are ordered as to read "SEX"... I did not choose that particular chart snippet on purpose!


This page is powered by Blogger. Isn't yours?