squashed commit of private hostlib-resource branch
[tangerine.git] / test / weightamatch.c
blob95ea5cb427cacda1a48f2ca6761839bd25c41654
1 /*
2 * Testing WeighTAMatch
3 * Flags: FPF_PROPORTIONAL, FPF_TALLDOT, FPF_WIDEDOT
4 * Style: FSF_EXTENDED, FSF_BOLD, FSF_UNDERLINED, FSF_ITALIC, FSF_COLORFONT
5 */
7 #include <proto/graphics.h>
8 #include <graphics/text.h>
10 #include <stdio.h>
11 #define TA(ta) ((struct TextAttr *) (ta))
13 int main(void)
15 struct TTextAttr tta1, tta2;
16 static UBYTE flags[] = {FPF_ROMFONT, FPF_DISKFONT, FPF_REVPATH, FPF_TALLDOT, FPF_WIDEDOT, FPF_PROPORTIONAL,
17 FPF_DESIGNED, FPF_REMOVED
19 static UBYTE styles[] = {~0, FSF_UNDERLINED, FSF_BOLD, FSF_ITALIC, FSF_EXTENDED, FSF_COLORFONT};
20 static UWORD sizes[] = {6, 10, 16, 17, 18, 19, 32, 64};
21 int i;
23 tta1.tta_Name = tta2.tta_Name = "test.font";
24 tta1.tta_YSize = tta2.tta_YSize = 16;
25 tta1.tta_Style = tta2.tta_Style = 0;
26 tta1.tta_Flags = tta2.tta_Flags = 0;
28 /* What is the weight for different sizes ? */
29 for (i = 0; i < 7; i++)
31 tta2.tta_YSize = sizes[i];
32 printf("Size: %d, Weight1: %d, Weight2: %d\n",
33 (int)sizes[i],
34 MAXFONTMATCHWEIGHT - WeighTAMatch(TA(&tta1), TA(&tta2), NULL),
35 MAXFONTMATCHWEIGHT - WeighTAMatch(TA(&tta2), TA(&tta1), NULL));
37 tta2.tta_YSize = 16;
39 printf("\nPositive flags\n");
40 /* What is the weight for different styles ? */
41 for (i = 0; i < 6; i++)
43 tta2.tta_Style = styles[i];
44 printf("Style: %d, Weight1: %d, Weight2: %d\n",
45 (int)styles[i],
46 MAXFONTMATCHWEIGHT - WeighTAMatch(TA(&tta1), TA(&tta2), NULL),
47 MAXFONTMATCHWEIGHT - WeighTAMatch(TA(&tta2), TA(&tta1), NULL));
49 tta2.tta_Style = 0;
51 /* What is the weight for different flags ? */
52 for (i = 0; i < 8; i++)
54 tta2.tta_Flags = flags[i];
55 printf("Flags: %d, Weight1: %d, Weight2: %d\n",
56 (int)flags[i],
57 MAXFONTMATCHWEIGHT - WeighTAMatch(TA(&tta1), TA(&tta2), NULL),
58 MAXFONTMATCHWEIGHT - WeighTAMatch(TA(&tta2), TA(&tta1), NULL));
61 tta1.tta_Style = tta2.tta_Style = (UBYTE) ~FSF_TAGGED;
62 tta1.tta_Flags = tta2.tta_Flags = ~0;
64 printf("\nNegative flags\n");
65 /* What is the weight for different styles ? */
66 for (i = 0; i < 6; i++)
68 tta2.tta_Style = ~styles[i];
69 printf("Style: %d, Weight1: %d, Weight2: %d\n",
70 (int)styles[i],
71 MAXFONTMATCHWEIGHT - WeighTAMatch(TA(&tta1), TA(&tta2), NULL),
72 MAXFONTMATCHWEIGHT - WeighTAMatch(TA(&tta2), TA(&tta1), NULL));
74 tta2.tta_Style = (UBYTE) ~FSF_TAGGED;
76 /* What is the weight for different flags ? */
77 for (i = 0; i < 8; i++)
79 tta2.tta_Flags = ~flags[i];
80 printf("Flags: %d, Weight1: %d, Weight2: %d\n",
81 (int)flags[i],
82 MAXFONTMATCHWEIGHT - WeighTAMatch(TA(&tta1), TA(&tta2), NULL),
83 MAXFONTMATCHWEIGHT - WeighTAMatch(TA(&tta2), TA(&tta1), NULL));
86 /* The weight for some random combinations */
87 tta1.tta_YSize = 10;
88 tta1.tta_Style = FSF_EXTENDED | FSF_BOLD;
89 tta1.tta_Flags = FPF_DESIGNED | FPF_WIDEDOT;
90 tta2.tta_YSize = 13;
91 tta2.tta_Style = FSF_BOLD;
92 tta2.tta_Flags = FPF_DESIGNED;
93 printf("\nRandom: 1, Weight1: %d, Weight2: %d\n",
94 MAXFONTMATCHWEIGHT - WeighTAMatch(TA(&tta1), TA(&tta2), NULL),
95 MAXFONTMATCHWEIGHT - WeighTAMatch(TA(&tta2), TA(&tta1), NULL));
97 tta1.tta_YSize = 12;
98 tta1.tta_Style = 0;
99 tta1.tta_Flags = FPF_DESIGNED;
100 tta2.tta_YSize = 12;
101 tta2.tta_Style = 0;
102 tta2.tta_Flags = FPF_DISKFONT;
103 printf("Random: 2, Weight1: %d, Weight2: %d\n",
104 MAXFONTMATCHWEIGHT - WeighTAMatch(TA(&tta1), TA(&tta2), NULL),
105 MAXFONTMATCHWEIGHT - WeighTAMatch(TA(&tta2), TA(&tta1), NULL));
107 tta1.tta_YSize = 15;
108 tta1.tta_Style = FSF_BOLD;
109 tta1.tta_Flags = FPF_DESIGNED | FPF_WIDEDOT;
110 tta2.tta_YSize = 15;
111 tta2.tta_Style = FSF_ITALIC;
112 tta2.tta_Flags = FPF_ROMFONT | FPF_REMOVED;
113 printf("Random: 3, Weight1: %d, Weight2: %d\n",
114 MAXFONTMATCHWEIGHT - WeighTAMatch(TA(&tta1), TA(&tta2), NULL),
115 MAXFONTMATCHWEIGHT - WeighTAMatch(TA(&tta2), TA(&tta1), NULL));
117 return 0;