#!/usr/bin/perl # afm.pl # use strict; use warnings; use Font::AFM; my $h = new Font::AFM $ARGV[0]; print "(setq $ARGV[0]afm12 '(\n"; metric($h,"R",12); metric($h,"N",12); metric($h,"B",12); metric($h,"Q",12); metric($h,"K",12); metric($h,"O",12); metric($h,"-",12); metric($h,"x",12); metric($h,"+",12); metric($h,".",12); metric($h,"a",12); metric($h,"b",12); metric($h,"c",12); metric($h,"d",12); metric($h,"e",12); metric($h,"f",12); metric($h,"g",12); metric($h,"h",12); metric($h,"1",12); metric($h,"2",12); metric($h,"3",12); metric($h,"4",12); metric($h,"5",12); metric($h,"6",12); metric($h,"7",12); metric($h,"8",12); metric($h,"9",12); print " (\"0\" ", $h->stringwidth("0",12), ")))\n"; sub metric { my $afm = shift; my $s = shift; my $p = shift; my $w = $afm->stringwidth($s,$p); print " (\"$s\" $w)\n"; } #### (setq ZURIFB__afm12 '( ("R" 10.392) ("N" 11.676) ("B" 11.676) ("Q" 12) ("K" 11.52) ("O" 9.168) ("-" 10.548) ("x" 6.696) ("+" 6.708) ("." 3.396) ("a" 6.672) ("b" 7.488) ("c" 6.048) ("d" 7.62) ("e" 6.24) ("f" 5.28) ("g" 6.696) ("h" 8.268) ("1" 6.708) ("2" 6.708) ("3" 6.708) ("4" 6.708) ("5" 6.708) ("6" 6.888) ("7" 6.708) ("8" 6.708) ("9" 6.708) ("0" 6.708))) #### /ZurichFigurine-Bold 12 sf (1.d4 f5 2.c4 Nf6 3.Nc3 g6 4.Nf3 Bg7) justify (5.e3 d6 6.Bd3 O-O 7.O-O Qe8 8.e4) justify (fxe4 9.Nxe4 Bg4 10.Be3 Nbd7 11.Nxf6) justify (Nxf6 12.Be2 h6 13.d5 Ne4 14.Nd4) justify (Bd7 15.Bg4 Bxd4 16.Bxd4 Nf6) justify (17.Bxd7 Qxd7 18.Qd3 Qg4 19.Rae1) justify (Rf7 20.Re6 Raf8 21.h3 Qg5 22.g4) justify (Kh7 23.f4 Nh5 24.fxg5 Rxf1 25.Qxf1) justify (Rxf1 26.Kxf1 Nf4 27.Rxe7 1-0) left-justify newline