[2000] | 1 | /* |
---|
| 2 | * see COPYRIGHT |
---|
| 3 | */ |
---|
| 4 | |
---|
| 5 | #include <stdio.h> |
---|
| 6 | #include <ctype.h> |
---|
| 7 | #include "t1lib.h" |
---|
| 8 | |
---|
| 9 | /* |
---|
| 10 | * compare two [ almost the same ] fonts |
---|
| 11 | */ |
---|
| 12 | |
---|
| 13 | #define PROGNAME "cmpf" |
---|
| 14 | |
---|
| 15 | #include "bmpfont.h" |
---|
| 16 | |
---|
| 17 | |
---|
| 18 | main(ac, av) |
---|
| 19 | int ac; |
---|
| 20 | char **av; |
---|
| 21 | { |
---|
| 22 | int fontid1, fontid2; |
---|
| 23 | GLYPH *g1, *g2; |
---|
| 24 | int chr, size, diff, offset; |
---|
| 25 | |
---|
| 26 | if(ac!=3) { |
---|
| 27 | fprintf(stderr,"Use: %s font1 font2\n", PROGNAME); |
---|
| 28 | exit(1); |
---|
| 29 | } |
---|
| 30 | |
---|
| 31 | chkneg(T1_SetBitmapPad(MYPAD)); |
---|
| 32 | chkneg(T1_InitLib(NO_LOGFILE|IGNORE_CONFIGFILE|IGNORE_FONTDATABASE)); |
---|
| 33 | chkneg(fontid1=T1_AddFont(av[1])); |
---|
| 34 | chkneg(fontid2=T1_AddFont(av[2])); |
---|
| 35 | |
---|
| 36 | |
---|
| 37 | resetmap(); |
---|
| 38 | for(chr=0; chr<256; chr++) { |
---|
| 39 | diff=0; |
---|
| 40 | for(size=MAXSIZE; size>=MINSIZE; size--) { |
---|
| 41 | chknull( g1=T1_CopyGlyph(T1_SetChar( fontid1, chr, (float)size, NULL)) ); |
---|
| 42 | chknull( g2=T1_CopyGlyph(T1_SetChar( fontid2, chr, (float)size, NULL)) ); |
---|
| 43 | |
---|
| 44 | if( cmpglyphs(g1, g2) ) { |
---|
| 45 | /* printf("%d %d - diff\n", chr, size); */ |
---|
| 46 | diff=1; |
---|
| 47 | drawdiff(size, g1, g2); |
---|
| 48 | } |
---|
| 49 | /* |
---|
| 50 | else |
---|
| 51 | fprintf(stderr, "%d %d - same\n", chr, size); |
---|
| 52 | */ |
---|
| 53 | |
---|
| 54 | chkneg(T1_FreeGlyph(g1)); |
---|
| 55 | chkneg(T1_FreeGlyph(g2)); |
---|
| 56 | } |
---|
| 57 | if(diff) { |
---|
| 58 | printf("*** Difference for %d==0x%x %c\n", chr, chr, |
---|
| 59 | isprint(chr) ? chr : ' '); |
---|
| 60 | printmap(stdout); |
---|
| 61 | diff=0; |
---|
| 62 | resetmap(); |
---|
| 63 | } |
---|
| 64 | } |
---|
| 65 | |
---|
| 66 | printf("All done!\n"); |
---|
| 67 | } |
---|