2 Copyright © 1995-2014, The AROS Development Team. All rights reserved.
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>
16 #define TA(ta) ((struct TextAttr *) (ta))
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};
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",
39 MAXFONTMATCHWEIGHT
- WeighTAMatch(TA(&tta1
), TA(&tta2
), NULL
),
40 MAXFONTMATCHWEIGHT
- WeighTAMatch(TA(&tta2
), TA(&tta1
), NULL
));
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",
51 MAXFONTMATCHWEIGHT
- WeighTAMatch(TA(&tta1
), TA(&tta2
), NULL
),
52 MAXFONTMATCHWEIGHT
- WeighTAMatch(TA(&tta2
), TA(&tta1
), NULL
));
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",
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",
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",
87 MAXFONTMATCHWEIGHT
- WeighTAMatch(TA(&tta1
), TA(&tta2
), NULL
),
88 MAXFONTMATCHWEIGHT
- WeighTAMatch(TA(&tta2
), TA(&tta1
), NULL
));
91 /* The weight for some random combinations */
93 tta1
.tta_Style
= FSF_EXTENDED
| FSF_BOLD
;
94 tta1
.tta_Flags
= FPF_DESIGNED
| FPF_WIDEDOT
;
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
));
104 tta1
.tta_Flags
= FPF_DESIGNED
;
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
));
113 tta1
.tta_Style
= FSF_BOLD
;
114 tta1
.tta_Flags
= FPF_DESIGNED
| FPF_WIDEDOT
;
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
));