| 1 |
|
| 2 |
if ( Strtol($version)<20060330 ) |
| 3 |
Error( "Please upgrade to a more recent version of fontforge" ) |
| 4 |
endif |
| 5 |
|
| 6 |
flags=0x789 |
| 7 |
outfile="" |
| 8 |
|
| 9 |
while ( $argc > 1 && Strsub($1,0,1)=="-" ) |
| 10 |
temp = $1 |
| 11 |
if ( Strsub(temp,1,2)=='-' ) |
| 12 |
temp = Strsub(temp,1) |
| 13 |
endif |
| 14 |
|
| 15 |
if ( temp=="-ignorehints" ) |
| 16 |
flags = flags & ~0x8 |
| 17 |
elseif ( temp=="-ignorenames" ) |
| 18 |
flags = flags & ~0x100 |
| 19 |
elseif ( temp=="-ignoregpos" ) |
| 20 |
flags = flags & ~0x200 |
| 21 |
elseif ( temp=="-ignoregsub" ) |
| 22 |
flags = flags & ~0x400 |
| 23 |
elseif ( temp=="-ignorebitmaps" ) |
| 24 |
flags = flags & ~0x80 |
| 25 |
elseif ( temp=="-exact" ) |
| 26 |
flags = flags | 0x2 |
| 27 |
elseif ( temp=="-warn" ) |
| 28 |
flags = flags | 0x44 |
| 29 |
elseif ( temp=="-merge" ) |
| 30 |
flags = flags | 0x1800 |
| 31 |
shift |
| 32 |
outfile = $1 |
| 33 |
elseif ( temp=="-help" ) |
| 34 |
Print( "sfddiff: [--version] [--help] [--usage] [--ignorehints] [--ignorenames] [--ignoregpos] [--ignoregsup] [--ignorebitmaps] [--warn] [--exact] fontfile1 fontfile2" ) |
| 35 |
Print( " Compares two fontfiles" ) |
| 36 |
Print( " --ignorehints: Do not compare postscript hints or truetype instructions" ) |
| 37 |
Print( " --ignorenames: Do not compare font names" ) |
| 38 |
Print( " --ignoregpos: Do not compare kerning, etc." ) |
| 39 |
Print( " --ignoregsub: Do not compare ligatures, etc." ) |
| 40 |
Print( " --ignorebitmaps: Do not compare bitmap strikes" ) |
| 41 |
Print( " --exact: Normally sfddiff will match contours which are not exact" ) |
| 42 |
Print( " but where the differences are slight (so you could compare" ) |
| 43 |
Print( " truetype and postscript and get reasonable answers). Also" ) |
| 44 |
Print( " normally sfddiff will unlink references before it compares" ) |
| 45 |
Print( " (so you can compare a postscript font (with no references)" ) |
| 46 |
Print( " to the original source (which does have references)). Setting") |
| 47 |
Print( " this flag means glyphs must match exactly.") |
| 48 |
Print( " --warn: Provides a warning when an exact match is not found" ) |
| 49 |
Print( " --merge outfile: Put any outline differences in the backgrounds of" ) |
| 50 |
Print( " appropriate glyphs" ) |
| 51 |
return(0) |
| 52 |
elseif ( temp=="-version" ) |
| 53 |
Print( "Version 1.0" ) |
| 54 |
return(0) |
| 55 |
else |
| 56 |
break |
| 57 |
endif |
| 58 |
shift |
| 59 |
endloop |
| 60 |
|
| 61 |
if ( $argc!=3 || $1=="--usage" || $1=="-usage" ) |
| 62 |
Print( "sfddiff: [--version] [--help] [--usage] [--ignorehints] [--ignorenames] [--ignoregpos] [--ignoregsup] [--ignorebitmaps] [--warn] [--exact] [--merge outfile] fontfile1 fontfile2" ) |
| 63 |
return(0) |
| 64 |
endif |
| 65 |
|
| 66 |
Open($2,1) |
| 67 |
Open($1,1) |
| 68 |
CompareFonts($2,"-",flags) |
| 69 |
if ( outfile!="" ) |
| 70 |
Save(outfile) |
| 71 |
endif |