mesa: simplify dependencies in mmakefiles
[AROS.git] / test / graphics / weightamatch.c
blob0c67bf4fa0cc984fd89be7f04f5c925957dc0d97
1 /*
2 Copyright © 1995-2014, The AROS Development Team. All rights reserved.
3 $Id$
4 */
6 /*
7 * Testing WeighTAMatch
8 * Flags: FPF_PROPORTIONAL, FPF_TALLDOT, FPF_WIDEDOT
9 * Style: FSF_EXTENDED, FSF_BOLD, FSF_UNDERLINED, FSF_ITALIC, FSF_COLORFONT
12 #include <proto/graphics.h>
13 #include <graphics/text.h>
15 #include <stdio.h>
16 #define TA(ta) ((struct TextAttr *) (ta))
18 int main(void)
20 struct TTextAttr tta1, tta2;
21 static UBYTE flags[] = {FPF_ROMFONT, FPF_DISKFONT, FPF_REVPATH, FPF_TALLDOT, FPF_WIDEDOT, FPF_PROPORTIONAL,
22 FPF_DESIGNED, FPF_REMOVED
24 static UBYTE styles[] = {~0, FSF_UNDERLINED, FSF_BOLD, FSF_ITALIC, FSF_EXTENDED, FSF_COLORFONT};
25 static UWORD sizes[] = {6, 10, 16, 17, 18, 19, 32, 64};
26 int i;
28 tta1.tta_Name = tta2.tta_Name = "test.font";
29 tta1.tta_YSize = tta2.tta_YSize = 16;
30 tta1.tta_Style = tta2.tta_Style = 0;
31 tta1.tta_Flags = tta2.tta_Flags = 0;
33 /* What is the weight for different sizes ? */
34 for (i = 0; i < 7; i++)
36 tta2.tta_YSize = sizes[i];
37 printf("Size: %d, Weight1: %d, Weight2: %d\n",
38 (int)sizes[i],
39 MAXFONTMATCHWEIGHT - WeighTAMatch(TA(&tta1), TA(&tta2), NULL),
40 MAXFONTMATCHWEIGHT - WeighTAMatch(TA(&tta2), TA(&tta1), NULL));
42 tta2.tta_YSize = 16;
44 printf("\nPositive flags\n");
45 /* What is the weight for different styles ? */
46 for (i = 0; i < 6; i++)
48 tta2.tta_Style = styles[i];
49 printf("Style: %d, Weight1: %d, Weight2: %d\n",
50 (int)styles[i],
51 MAXFONTMATCHWEIGHT - WeighTAMatch(TA(&tta1), TA(&tta2), NULL),
52 MAXFONTMATCHWEIGHT - WeighTAMatch(TA(&tta2), TA(&tta1), NULL));
54 tta2.tta_Style = 0;
56 /* What is the weight for different flags ? */
57 for (i = 0; i < 8; i++)
59 tta2.tta_Flags = flags[i];
60 printf("Flags: %d, Weight1: %d, Weight2: %d\n",
61 (int)flags[i],
62 MAXFONTMATCHWEIGHT - WeighTAMatch(TA(&tta1), TA(&tta2), NULL),
63 MAXFONTMATCHWEIGHT - WeighTAMatch(TA(&tta2), TA(&tta1), NULL));
66 tta1.tta_Style = tta2.tta_Style = (UBYTE) ~FSF_TAGGED;
67 tta1.tta_Flags = tta2.tta_Flags = ~0;
69 printf("\nNegative flags\n");
70 /* What is the weight for different styles ? */
71 for (i = 0; i < 6; i++)
73 tta2.tta_Style = ~styles[i];
74 printf("Style: %d, Weight1: %d, Weight2: %d\n",
75 (int)styles[i],
76 MAXFONTMATCHWEIGHT - WeighTAMatch(TA(&tta1), TA(&tta2), NULL),
77 MAXFONTMATCHWEIGHT - WeighTAMatch(TA(&tta2), TA(&tta1), NULL));
79 tta2.tta_Style = (UBYTE) ~FSF_TAGGED;
81 /* What is the weight for different flags ? */
82 for (i = 0; i < 8; i++)
84 tta2.tta_Flags = ~flags[i];
85 printf("Flags: %d, Weight1: %d, Weight2: %d\n",
86 (int)flags[i],
87 MAXFONTMATCHWEIGHT - WeighTAMatch(TA(&tta1), TA(&tta2), NULL),
88 MAXFONTMATCHWEIGHT - WeighTAMatch(TA(&tta2), TA(&tta1), NULL));
91 /* The weight for some random combinations */
92 tta1.tta_YSize = 10;
93 tta1.tta_Style = FSF_EXTENDED | FSF_BOLD;
94 tta1.tta_Flags = FPF_DESIGNED | FPF_WIDEDOT;
95 tta2.tta_YSize = 13;
96 tta2.tta_Style = FSF_BOLD;
97 tta2.tta_Flags = FPF_DESIGNED;
98 printf("\nRandom: 1, Weight1: %d, Weight2: %d\n",
99 MAXFONTMATCHWEIGHT - WeighTAMatch(TA(&tta1), TA(&tta2), NULL),
100 MAXFONTMATCHWEIGHT - WeighTAMatch(TA(&tta2), TA(&tta1), NULL));
102 tta1.tta_YSize = 12;
103 tta1.tta_Style = 0;
104 tta1.tta_Flags = FPF_DESIGNED;
105 tta2.tta_YSize = 12;
106 tta2.tta_Style = 0;
107 tta2.tta_Flags = FPF_DISKFONT;
108 printf("Random: 2, Weight1: %d, Weight2: %d\n",
109 MAXFONTMATCHWEIGHT - WeighTAMatch(TA(&tta1), TA(&tta2), NULL),
110 MAXFONTMATCHWEIGHT - WeighTAMatch(TA(&tta2), TA(&tta1), NULL));
112 tta1.tta_YSize = 15;
113 tta1.tta_Style = FSF_BOLD;
114 tta1.tta_Flags = FPF_DESIGNED | FPF_WIDEDOT;
115 tta2.tta_YSize = 15;
116 tta2.tta_Style = FSF_ITALIC;
117 tta2.tta_Flags = FPF_ROMFONT | FPF_REMOVED;
118 printf("Random: 3, Weight1: %d, Weight2: %d\n",
119 MAXFONTMATCHWEIGHT - WeighTAMatch(TA(&tta1), TA(&tta2), NULL),
120 MAXFONTMATCHWEIGHT - WeighTAMatch(TA(&tta2), TA(&tta1), NULL));
122 return 0;