1 /*************************************************************************
\r
5 Demonstrates the speed difference between compiled bitmap, conventional
\r
6 masked planar bitmap, and video bitmap blits.
\r
8 **************************************************************************/
\r
25 /* Macro to make pointer parameters model independent */
\r
26 #define FARPTR(x) (MK_FP(FP_SEG(x),FP_OFF(x)))
\r
28 char *swidth[10]={"0","1","2","3","4","5","6","7","8","9"};
\r
29 char far *fonts[20];
\r
40 void load_user_fonts(){
\r
43 struct ffblk ffblock;
\r
45 if(findfirst("*.fnt",&ffblock,0)!=0){
\r
46 printf("No Fonts found in current directory!\n");
\r
50 printf("Loading font \"%s\"...\n",ffblock.ff_name);
\r
51 strncpy(names[fcount],ffblock.ff_name,14);
\r
53 f=fopen(ffblock.ff_name,"rb");
\r
55 fseek(f,0,SEEK_END);
\r
57 fseek(f,0,SEEK_SET);
\r
59 fonts[fcount] = farmalloc(len);
\r
60 if (!fonts[fcount]){
\r
61 printf("Out of memory");
\r
63 printf("- No more fonts can be loaded\n");
\r
66 } else printf("\n");
\r
71 for (i=0;i<len;i++){
\r
73 *(fonts[fcount]+i)=c;
\r
79 } while (!findnext(&ffblock));
\r
82 printf("\n Press 'v' to view, any other key to quit\n");
\r
84 if (c!='V' && c!='v'){
\r
90 x_set_mode(X_MODE_320x240,0);
\r
91 x_register_userfont(fonts[0]);
\r
95 //......................................//
\r
96 char *text[30] = {"EXTRACT: Stephen King's \"SALEM'S LOT\" ",
\r
98 "The memory rose up in almost total ",
\r
99 "sensory reference, and for the moment ",
\r
100 "of its totality he was paralyzed. He ",
\r
101 "could even smell the plaster and the ",
\r
102 "wild odour of nesting animals. It ",
\r
103 "seemed to him that the plain varnished",
\r
104 "door of Matt Burke's guest room stood ",
\r
105 "between him and all the secrets of ",
\r
106 "Hell. Then he twisted the knob and ",
\r
107 "pushed the door handle inwards... ",
\r
109 "ABCDEFGHIJKLMNOPQRSTUVWXYZ ",
\r
110 "abcdefghijklmnopqrstuvwxyz 0123456789 ",
\r
111 "~!@#$%^&*()_+|`-=\\{}[]:\";'<>?,./ ",
\r
126 for (i=0;i<fcount;i++){
\r
127 x_set_font(FONT_8x8);
\r
128 x_rect_fill(0, 0, 319, 239, 0, 0);
\r
129 x_line(0,9,319,9,14,0);
\r
130 x_line(0,ScrnPhysicalHeight-10,319,ScrnPhysicalHeight-10,14,0);
\r
132 x_bgprintf(0,0,0,14,0,"Font \"%s\" H=%d,W=%s",names[i],
\r
133 (int)*(fonts[i]+2),
\r
134 (*(fonts[i]+3)==0)?"Variable":swidth[*(fonts[i]+3)]);
\r
135 x_bgprintf(0,ScrnPhysicalHeight-8,0,14,0,
\r
136 "Press a key for next font...");
\r
138 x_register_userfont(fonts[i]);
\r
139 x_set_font(FONT_USER);
\r
141 height=(int)*(fonts[i]+2)+1;
\r
144 while(text[strindex]){
\r
145 x_printf(0,textline,0,14,text[strindex++]);
\r