]> git.sesse.net Git - rdpsrv/blob - Xserver/lib/font/Speedo/nsample.c
489dbed49211b2ecba0cab88f6609bf5b5b0fbae
[rdpsrv] / Xserver / lib / font / Speedo / nsample.c
1 /* $XConsortium: nsample.c,v 1.3 93/10/28 15:27:12 gildea Exp $ */
2
3 /*
4
5 Copyright 1989-1991, Bitstream Inc., Cambridge, MA.
6 You are hereby granted permission under all Bitstream propriety rights to
7 use, copy, modify, sublicense, sell, and redistribute the Bitstream Speedo
8 software and the Bitstream Charter outline font for any purpose and without
9 restrictions; provided, that this notice is left intact on all copies of such
10 software or font and that Bitstream's trademark is acknowledged as shown below
11 on all unmodified copies of such font.
12
13 BITSTREAM CHARTER is a registered trademark of Bitstream Inc.
14
15
16 BITSTREAM INC. DISCLAIMS ANY AND ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING
17 WITHOUT LIMITATION THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
18 PARTICULAR PURPOSE.  BITSTREAM SHALL NOT BE LIABLE FOR ANY DIRECT OR INDIRECT
19 DAMAGES, INCLUDING BUT NOT LIMITED TO LOST PROFITS, LOST DATA, OR ANY OTHER
20 INCIDENTAL OR CONSEQUENTIAL DAMAGES, ARISING OUT OF OR IN ANY WAY CONNECTED
21 WITH THE SPEEDO SOFTWARE OR THE BITSTREAM CHARTER OUTLINE FONT.
22
23 */
24
25
26 /*************************** N S A M P L E . C *******************************
27  *                                                                           *
28  *                 SPEEDO CHARACTER GENERATOR TEST MODULE                    *
29  *                                                                           *
30  * This is an illustration of what external resources are required to        *
31  * load a Speedo outline and use the Speedo character generator to generate  *
32  * bitmaps or scaled outlines according to the desired specification.        *                                                    *
33  *                                                                           *
34  * This program loads a Speedo outline, defines a set of character           *
35  * generation specifications, generates bitmap (or outline) data for each    *
36  * character in the font and prints them on the standard output.             *
37  *                                                                           *
38  * If the font buffer is too small to hold the entire font, the first        *
39  * part of the font is loaded. Character data is then loaded dynamically     *
40  * as required.                                                              *
41  *                                                                           *
42  ****************************************************************************/
43
44 #include <stdio.h>
45 #if PROTOS_AVAIL
46 #include <stddef.h>
47 #include <malloc.h>
48 #include <stdlib.h>
49 void main(int argc,char *argv[]);
50 #else
51 void* malloc();
52 #endif
53
54 #include "speedo.h"                 /* General definition for make_bmap */
55 #include "keys.h"                  /* Font decryption keys */
56
57 #define DEBUG  0
58
59 #if DEBUG
60 #define SHOW(X) printf("X = %d\n", X)
61 #else
62 #define SHOW(X)
63 #endif
64
65 #define MAX_BITS  256              /* Max line length of generated bitmap */
66
67 /***** GLOBAL FUNCTIONS *****/
68
69 /***** EXTERNAL FUNCTIONS *****/
70
71 /***** STATIC FUNCTIONS *****/
72
73 #if PROTOS_AVAIL
74 fix31 read_4b(ufix8 FONTFAR *ptr);
75 fix15 read_2b(ufix8 FONTFAR *ptr);
76 #else
77 fix31 read_4b();
78 fix15 read_2b();
79 #endif
80 /***** STATIC VARIABLES *****/
81 static  char   pathname[100];      /* Name of font file to be output */
82 static  ufix8 FONTFAR *font_buffer;       /* Pointer to allocated Font buffer */
83 static  ufix8 FONTFAR *char_buffer;       /* Pointer to allocate Character buffer */
84 static  buff_t font;               /* Buffer descriptor for font data */
85 #if INCL_LCD
86 static  buff_t char_data;          /* Buffer descriptor for character data */
87 #endif
88 static  FILE  *fdescr;             /* Speedo outline file descriptor */
89 static  ufix16 char_index;         /* Index of character to be generated */
90 static  ufix16 char_id;            /* Character ID */
91 static  ufix16 minchrsz;              /* minimum character buffer size */
92
93 static  ufix8  key[] = 
94     {
95     KEY0, 
96     KEY1, 
97     KEY2, 
98     KEY3, 
99     KEY4, 
100     KEY5, 
101     KEY6, 
102     KEY7, 
103     KEY8
104     };                             /* Font decryption key */
105
106 static  fix15  raswid;             /* raster width  */
107 static  fix15  rashgt;             /* raster height */
108 static  fix15  offhor;             /* horizontal offset from left edge of emsquare */
109 static  fix15  offver;             /* vertical offset from baseline */
110 static  fix15  set_width;          /* character set width */
111 static  fix15  y_cur;              /* Current y value being generated and printed */
112 static  char   line_of_bits[2 * MAX_BITS + 1]; /* Buffer for row of generated bits */
113
114 #if INCL_MULTIDEV
115 #if INCL_BLACK || INCL_SCREEN || INCL_2D
116 bitmap_t bfuncs = { sp_open_bitmap, sp_set_bitmap_bits, sp_close_bitmap };
117 #endif
118 #if INCL_OUTLINE
119 outline_t ofuncs = { sp_open_outline, sp_start_new_char, sp_start_contour, sp_curve_to,
120                      sp_line_to, sp_close_contour, sp_close_outline };
121 #endif
122 #endif
123
124
125 ufix8   temp[16];             /* temp buffer for first 16 bytes of font */
126
127 \f
128 FUNCTION void main(argc,argv)
129 int argc;
130 char *argv[];
131 {
132 ufix16     bytes_read;           /* Number of bytes read from font file */
133 specs_t specs;                /* Bundle of character generation specs  */
134 int     first_char_index;     /* Index of first character in font */
135 int     no_layout_chars;        /* number of characters in layout */
136 ufix32  i;
137 ufix32  minbufsz;             /* minimum font buffer size to allocate */
138 ufix16 cust_no;
139 ufix8  FONTFAR *byte_ptr;
140
141 #if REENTRANT_ALLOC
142 SPEEDO_GLOBALS* sp_global_ptr;
143 #endif
144
145
146 if (argc != 2) 
147     {
148     fprintf(stderr,"Usage: nsample {fontfile}\n\n"); 
149     exit (1);
150     }
151
152 sprintf(pathname, argv[1]);
153
154 /* Load Speedo outline file */
155 fdescr = fopen (pathname, "rb");
156 if (fdescr == NULL)
157     {
158     printf("****** Cannot open file %s\n", pathname);
159     return;                  
160     }
161
162 /* get minimum font buffer size - read first 16 bytes to get the minimum
163    size field from the header, then allocate buffer dynamically  */
164
165 bytes_read = fread(temp, sizeof(ufix8), 16, fdescr);
166
167 if (bytes_read != 16)
168         {
169         printf("****** Error on reading %s: %x\n", pathname, bytes_read);
170         fclose(fdescr);
171         return;
172         }
173 #if INCL_LCD
174 minbufsz = (ufix32)read_4b(temp+FH_FBFSZ);
175 #else
176 minbufsz = (ufix32)read_4b(temp+FH_FNTSZ);
177 if (minbufsz >= 0x10000)
178         {
179         printf("****** Cannot process fonts greater than 64K - use dynamic character loading configuration option\n");
180         fclose(fdescr);
181         return;
182         }
183 #endif
184
185 #if (defined(M_I86SM) || defined(M_I86MM))
186 font_buffer = (ufix8 FONTFAR *)_fmalloc((ufix16)minbufsz);
187 #else
188 font_buffer = (ufix8 *)malloc((ufix16)minbufsz);
189 #endif
190       
191 if (font_buffer == NULL)
192         {
193         printf("****** Unable to allocate memory for font buffer\n");
194     fclose(fdescr);
195         return;
196         }
197
198 #if DEBUG
199 printf("Loading font file %s\n", pathname);
200 #endif
201
202 fseek(fdescr, (ufix32)0, 0);
203 #if (defined(M_I86SM) || (defined(M_I86MM)))
204 byte_ptr = font_buffer;
205 for (i=0; i< minbufsz; i++){
206     int ch;
207     ch = getc(fdescr);
208     if (ch == EOF)
209        {printf ("Premature EOF in reading font buffer, %ld bytes read\n",i);
210         exit(2);}
211     *byte_ptr=(ufix8)ch;
212     byte_ptr++;
213     }
214 bytes_read = i;
215 #else
216 bytes_read = fread((ufix8 *)font_buffer, sizeof(ufix8), (ufix16)minbufsz, fdescr);
217 if (bytes_read == 0)
218     {
219     printf("****** Error on reading %s: %x\n", pathname, bytes_read);
220     fclose(fdescr);     
221     return;
222     }
223 #endif
224
225 #if INCL_LCD
226 /* now allocate minimum character buffer */
227
228 minchrsz = read_2b(font_buffer+FH_CBFSZ);
229 #if (defined(M_I86SM) || (defined(M_I86MM)))
230 char_buffer = (ufix8 FONTFAR *)_fmalloc(minchrsz);
231 #else
232 char_buffer = (ufix8*)malloc(minchrsz);
233 #endif
234
235 if (char_buffer == NULL)
236         {
237         printf("****** Unable to allocate memory for character buffer\n");
238     fclose(fdescr);     
239         return;
240         }
241 #endif
242
243 #if DYNAMIC_ALLOC || REENTRANT_ALLOC
244         sp_global_ptr = (SPEEDO_GLOBALS *)malloc(sizeof(SPEEDO_GLOBALS));
245         memset(sp_global_ptr,(ufix8)0,sizeof(SPEEDO_GLOBALS));
246 #endif
247
248
249 /* Initialization */
250 #if REENTRANT_ALLOC
251 sp_reset(sp_global_ptr);                   /* Reset Speedo character generator */
252 #else
253 sp_reset();                   /* Reset Speedo character generator */
254 #endif
255
256 font.org = font_buffer;
257 font.no_bytes = bytes_read;
258
259 #if REENTRANT_ALLOC
260 if ((cust_no=sp_get_cust_no(sp_global_ptr,font)) != CUS0 && /* NOT STANDARD ENCRYPTION */
261 #else
262 if ((cust_no=sp_get_cust_no(font)) != CUS0 && /* NOT STANDARD ENCRYPTION */
263 #endif
264                                 cust_no != 0)
265         {
266 #if REENTRANT_ALLOC
267         printf("Unable to use fonts for customer number %d\n",
268                                 sp_get_cust_no(sp_global_ptr(font)));
269 #else
270         printf("Unable to use fonts for customer number %d\n",
271                                 sp_get_cust_no(font));
272 #endif
273     fclose(fdescr);
274         return;
275         }
276
277 #if INCL_KEYS
278 #if REENTRANT_ALLOC
279 sp_set_key(sp_global_ptr,key);              /* Set decryption key */
280 #else
281 sp_set_key(key);              /* Set decryption key */
282 #endif
283 #endif
284
285 #if INCL_MULTIDEV
286 #if INCL_BLACK || INCL_SCREEN || INCL_2D
287 #if REENTRANT_ALLOC
288 sp_set_bitmap_device(sp_global_ptr,&bfuncs,sizeof(bfuncs));              /* Set decryption key */
289 #else
290 sp_set_bitmap_device(&bfuncs,sizeof(bfuncs));              /* Set decryption key */
291 #endif
292 #endif
293 #if INCL_OUTLINE
294 #if REENTRANT_ALLOC
295 sp_set_outline_device(sp_global_ptr,&ofuncs,sizeof(ofuncs));              /* Set decryption key */
296 #else
297 sp_set_outline_device(&ofuncs,sizeof(ofuncs));              /* Set decryption key */
298 #endif
299 #endif
300 #endif
301
302 first_char_index = read_2b(font_buffer + FH_FCHRF);
303 no_layout_chars = read_2b(font_buffer + FH_NCHRL);
304
305 /* Set specifications for character to be generated */
306 specs.pfont = &font;          /* Pointer to Speedo outline structure */
307 specs.xxmult = 25L << 16;     /* Coeff of X to calculate X pixels */
308 specs.xymult = 0L << 16;      /* Coeff of Y to calculate X pixels */
309 specs.xoffset = 0L << 16;     /* Position of X origin */
310 specs.yxmult = 0L << 16;      /* Coeff of X to calculate Y pixels */
311 specs.yymult = 25L << 16;     /* Coeff of Y to calculate Y pixels */
312 specs.yoffset = 0L << 16;     /* Position of Y origin */
313 specs.flags = 0;         /* Mode flags */
314 specs.out_info = NULL;   
315
316
317 #if REENTRANT_ALLOC
318 if (!sp_set_specs(sp_global_ptr,&specs))    /* Set character generation specifications */
319 #else
320 if (!sp_set_specs(&specs))    /* Set character generation specifications */
321 #endif
322     {
323     printf("****** Cannot set requested specs\n");
324     }
325 else
326     {
327     for (i = 0; i < no_layout_chars; i++)   /* For each character in font */
328         {
329         char_index = i + first_char_index;
330 #if REENTRANT_ALLOC
331         char_id = sp_get_char_id(sp_global_ptr,char_index);
332 #else
333         char_id = sp_get_char_id(char_index);
334 #endif
335                 if (char_id != 0)
336                         {
337 #if REENTRANT_ALLOC
338                 if (!sp_make_char(sp_global_ptr,char_index))
339 #else
340                 if (!sp_make_char(char_index))
341 #endif
342                     {
343                 printf("****** Cannot generate character %d\n", char_index);
344                     }
345                         }
346         }
347     }
348
349 fclose(fdescr);     
350 }
351 \f
352 #if INCL_LCD
353 #if REENTRANT_ALLOC
354 FUNCTION buff_t *sp_load_char_data(sp_global_ptr, file_offset, no_bytes, cb_offset)
355 SPEEDO_GLOBALS *sp_global_ptr;
356 #else
357 FUNCTION buff_t *sp_load_char_data(file_offset, no_bytes, cb_offset)
358 #endif
359 fix31    file_offset;  /* Offset in bytes from the start of the font file */
360 fix15    no_bytes;     /* Number of bytes to be loaded */
361 fix15    cb_offset;    /* Offset in bytes from start of char buffer */
362 /*
363  * Called by Speedo character generator to request that character
364  * data be loaded from the font file into a character data buffer.
365  * The character buffer offset is zero for all characters except elements
366  * of compound characters. If a single buffer is allocated for character
367  * data, cb_offset ensures that sub-character data is loaded after the
368  * top-level compound character.
369  * Returns a pointer to a buffer descriptor.
370  */
371 {
372 int     bytes_read;
373
374 #if DEBUG
375 printf("\nCharacter data(%d, %d, %d) requested\n", file_offset, no_bytes, cb_offset);
376 #endif
377 if (fseek(fdescr, (long)file_offset, (int)0) != 0)
378     {
379     printf("****** Error in seeking character\n");
380     fclose(fdescr);     
381     exit(1);
382     }
383
384 if ((no_bytes + cb_offset) > minchrsz)
385     {
386     printf("****** Character buffer overflow\n");
387     fclose(fdescr);     
388     exit(3);
389     }
390
391 bytes_read = fread((char_buffer + cb_offset), sizeof(ufix8), no_bytes, fdescr);
392 if (bytes_read != no_bytes)
393     {
394     printf("****** Error on reading character data\n");
395     fclose(fdescr);     
396     exit(2);
397     }
398
399 #if DEBUG
400 printf("Character data loaded\n");
401 #endif
402
403 char_data.org = (ufix8 FONTFAR *)char_buffer + cb_offset;
404 char_data.no_bytes = no_bytes;
405 return &char_data;
406 }
407 #endif
408
409 \f
410 #if REENTRANT_ALLOC
411 FUNCTION void sp_report_error(sp_global_ptr,n)
412 SPEEDO_GLOBALS *sp_global_ptr;
413 #else
414 FUNCTION void sp_report_error(n)
415 #endif
416 fix15 n;        /* Error identification number */
417 /*
418  * Called by Speedo character generator to report an error.
419  *
420  *  Since character data not available is one of those errors
421  *  that happens many times, don't report it to user
422  */
423 {
424
425 switch(n)
426     {
427 case 1:
428     printf("Insufficient font data loaded\n");
429     break;
430
431 case 3:
432     printf("Transformation matrix out of range\n");
433     break;
434
435 case 4:
436     printf("Font format error\n");
437     break;
438                  
439 case 5:
440     printf("Requested specs not compatible with output module\n");
441     break;
442
443 case 7:
444     printf("Intelligent transformation requested but not supported\n");
445     break;
446
447 case 8:
448     printf("Unsupported output mode requested\n");
449     break;
450
451 case 9:
452     printf("Extended font loaded but only compact fonts supported\n");
453     break;
454
455 case 10:
456     printf("Font specs not set prior to use of font\n");
457     break;
458
459 case 12:
460     break;
461
462 case 13:
463     printf("Track kerning data not available()\n");
464     break;
465
466 case 14:
467     printf("Pair kerning data not available()\n");
468     break;
469
470 default:
471     printf("report_error(%d)\n", n);
472     break;
473     }
474 }
475 \f
476 #if REENTRANT_ALLOC
477 FUNCTION void sp_open_bitmap(sp_global_ptr, x_set_width, y_set_width, xorg, yorg, xsize, ysize)
478 SPEEDO_GLOBALS *sp_global_ptr;
479 #else
480 FUNCTION void sp_open_bitmap(x_set_width, y_set_width, xorg, yorg, xsize, ysize)
481 #endif
482 fix31 x_set_width;
483 fix31 y_set_width;   /* Set width vector */
484 fix31 xorg;    /* Pixel boundary at left extent of bitmap character */
485 fix31 yorg;    /* Pixel boundary at right extent of bitmap character */
486 fix15 xsize;    /* Pixel boundary of bottom extent of bitmap character */
487 fix15 ysize;    /* Pixel boundary of top extent of bitmap character */
488 /* 
489  * Called by Speedo character generator to initialize a buffer prior
490  * to receiving bitmap data.
491  */
492 {
493 fix15 i;
494
495 #if DEBUG
496 printf("open_bitmap(%3.1f, %3.1f, %3.1f, %3.1f, %d, %d)\n",
497     (real)x_set_width / 65536.0, (real)y_set_width / 65536.0,
498     (real)xorg / 65536.0, (real)yorg / 65536.0, (int)xsize, (int)ysize);
499 #endif
500 raswid = xsize;
501 rashgt = ysize;
502 offhor = (fix15)(xorg >> 16);
503 offver = (fix15)(yorg >> 16);
504
505 if (raswid > MAX_BITS)
506     raswid = MAX_BITS;
507
508 printf("\nCharacter index = %d, ID = %d\n", char_index, char_id);
509 printf("set width = %3.1f, %3.1f\n", (real)x_set_width / 65536.0, (real)y_set_width / 65536.0);
510 printf("X offset  = %d\n", offhor);
511 printf("Y offset  = %d\n\n", offver);
512 for (i = 0; i < raswid; i++)
513     {
514     line_of_bits[i << 1] = '.';
515     line_of_bits[(i << 1) + 1] = ' ';
516     }
517 line_of_bits[raswid << 1] = '\0';
518 y_cur = 0;
519 }
520 \f
521 #if REENTRANT_ALLOC
522 FUNCTION void sp_set_bitmap_bits (sp_global_ptr, y, xbit1, xbit2)
523 SPEEDO_GLOBALS *sp_global_ptr;
524 #else
525 FUNCTION void sp_set_bitmap_bits (y, xbit1, xbit2)
526 #endif
527   fix15     y;     /* Scan line (0 = first row above baseline) */
528   fix15     xbit1; /* Pixel boundary where run starts */
529   fix15     xbit2; /* Pixel boundary where run ends */
530
531 /* 
532  * Called by Speedo character generator to write one row of pixels 
533  * into the generated bitmap character.                               
534  */
535
536 {
537 fix15 i;
538
539 #if DEBUG
540 printf("set_bitmap_bits(%d, %d, %d)\n", (int)y, (int)xbit1, (int)xbit2);
541 #endif
542 /* Clip runs beyond end of buffer */
543 if (xbit1 > MAX_BITS)
544     xbit1 = MAX_BITS;
545
546 if (xbit2 > MAX_BITS)
547     xbit2 = MAX_BITS;
548
549 /* Output backlog lines if any */
550 while (y_cur != y)
551     {
552     printf("    %s\n", line_of_bits);
553     for (i = 0; i < raswid; i++)
554         {
555         line_of_bits[i << 1] = '.';
556         }
557     y_cur++;
558     }
559
560 /* Add bits to current line */
561 for (i = xbit1; i < xbit2; i++)
562     {
563     line_of_bits[i << 1] = 'X';
564     }
565 }
566 \f
567 #if REENTRANT_ALLOC
568 FUNCTION void sp_close_bitmap(sp_global_ptr)
569 SPEEDO_GLOBALS *sp_global_ptr;
570 #else
571 FUNCTION void sp_close_bitmap()
572 #endif
573 /* 
574  * Called by Speedo character generator to indicate all bitmap data
575  * has been generated.
576  */
577 {
578 #if DEBUG
579 printf("close_bitmap()\n");
580 #endif
581 printf("    %s\n", line_of_bits);
582 }
583 \f
584 #if INCL_OUTLINE
585 #if REENTRANT_ALLOC
586 FUNCTION void sp_open_outline(sp_global_ptr, x_set_width, y_set_width, xmin, xmax, ymin, ymax)
587 SPEEDO_GLOBALS *sp_global_ptr;
588 #else
589 FUNCTION void sp_open_outline(x_set_width, y_set_width, xmin, xmax, ymin, ymax)
590 #endif
591 fix31 x_set_width;
592 fix31 y_set_width;  /* Transformed escapement vector */
593 fix31  xmin;                           /* Minimum X value in outline */
594 fix31  xmax;                           /* Maximum X value in outline */
595 fix31  ymin;                           /* Minimum Y value in outline */
596 fix31  ymax;                           /* Maximum Y value in outline */
597 /*
598  * Called by Speedo character generator to initialize prior to
599  * outputting scaled outline data.
600  */
601 {
602 printf("\nopen_outline(%3.1f, %3.1f, %3.1f, %3.1f, %3.1f, %3.1f)\n",
603     (real)x_set_width / 65536.0, (real)y_set_width / 65536.0,
604     (real)xmin / 65536.0, (real)xmax / 65536.0, (real)ymin / 65536.0, (real)ymax / 65536.0);
605 }
606
607 \f
608 #if REENTRANT_ALLOC
609 FUNCTION void sp_start_new_char(sp_global_ptr)
610 SPEEDO_GLOBALS *sp_global_ptr;
611 #else
612 FUNCTION void sp_start_new_char()
613 #endif
614 /*
615  * Called by Speedo character generator to initialize prior to
616  * outputting scaled outline data for a sub-character in a compound
617  * character.
618  */
619 {
620 printf("start_new_char()\n");
621 }
622 \f
623 #if REENTRANT_ALLOC
624 FUNCTION void sp_start_contour(sp_global_ptr, x, y, outside)
625 SPEEDO_GLOBALS *sp_global_ptr;
626 #else
627 FUNCTION void sp_start_contour(x, y, outside)
628 #endif
629 fix31    x;       /* X coordinate of start point in 1/65536 pixels */
630 fix31    y;       /* Y coordinate of start point in 1/65536 pixels */
631 boolean outside;  /* TRUE if curve encloses ink (Counter-clockwise) */
632 /*
633  * Called by Speedo character generator at the start of each contour
634  * in the outline data of the character.
635  */
636 {
637 printf("start_contour(%3.1f, %3.1f, %s)\n", 
638     (real)x / 65536.0, (real)y / 65536.0, 
639     outside? "outside": "inside");
640 }
641 \f
642 #if REENTRANT_ALLOC
643 FUNCTION void sp_curve_to(sp_global_ptr, x1, y1, x2, y2, x3, y3)
644 SPEEDO_GLOBALS *sp_global_ptr;
645 #else
646 FUNCTION void sp_curve_to(x1, y1, x2, y2, x3, y3)
647 #endif
648 fix31 x1;               /* X coordinate of first control point in 1/65536 pixels */
649 fix31 y1;               /* Y coordinate of first control  point in 1/65536 pixels */
650 fix31 x2;               /* X coordinate of second control point in 1/65536 pixels */
651 fix31 y2;               /* Y coordinate of second control point in 1/65536 pixels */
652 fix31 x3;               /* X coordinate of curve end point in 1/65536 pixels */
653 fix31 y3;               /* Y coordinate of curve end point in 1/65536 pixels */
654 /*
655  * Called by Speedo character generator onece for each curve in the
656  * scaled outline data of the character. This function is only called if curve
657  * output is enabled in the set_specs() call.
658  */
659 {
660 printf("curve_to(%3.1f, %3.1f, %3.1f, %3.1f, %3.1f, %3.1f)\n", 
661     (real)x1 / 65536.0, (real)y1 / 65536.0,
662     (real)x2 / 65536.0, (real)y2 / 65536.0,
663     (real)x3 / 65536.0, (real)y3 / 65536.0);
664 }
665 \f
666 #if REENTRANT_ALLOC
667 FUNCTION void sp_line_to(sp_global_ptr, x, y)
668 SPEEDO_GLOBALS *sp_global_ptr;
669 #else
670 FUNCTION void sp_line_to(x, y)
671 #endif
672 fix31 x;               /* X coordinate of vector end point in 1/65536 pixels */
673 fix31 y;               /* Y coordinate of vector end point in 1/65536 pixels */
674 /*
675  * Called by Speedo character generator onece for each vector in the
676  * scaled outline data for the character. This include curve data that has
677  * been sub-divided into vectors if curve output has not been enabled
678  * in the set_specs() call.
679  */
680 {
681 printf("line_to(%3.1f, %3.1f)\n", 
682     (real)x / 65536.0, (real)y / 65536.0);
683 }
684
685 \f
686 #if REENTRANT_ALLOC
687 FUNCTION void sp_close_contour(sp_global_ptr)
688 SPEEDO_GLOBALS *sp_global_ptr;
689 #else
690 FUNCTION void sp_close_contour()
691 #endif
692 /*
693  * Called by Speedo character generator at the end of each contour
694  * in the outline data of the character.
695  */
696 {
697 printf("close_contour()\n");
698 }
699 \f
700 #if REENTRANT_ALLOC
701 FUNCTION void sp_close_outline(sp_global_ptr)
702 SPEEDO_GLOBALS *sp_global_ptr;
703 #else
704 FUNCTION void sp_close_outline()
705 #endif
706 /*
707  * Called by Speedo character generator at the end of output of the
708  * scaled outline of the character.
709  */
710 {
711 printf("close_outline()\n");
712 }
713
714 #endif
715 \f
716 FUNCTION fix15 read_2b(pointer)
717 ufix8 FONTFAR *pointer;
718 /*
719  * Reads 2-byte field from font buffer 
720  */
721 {
722 fix15 temp;
723
724 temp = *pointer++;
725 temp = (temp << 8) + *(pointer);
726 return temp;
727 }
728
729
730 \fFUNCTION fix31 read_4b(pointer)
731 ufix8 FONTFAR *pointer;
732 /*
733  * Reads 4-byte field from font buffer 
734  */
735 {
736 fix31 temp;
737
738 temp = *pointer++;
739 temp = (temp << 8) + *(pointer++);
740 temp = (temp << 8) + *(pointer++);
741 temp = (temp << 8) + *(pointer);
742 return temp;
743 }
744
745