3 * Flags: FPF_PROPORTIONAL, FPF_TALLDOT, FPF_WIDEDOT
4 * Style: FSF_EXTENDED, FSF_BOLD, FSF_UNDERLINED, FSF_ITALIC, FSF_COLORFONT
7 #include <proto/graphics.h>
8 #include <graphics/text.h>
11 #define TA(ta) ((struct TextAttr *) (ta))
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};
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",
34 MAXFONTMATCHWEIGHT
- WeighTAMatch(TA(&tta1
), TA(&tta2
), NULL
),
35 MAXFONTMATCHWEIGHT
- WeighTAMatch(TA(&tta2
), TA(&tta1
), NULL
));
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",
46 MAXFONTMATCHWEIGHT
- WeighTAMatch(TA(&tta1
), TA(&tta2
), NULL
),
47 MAXFONTMATCHWEIGHT
- WeighTAMatch(TA(&tta2
), TA(&tta1
), NULL
));
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",
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",
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",
82 MAXFONTMATCHWEIGHT
- WeighTAMatch(TA(&tta1
), TA(&tta2
), NULL
),
83 MAXFONTMATCHWEIGHT
- WeighTAMatch(TA(&tta2
), TA(&tta1
), NULL
));
86 /* The weight for some random combinations */
88 tta1
.tta_Style
= FSF_EXTENDED
| FSF_BOLD
;
89 tta1
.tta_Flags
= FPF_DESIGNED
| FPF_WIDEDOT
;
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
));
99 tta1
.tta_Flags
= FPF_DESIGNED
;
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
));
108 tta1
.tta_Style
= FSF_BOLD
;
109 tta1
.tta_Flags
= FPF_DESIGNED
| FPF_WIDEDOT
;
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
));