1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
|
#!/usr/local/bin/fontforge
#
# Fontforge script for OCR B
#
# This file is released to the public domain by its author, Matthew Skala.
# $1 = terse name, lc
# $2 = terse name, uc
# $3 = human-style name
# $4 = if set, do background/foreground subtraction
# $5 = feature file to attach
if (Strtol($4)>0)
Open("msk-ocrb10"+$1+"bg.pfb");
SelectAll();Copy();
Open("msk-ocrb10"+$1+"fg.pfb");
SelectAll();PasteInto();CorrectDirection();
else
Open("msk-ocrb10"+$1+".pfb");
endif
family="OCRB"+$2
fontname=family+"-"+StrJoin(StrSplit($3," "),"");
SetFontNames(fontname,family,"OCR B "+$3,"Regular","Matthew Skala (2011-12); based on code by Norbert Schwarz (1986, 2011)","2");
if (Strlen($2)==0 && Strlen($1)>0) $2=ToUpper($1); endif
SelectAll();SetWidth(723);
"ocrbnames.pe"();
#if (Strtol($4)>0)
# Select("AE");Cut();
# Select("OE");Cut();
# Select("ae");Cut();
# Select("oe");Cut();
#endif
SelectAll();RoundToCluster(2,2);
SelectAll();RoundToInt();
SelectAll();Simplify(212,3);
SelectAll();AddExtrema();
SelectAll();RoundToInt();
SelectAll();CorrectDirection();
SelectAll();CanonicalStart();
SelectAll();CanonicalContours();
SelectAll();AutoHint();
SelectAll();AutoCounter();
MergeFeature($5);
Generate("OCRB"+$2+".pfb");
Generate("OCRB"+$2+".otf");
SetFontOrder(2);
SelectAll();AutoHint();
SelectAll();AutoCounter();
Generate("OCRB"+$2+".ttf");
Quit(0);
|