1 /* $XConsortium: speedo.h,v 1.7 95/06/08 23:20:39 gildea Exp $ */
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.
13 BITSTREAM CHARTER is a registered trademark of Bitstream Inc.
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.
30 /***************************** S P E E D O . H *******************************
31 ****************************************************************************/
33 /***** USER OPTIONS OVERRIDE DEFAULTS ******/
36 /***** CONFIGURATION DEFINITIONS *****/
39 #define INCL_CLIPPING 0 /* 0 indicates CLIPPING code is not compiled in*/
42 #ifndef INCL_SQUEEZING
43 #define INCL_SQUEEZING 0 /* 0 indicates SQUEEZE code is not compiled in*/
47 #define INCL_EXT 1 /* 1 to include extended font support */
48 #endif /* 0 to omit extended font support */
51 #define INCL_RULES 1 /* 1 to include intelligent scaling support */
52 #endif /* 0 to omit intelligent scaling support */
55 #define INCL_BLACK 1 /* 1 to include blackwriter output support */
56 #endif /* 0 to omit output mode 0 support */
59 #define INCL_SCREEN 0 /* 1 to include screen writeroutput support */
60 #endif /* 0 to omit support */
63 #define INCL_OUTLINE 0 /* 1 to include outline output support */
64 #endif /* 0 to omit output mode 2 support */
67 #define INCL_2D 0 /* 1 to include 2d blackwriter output support */
68 #endif /* 0 to omit output mode 3 support */
71 #define INCL_USEROUT 0 /* 1 to include user defined output module support */
72 #endif /* 0 to omit user defined output module support */
75 #define INCL_LCD 1 /* 1 to include load char data support*/
76 #endif /* 0 to omit load char data support */
78 #define INCL_ISW 0 /* 1 to include imported width support */
79 #endif /* 0 to omit imported width support */
82 #define INCL_METRICS 1 /* 1 to include metrics support */
83 #endif /* 0 to omit metrics support */
86 #define INCL_KEYS 0 /* 1 to include multi key support */
87 #endif /* 0 to omit multi key support */
90 #define INCL_MULTIDEV 0 /* 1 to include multiple output device support */
91 #endif /* 0 to omit multi device support */
94 #define SHORT_LISTS 1 /* 1 to allocate small intercept lists */
97 #ifndef PROTOS_AVAIL /* 1 to use function prototyping */
98 #define PROTOS_AVAIL 0 /* 0 to suppress it */
101 #ifndef FONTFAR /* if Intel mixed memory model implementation */
102 #define FONTFAR /* pointer type modifier for font buffer */
105 #ifndef STACKFAR /* if Intel mixed memory model implementation */
106 #define STACKFAR /* pointer type modifier for font buffer */
114 #define MODE_SCREEN MODE_BLACK + INCL_BLACK
115 #define MODE_OUTLINE MODE_SCREEN + INCL_SCREEN
116 #define MODE_2D MODE_OUTLINE + INCL_OUTLINE
120 #define STATIC_ALLOC 0
124 #ifdef REENTRANT_ALLOC
126 #define STATIC_ALLOC 0
131 #define STATIC_ALLOC 1
134 #ifndef DYNAMIC_ALLOC
135 #define DYNAMIC_ALLOC 0
138 #ifndef REENTRANT_ALLOC
139 #define REENTRANT_ALLOC 0
142 /***** TYPE DEFINITIONS *****/
153 typedef CARD8 boolean;
159 typedef CARD16 ufix16;
163 typedef CARD32 ufix32;
166 /***** GENERAL CONSTANTS *****/
188 #if INCL_EXT /* Extended fonts supported? */
190 #define MAX_CONSTR 750 /* Max constraints (incl 4 dummies) */
191 #define MAX_CTRL_ZONES 256 /* Max number of controlled orus */
192 #define MAX_INT_ZONES 256 /* Max number of interpolation zones */
194 #else /* Compact fonts only supported */
196 #define MAX_CONSTR 512 /* Max constraints (incl 4 dummies) */
197 #define MAX_CTRL_ZONES 64 /* Max number of controlled orus */
198 #define MAX_INT_ZONES 64 /* Max number of interpolation zones */
202 #define SCALE_SHIFT 12 /* Binary point positiion for scale values */
203 #define SCALE_RND 2048 /* Rounding bit for scaling transformation */
204 #define ONE_SCALE 4096 /* Unity scale value */
206 #ifdef INCL_SCREEN /* constants used by Screenwriter module */
207 #define LEFT_INT 1 /* left intercept */
208 #define END_INT 2 /* last intercept */
209 #define FRACTION 0xFC /* fractional portion of intercept type list */
212 #if INCL_SQUEEZING || INCL_CLIPPING /* constants used by SQUEEZEing code */
217 /***** STRUCTURE DEFINITIONS *****/
221 #define PROTO_DECL1 struct speedo_global_data GLOBALFAR *sp_global_ptr
222 #define PROTO_DECL2 PROTO_DECL1 ,
224 #define PROTO_DECL1 void
232 ufix8 FONTFAR *org; /* Pointer to start of buffer */
233 ufix32 no_bytes; /* Size of buffer in bytes */
235 buff_t; /* Buffer descriptor */
237 typedef struct constr_tag
239 ufix8 FONTFAR *org; /* Pointer to first byte in constr data */
240 ufix16 font_id; /* Font id for calculated data */
241 fix15 xppo; /* X pixels per oru for calculated data */
242 fix15 yppo; /* Y pixels per oru for calculated data */
243 boolean font_id_valid; /* TRUE if font id valid */
244 boolean data_valid; /* TRUE if calculated data valid */
245 boolean active; /* TRUE if constraints enabled */
247 constr_t; /* Constraint data state */
249 typedef struct kern_tag
251 ufix8 FONTFAR *tkorg; /* First byte of track kerning data */
252 ufix8 FONTFAR *pkorg; /* First byte of pair kerning data */
253 fix15 no_tracks; /* Number of kerning tracks */
254 fix15 no_pairs; /* Number of kerning pairs */
256 kern_t; /* Kerning control block */
258 typedef struct specs_tag
260 buff_t STACKFAR *pfont; /* Pointer to font data */
261 fix31 xxmult; /* Coeff of X orus to compute X pix */
262 fix31 xymult; /* Coeff of Y orus to compute X pix */
263 fix31 xoffset; /* Constant to compute X pix */
264 fix31 yxmult; /* Coeff of X orus to compute Y pix */
265 fix31 yymult; /* Coeff of Y orus to compute Y pix */
266 fix31 yoffset; /* Constant to compute Y pix */
267 ufix32 flags; /* Mode flags: */
268 /* Bit 0 - 2: Output module selector: */
269 /* Bit 3: Send curves to output module*/
270 /* Bit 4: Use linear scaling if set */
271 /* Bit 5: Inhibit constraint table */
272 /* Bit 6: Import set width if set */
273 /* Bit 7: not used */
274 /* Bit 8: Squeeze left if set */
275 /* Bit 9: Squeeze right if set */
276 /* Bit 10: Squeeze top if set */
277 /* Bit 11: Squeeze bottom if set */
278 /* Bit 12: Clip left if set */
279 /* Bit 13: Clip right if set */
280 /* Bit 14: Clip top if set */
281 /* Bit 15: Clip bottom if set */
282 /* Bits 16-31 not used */
284 void *out_info; /* information for output module */
289 specs_t; /* Specs structure for fw_set_specs */
291 typedef struct tcb_tag
293 fix15 xxmult; /* Linear coeff of Xorus to compute Xpix */
294 fix15 xymult; /* Linear coeff of Yorus to compute Xpix */
295 fix31 xoffset; /* Linear constant to compute Xpix */
296 fix15 yxmult; /* Linear coeff of Xorus to compute Ypix */
297 fix15 yymult; /* Linear coeff of Yorus to compute Ypix */
298 fix31 yoffset; /* Linear constant to compute Ypix */
299 fix15 xppo; /* Pixels per oru in X dimension of char */
300 fix15 yppo; /* Pixels per oru in Y dimension of char */
301 fix15 xpos; /* Origin in X dimension of character */
302 fix15 ypos; /* Origin in Y dimension of character */
303 ufix16 xtype; /* Transformation type for X oru coords */
304 ufix16 ytype; /* Transformation type for Y oru coords */
305 ufix16 xmode; /* Transformation mode for X oru coords */
306 ufix16 ymode; /* Transformation mode for Y oru coords */
307 fix15 mirror; /* Transformation creates mirror image */
309 tcb_t; /* Transformation control block */
311 typedef struct point_tag
313 fix15 x; /* X coord of point (shifted pixels) */
314 fix15 y; /* Y coord of point (shifted pixels) */
316 point_t; /* Point in device space */
318 typedef struct band_tag
322 fix15 band_array_offset;
327 typedef struct bbox_tag
336 #define MAX_INTERCEPTS 256 /* Max storage for intercepts */
337 typedef ufix8 cdr_t; /* 8 bit links in intercept chains */
339 #define MAX_INTERCEPTS 1000 /* Max storage for intercepts */
340 typedef ufix16 cdr_t; /* 16 bit links in intercept chains */
345 typedef struct intercepts_tag
347 fix15 car[MAX_INTERCEPTS];
348 fix15 cdr[MAX_INTERCEPTS];
350 ufix8 inttype[MAX_INTERCEPTS];
356 typedef struct plaid_tag
358 fix15 orus[MAX_CTRL_ZONES]; /* Controlled coordinate table (orus) */
360 fix15 pix[MAX_CTRL_ZONES]; /* Controlled coordinate table (sub-pixels) */
361 fix15 mult[MAX_INT_ZONES]; /* Interpolation multiplier table */
362 fix31 offset[MAX_INT_ZONES]; /* Interpolation offset table */
369 typedef struct bitmap_tag
371 void (*p_open_bitmap)(PROTO_DECL2 fix31 x_set_width, fix31 y_set_width, fix31 xorg, fix31 yorg, fix15 xsize,fix15 ysize);
372 void (*p_set_bits)(PROTO_DECL2 fix15 y, fix15 xbit1, fix15 xbit2);
373 void (*p_close_bitmap)(PROTO_DECL1);
376 typedef struct outline_tag
378 void (*p_open_outline)(PROTO_DECL2 fix31 x_set_width, fix31 y_set_width, fix31 xmin, fix31 xmax, fix31 ymin,fix31 ymax);
379 void (*p_start_char)(PROTO_DECL1);
380 void (*p_start_contour)(PROTO_DECL2 fix31 x,fix31 y,boolean outside);
381 void (*p_curve)(PROTO_DECL2 fix31 x1, fix31 y1, fix31 x2, fix31 y2, fix31 x3, fix31 y3);
382 void (*p_line)(PROTO_DECL2 fix31 x, fix31 y);
383 void (*p_close_contour)(PROTO_DECL1);
384 void (*p_close_outline)(PROTO_DECL1);
387 typedef struct bitmap_tag
389 void (*p_open_bitmap)();
390 void (*p_set_bits)();
391 void (*p_close_bitmap)();
394 typedef struct outline_tag
396 void (*p_open_outline)();
397 void (*p_start_char)();
398 void (*p_start_contour)();
401 void (*p_close_contour)();
402 void (*p_close_outline)();
407 /* ---------------------------------------------------*/
408 /**** MAIN GLOBAL DATA STRUCTURE, SPEEDO_GLOBALS *****/
410 typedef struct speedo_global_data
412 /* do_char.c data definitions */
413 #if INCL_METRICS /* Metrics functions supported? */
414 kern_t kern; /* Kerning control block */
415 #endif /* endif incl_metrics */
416 point_t Psw; /* End of escapement vector (1/65536 pixel units) */
418 #if INCL_LCD /* Dynamic load character data supported? */
419 fix15 cb_offset; /* Offset to sub-char data in char buffer */
420 #endif /* endif incl_lcd */
422 /* do_trns.c data definitions */
423 point_t P0; /* Current point (sub-pixels) */
424 fix15 x_orus; /* Current X argument (orus) */
425 fix15 y_orus; /* Current Y argument (orus) */
426 fix15 x_pix; /* Current X argument (sub-pixels) */
427 fix15 y_pix; /* Current Y argument (sub-pixels) */
428 ufix8 x_int; /* Current X interpolation zone */
429 ufix8 y_int; /* Current Y interpolation zone */
431 #if INCL_MULTIDEV && INCL_OUTLINE
432 outline_t outline_device;
433 boolean outline_device_set;
436 #if INCL_BLACK || INCL_SCREEN || INCL_2D
438 bitmap_t bitmap_device;
439 boolean bitmap_device_set;
441 band_t y_band; /* Y current band(whole pixels) */
447 } set_width; /* Character escapement vector */
449 boolean first_pass; /* TRUE during first pass thru outline data */
450 boolean extents_running; /* T if extent accumulation for each vector */
451 fix15 x0_spxl; /* X coord of current point (sub pixels) */
452 fix15 y0_spxl; /* Y coord of current point (sub pixels) */
453 fix15 y_pxl; /* Y coord of current point (whole pixels) */
455 intercepts_t STACKFAR *intercepts;
456 #else /* else if not reentrant */
457 fix15 car[MAX_INTERCEPTS]; /* Data field of intercept storage */
458 cdr_t cdr[MAX_INTERCEPTS]; /* Link field of intercept storage */
460 ufix8 inttype[MAX_INTERCEPTS];
463 #endif /* endif incl_screen */
464 #endif /* endif reentrant */
465 fix15 bmap_xmin; /* Min X value (sub-pixel units) */
466 fix15 bmap_xmax; /* Max X value (sub-pixel units) */
467 fix15 bmap_ymin; /* Min Y value (sub-pixel units) */
468 fix15 bmap_ymax; /* Max Y value (sub-pixel units) */
469 fix15 no_y_lists; /* Number of active intercept lists */
470 fix15 first_offset; /* Index of first active list cell */
471 fix15 next_offset; /* Index of next free list cell */
472 boolean intercept_oflo; /* TRUE if intercepts data lost */
473 #endif /* endif incl_black, incl_screen, incl_2d */
475 /* bounding box now used by all output modules, including outline */
476 fix15 xmin; /* Min X value in whole character */
477 fix15 xmax; /* Max X value in whole character */
478 fix15 ymin; /* Min Y value in whole character */
479 fix15 ymax; /* Max Y value in whole character */
482 fix15 no_x_lists; /* Number of active x intercept lists */
483 band_t x_band; /* X current band(whole pixels) */
484 boolean x_scan_active; /* X scan flag during scan conversion */
487 /* reset.c data definitions */
488 ufix16 key32; /* Decryption keys 3,2 combined */
489 ufix8 key4; /* Decryption key 4 */
490 ufix8 key6; /* Decryption key 6 */
491 ufix8 key7; /* Decryption key 7 */
492 ufix8 key8; /* Decryption key 8 */
494 /* set_spcs.c data definitions */
496 buff_t GLOBALFAR *pfont; /* Pointer to font buffer structure */
497 fix31 font_buff_size; /* Number of bytes loaded in font buffer */
498 ufix8 FONTFAR *pchar_dir; /* Pointer to character directory */
499 fix15 first_char_idx; /* Index to first character in font */
500 fix15 no_chars_avail; /* Total characters in font layout */
501 fix15 orus_per_em; /* Outline resolution */
502 fix15 metric_resolution; /* metric resolution for setwidths, kerning pairs
503 (defaults to orus_per_em) */
504 tcb_t tcb0; /* Top level transformation control block */
506 boolean specs_valid; /* TRUE if fw_set_specs() successful */
508 fix15 depth_adj; /* Curve splitting depth adjustment */
509 boolean curves_out; /* Allow curves to output module */
510 fix15 output_mode; /* Output module selector */
511 fix15 thresh; /* Scan conversion threshold (sub-pixels) */
512 boolean normal; /* TRUE if 0 obl and mult of 90 deg rot */
514 fix15 multshift; /* Fixed point shift for multipliers */
515 fix15 pixshift; /* Fixed point shift for sub-pixels */
516 fix15 poshift; /* Left shift from pixel to output format */
517 fix15 mpshift; /* Fixed point shift for mult to sub-pixels */
518 fix31 multrnd; /* 0.5 in multiplier units */
519 fix15 pixrnd; /* 0.5 in sub-pixel units */
520 fix31 mprnd; /* 0.5 sub-pixels in multiplier units */
521 fix15 pixfix; /* Mask to remove fractional pixels */
522 fix15 onepix; /* 1.0 pixels in sub-pixel units */
525 boolean (*init_out)(PROTO_DECL2 specs_t GLOBALFAR *specsarg);
526 boolean (*begin_char)(PROTO_DECL2 point_t Psw,point_t Pmin,point_t Pmax);
527 void (*begin_sub_char)(PROTO_DECL2 point_t Psw,point_t Pmin,point_t Pmax);
528 void (*begin_contour)(PROTO_DECL2 point_t P1,boolean outside);
529 void (*curve)(PROTO_DECL2 point_t P1, point_t P2, point_t P3, fix15 depth);
530 void (*line)(PROTO_DECL2 point_t P1);
531 void (*end_contour)(PROTO_DECL1);
532 void (*end_sub_char)(PROTO_DECL1);
533 boolean (*end_char)(PROTO_DECL1);
534 #else /* if not protos */
535 boolean (*init_out)();
536 boolean (*begin_char)();
537 void (*begin_sub_char)();
538 void (*begin_contour)();
541 void (*end_contour)();
542 void (*end_sub_char)();
543 boolean (*end_char)();
544 #endif /* end not protos */
546 specs_t GLOBALFAR *pspecs; /* Pointer to specifications bundle */
547 specs_t specs; /* copy specs onto stack */
548 ufix8 FONTFAR *font_org; /* Pointer to start of font data */
549 ufix8 FONTFAR *hdr2_org; /* Pointer to start of private header data */
551 /* set_trns.c data definitions */
552 tcb_t tcb; /* Current transformation control block */
553 ufix8 Y_edge_org; /* Index to first Y controlled coordinate */
554 ufix8 Y_int_org; /* Index to first Y interpolation zone */
555 fix31 rnd_xmin; /* rounded out value of xmin for int-char spac. fix */
558 plaid_t STACKFAR *plaid;
559 #else /* if not reentrant */
560 fix15 orus[MAX_CTRL_ZONES]; /* Controlled coordinate table (orus) */
562 fix15 pix[MAX_CTRL_ZONES]; /* Controlled coordinate table (sub-pixels) */
563 fix15 mult[MAX_INT_ZONES]; /* Interpolation multiplier table */
564 fix31 offset[MAX_INT_ZONES]; /* Interpolation offset table */
565 #endif /* endif incl_rules */
566 #endif /* endif not reentrant */
568 fix15 no_X_orus; /* Number of X controlled coordinates */
569 fix15 no_Y_orus; /* Number of Y controlled coordinates */
570 ufix16 Y_constr_org; /* Origin of constraint table in font data */
573 constr_t constr; /* Constraint data state */
574 boolean c_act[MAX_CONSTR]; /* TRUE if constraint currently active */
575 fix15 c_pix[MAX_CONSTR]; /* Size of constrained zone if active */
578 boolean import_setwidth_act; /* boolean to indicate imported setwidth */
579 boolean isw_modified_constants;
580 ufix32 imported_width; /* value of imported setwidth */
581 fix15 isw_xmax; /* maximum oru value for constants*/
583 #if INCL_SQUEEZING || INCL_ISW
584 fix15 setwidth_orus; /* setwidth value in orus */
585 /* bounding box in orus for squeezing */
586 fix15 bbox_xmin_orus; /* X minimum in orus */
587 fix15 bbox_xmax_orus; /* X maximum in orus */
588 fix15 bbox_ymin_orus; /* Y minimum in orus */
589 fix15 bbox_ymax_orus; /* Y maximum in orus */
591 #ifdef INCL_SQUEEZING
592 boolean squeezing_compound; /* flag to indicate a compound character*/
602 /***********************************************************************************
604 * Speedo global data structure allocation
606 ***********************************************************************************/
611 #define EXTERN extern
614 EXTERN SPEEDO_GLOBALS GLOBALFAR sp_globals;
615 #define sp_intercepts sp_globals
616 #define sp_plaid sp_globals
619 EXTERN SPEEDO_GLOBALS GLOBALFAR *sp_global_ptr;
620 #define sp_globals (*sp_global_ptr)
621 #define sp_intercepts (*sp_global_ptr)
622 #define sp_plaid (*sp_global_ptr)
625 #define sp_globals (*sp_global_ptr)
626 #define sp_intercepts (*(*sp_global_ptr).intercepts)
627 #define sp_plaid (*(*sp_global_ptr).plaid)
636 /***** PUBLIC FONT HEADER OFFSET CONSTANTS *****/
637 #define FH_FMVER 0 /* U D4.0 CR LF NULL NULL 8 bytes */
638 #define FH_FNTSZ 8 /* U Font size (bytes) 4 bytes */
639 #define FH_FBFSZ 12 /* U Min font buffer size (bytes) 4 bytes */
640 #define FH_CBFSZ 16 /* U Min char buffer size (bytes) 2 bytes */
641 #define FH_HEDSZ 18 /* U Header size (bytes) 2 bytes */
642 #define FH_FNTID 20 /* U Source Font ID 2 bytes */
643 #define FH_SFVNR 22 /* U Source Font Version Number 2 bytes */
644 #define FH_FNTNM 24 /* U Source Font Name 70 bytes */
645 #define FH_MDATE 94 /* U Manufacturing Date 10 bytes */
646 #define FH_LAYNM 104 /* U Layout Name 70 bytes */
647 #define FH_CPYRT 174 /* U Copyright Notice 78 bytes */
648 #define FH_NCHRL 252 /* U Number of Chars in Layout 2 bytes */
649 #define FH_NCHRF 254 /* U Total Number of Chars in Font 2 bytes */
650 #define FH_FCHRF 256 /* U Index of first char in Font 2 bytes */
651 #define FH_NKTKS 258 /* U Number of kerning tracks in font 2 bytes */
652 #define FH_NKPRS 260 /* U Number of kerning pairs in font 2 bytes */
653 #define FH_FLAGS 262 /* U Font flags 1 byte: */
654 /* Bit 0: Extended font */
655 /* Bit 1: not used */
656 /* Bit 2: not used */
657 /* Bit 3: not used */
658 /* Bit 4: not used */
659 /* Bit 5: not used */
660 /* Bit 6: not used */
661 /* Bit 7: not used */
662 #define FH_CLFGS 263 /* U Classification flags 1 byte: */
664 /* Bit 1: Monospace */
667 /* Bit 4: not used */
668 /* Bit 5: not used */
669 /* Bit 6: not used */
670 /* Bit 7: not used */
671 #define FH_FAMCL 264 /* U Family Classification 1 byte: */
676 /* 4: Script or calligraphic */
678 /* 6-255: not used */
679 #define FH_FRMCL 265 /* U Font form Classification 1 byte: */
680 /* Bits 0-3 (width type): */
684 /* 6: Semi-condensed */
688 /* 10: Semi-expanded */
691 /* 13-15: not used */
692 /* Bits 4-7 (Weight): */
708 /* 15-16: not used */
709 #define FH_SFNTN 266 /* U Short Font Name 32 bytes */
710 #define FH_SFACN 298 /* U Short Face Name 16 bytes */
711 #define FH_FNTFM 314 /* U Font form 14 bytes */
712 #define FH_ITANG 328 /* U Italic angle 2 bytes (1/256th deg) */
713 #define FH_ORUPM 330 /* U Number of ORUs per em 2 bytes */
714 #define FH_WDWTH 332 /* U Width of Wordspace 2 bytes */
715 #define FH_EMWTH 334 /* U Width of Emspace 2 bytes */
716 #define FH_ENWTH 336 /* U Width of Enspace 2 bytes */
717 #define FH_TNWTH 338 /* U Width of Thinspace 2 bytes */
718 #define FH_FGWTH 340 /* U Width of Figspace 2 bytes */
719 #define FH_FXMIN 342 /* U Font-wide min X value 2 bytes */
720 #define FH_FYMIN 344 /* U Font-wide min Y value 2 bytes */
721 #define FH_FXMAX 346 /* U Font-wide max X value 2 bytes */
722 #define FH_FYMAX 348 /* U Font-wide max Y value 2 bytes */
723 #define FH_ULPOS 350 /* U Underline position 2 bytes */
724 #define FH_ULTHK 352 /* U Underline thickness 2 bytes */
725 #define FH_SMCTR 354 /* U Small caps transformation 6 bytes */
726 #define FH_DPSTR 360 /* U Display sups transformation 6 bytes */
727 #define FH_FNSTR 366 /* U Footnote sups transformation 6 bytes */
728 #define FH_ALSTR 372 /* U Alpha sups transformation 6 bytes */
729 #define FH_CMITR 378 /* U Chemical infs transformation 6 bytes */
730 #define FH_SNMTR 384 /* U Small nums transformation 6 bytes */
731 #define FH_SDNTR 390 /* U Small denoms transformation 6 bytes */
732 #define FH_MNMTR 396 /* U Medium nums transformation 6 bytes */
733 #define FH_MDNTR 402 /* U Medium denoms transformation 6 bytes */
734 #define FH_LNMTR 408 /* U Large nums transformation 6 bytes */
735 #define FH_LDNTR 414 /* U Large denoms transformation 6 bytes */
736 /* Transformation data format: */
737 /* Y position 2 bytes */
738 /* X scale 2 bytes (1/4096ths) */
739 /* Y scale 2 bytes (1/4096ths) */
740 #define SIZE_FW FH_LDNTR + 6 /* size of nominal font header */
741 #define EXP_FH_METRES SIZE_FW /* offset to expansion field metric resolution (optional) */
745 /***** MODE FLAGS CONSTANTS *****/
746 #define CURVES_OUT 0X0008 /* Output module accepts curves */
747 #define BOGUS_MODE 0X0010 /* Linear scaling mode */
748 #define CONSTR_OFF 0X0020 /* Inhibit constraint table */
749 #define IMPORT_WIDTHS 0X0040 /* Imported width mode */
750 #define SQUEEZE_LEFT 0X0100 /* Squeeze left mode */
751 #define SQUEEZE_RIGHT 0X0200 /* Squeeze right mode */
752 #define SQUEEZE_TOP 0X0400 /* Squeeze top mode */
753 #define SQUEEZE_BOTTOM 0X0800 /* Squeeze bottom mode */
754 #define CLIP_LEFT 0X1000 /* Clip left mode */
755 #define CLIP_RIGHT 0X2000 /* Clip right mode */
756 #define CLIP_TOP 0X4000 /* Clip top mode */
757 #define CLIP_BOTTOM 0X8000 /* Clip bottom mode */
759 /***********************************************************************************
761 * Speedo function declarations - use prototypes if available
763 ***********************************************************************************/
766 /* do_char.c functions */
767 ufix16 sp_get_char_id(PROTO_DECL2 ufix16 char_index);
768 boolean sp_make_char(PROTO_DECL2 ufix16 char_index);
770 fix31 sp_compute_isw_scale(PROTO_DECL2);
771 static boolean sp_do_make_char(PROTO_DECL2 ufix16 char_index);
772 boolean sp_make_char_isw(PROTO_DECL2 ufix16 char_index, ufix32 imported_width);
773 static boolean sp_reset_xmax(PROTO_DECL2 fix31 xmax);
775 #if INCL_ISW || INCL_SQUEEZING
776 static void sp_preview_bounding_box(PROTO_DECL2 ufix8 FONTFAR *pointer,ufix8 format);
779 #if INCL_METRICS /* Metrics functions supported? */
780 fix31 sp_get_char_width(PROTO_DECL2 ufix16 char_index);
781 fix15 sp_get_track_kern(PROTO_DECL2 fix15 track,fix15 point_size);
782 fix31 sp_get_pair_kern(PROTO_DECL2 ufix16 char_index1,ufix16 char_index2);
783 boolean sp_get_char_bbox(PROTO_DECL2 ufix16 char_index, bbox_t *bbox);
786 /* do_trns.c functions */
787 ufix8 FONTFAR *sp_read_bbox(PROTO_DECL2 ufix8 FONTFAR *pointer,point_t STACKFAR *pPmin,point_t STACKFAR *pPmax,boolean set_flag);
788 void sp_proc_outl_data(PROTO_DECL2 ufix8 FONTFAR *pointer);
790 /* out_blk.c functions */
792 boolean sp_init_black(PROTO_DECL2 specs_t GLOBALFAR *specsarg);
793 boolean sp_begin_char_black(PROTO_DECL2 point_t Psw,point_t Pmin,point_t Pmax);
794 void sp_begin_contour_black(PROTO_DECL2 point_t P1,boolean outside);
795 void sp_line_black(PROTO_DECL2 point_t P1);
796 boolean sp_end_char_black(PROTO_DECL1);
799 /* out_scrn.c functions */
801 boolean sp_init_screen(PROTO_DECL2 specs_t GLOBALFAR *specsarg);
802 boolean sp_begin_char_screen(PROTO_DECL2 point_t Psw,point_t Pmin,point_t Pmax);
803 void sp_begin_contour_screen(PROTO_DECL2 point_t P1,boolean outside);
804 void sp_curve_screen(PROTO_DECL2 point_t P1,point_t P2,point_t P3, fix15 depth);
805 void sp_scan_curve_screen(PROTO_DECL2 fix31 X0,fix31 Y0,fix31 X1,fix31 Y1,fix31 X2,fix31 Y2,fix31 X3,fix31 Y3);
806 void sp_vert_line_screen(PROTO_DECL2 fix31 x, fix15 y1, fix15 y2);
807 void sp_line_screen(PROTO_DECL2 point_t P1);
808 void sp_end_contour_screen(PROTO_DECL1);
809 boolean sp_end_char_screen(PROTO_DECL1);
812 /* out_outl.c functions */
815 boolean sp_set_outline_device(PROTO_DECL2 outline_t *ofuncs, ufix16 size);
819 boolean sp_init_outline(PROTO_DECL2 specs_t GLOBALFAR *specsarg);
820 boolean sp_begin_char_outline(PROTO_DECL2 point_t Psw,point_t Pmin,point_t Pmax);
821 void sp_begin_sub_char_outline(PROTO_DECL2 point_t Psw,point_t Pmin,point_t Pmax);
822 void sp_begin_contour_outline(PROTO_DECL2 point_t P1,boolean outside);
823 void sp_curve_outline(PROTO_DECL2 point_t P1,point_t P2,point_t P3, fix15 depth);
824 void sp_line_outline(PROTO_DECL2 point_t P1);
825 void sp_end_contour_outline(PROTO_DECL1);
826 void sp_end_sub_char_outline(PROTO_DECL1);
827 boolean sp_end_char_outline(PROTO_DECL1);
830 /* out_bl2d.c functions */
832 boolean sp_init_2d(PROTO_DECL2 specs_t GLOBALFAR *specsarg);
833 boolean sp_begin_char_2d(PROTO_DECL2 point_t Psw,point_t Pmin,point_t Pmax);
834 void sp_begin_contour_2d(PROTO_DECL2 point_t P1,boolean outside);
835 void sp_line_2d(PROTO_DECL2 point_t P1);
836 boolean sp_end_char_2d(PROTO_DECL1);
839 /* out_util.c functions */
840 #if INCL_BLACK || INCL_SCREEN || INCL_2D
843 boolean sp_set_bitmap_device(PROTO_DECL2 bitmap_t *bfuncs, ufix16 size);
846 void sp_init_char_out(PROTO_DECL2 point_t Psw, point_t Pmin, point_t Pmax);
847 void sp_begin_sub_char_out(PROTO_DECL2 point_t Psw, point_t Pmin, point_t Pmax);
848 void sp_curve_out(PROTO_DECL2 point_t P1, point_t P2, point_t P3, fix15 depth);
849 void sp_end_contour_out(PROTO_DECL1);
850 void sp_end_sub_char_out(PROTO_DECL1);
851 void sp_init_intercepts_out(PROTO_DECL1);
852 void sp_restart_intercepts_out(PROTO_DECL1);
853 void sp_set_first_band_out(PROTO_DECL2 point_t Pmin, point_t Pmax);
854 void sp_reduce_band_size_out(PROTO_DECL1);
855 boolean sp_next_band_out(PROTO_DECL1);
859 boolean sp_init_userout(specs_t *specsarg);
863 /* reset.c functions */
864 void sp_reset(PROTO_DECL1);
866 void sp_set_key(PROTO_DECL2 ufix8 key[]);
868 ufix16 sp_get_cust_no(PROTO_DECL2 buff_t font_buff);
870 /* set_spcs.c functions */
871 boolean sp_set_specs(PROTO_DECL2 specs_t STACKFAR *specsarg);
872 void sp_type_tcb(PROTO_DECL2 tcb_t GLOBALFAR *ptcb);
874 fix31 sp_read_long(PROTO_DECL2 ufix8 FONTFAR *pointer);
875 fix15 sp_read_word_u(PROTO_DECL2 ufix8 FONTFAR *pointer);
877 /* set_trns.c functions */
878 void sp_init_tcb(PROTO_DECL1);
879 void sp_scale_tcb(PROTO_DECL2 tcb_t GLOBALFAR *ptcb,fix15 x_pos,fix15 y_pos,fix15 x_scale,fix15 y_scale);
880 ufix8 FONTFAR *sp_plaid_tcb(PROTO_DECL2 ufix8 FONTFAR *pointer,ufix8 format);
881 ufix8 FONTFAR *sp_skip_interpolation_table(PROTO_DECL2 ufix8 FONTFAR *pointer, ufix8 format);
882 ufix8 FONTFAR *sp_skip_control_zone(PROTO_DECL2 ufix8 FONTFAR *pointer, ufix8 format);
884 ufix8 FONTFAR *sp_read_oru_table(PROTO_DECL2 ufix8 FONTFAR *pointer);
885 #if INCL_SQUEEZING || INCL_ISW
886 static void sp_calculate_x_pix(PROTO_DECL2 ufix8 start_edge,ufix8 end_edge,ufix16 constr_nr,fix31 x_scale,fix31 x_offset,fix31 ppo,fix15 setwidth_pix);
889 static void sp_calculate_y_pix(PROTO_DECL2 ufix8 start_edge,ufix8 end_edge,ufix16 constr_nr,fix31 top_scale,fix31 bottom_scale,fix31 ppo,fix15 emtop_pix,fix15 embot_pix);
890 boolean sp_calculate_x_scale(PROTO_DECL2 fix31 *x_factor,fix31 *x_offset,fix15 no_x_ctrl_zones);
891 boolean sp_calculate_y_scale(PROTO_DECL2 fix31 *top_scale,fix31 *bottom_scale,fix15 first_y_zone, fix15 no_Y_ctrl_zones);
895 /* user defined functions */
897 void sp_report_error(PROTO_DECL2 fix15 n);
899 #if INCL_BLACK || INCL_SCREEN || INCL_2D
900 void sp_open_bitmap(PROTO_DECL2 fix31 x_set_width, fix31 y_set_width, fix31 xorg, fix31 yorg, fix15 xsize,fix15 ysize);
901 void sp_set_bitmap_bits(PROTO_DECL2 fix15 y, fix15 xbit1, fix15 xbit2);
902 void sp_close_bitmap(PROTO_DECL1);
906 void sp_open_outline(PROTO_DECL2 fix31 x_set_width, fix31 y_set_width, fix31 xmin, fix31 xmax, fix31 ymin,fix31 ymax);
907 void sp_start_new_char(PROTO_DECL1);
908 void sp_start_contour(PROTO_DECL2 fix31 x,fix31 y,boolean outside);
909 void sp_curve_to(PROTO_DECL2 fix31 x1, fix31 y1, fix31 x2, fix31 y2, fix31 x3, fix31 y3);
910 void sp_line_to(PROTO_DECL2 fix31 x, fix31 y);
911 void sp_close_contour(PROTO_DECL1);
912 void sp_close_outline(PROTO_DECL1);
915 #if INCL_LCD /* Dynamic load character data supported? */
916 buff_t *sp_load_char_data(PROTO_DECL2 fix31 file_offset,fix15 no_bytes,fix15 cb_offset); /* Load character data from font file */
919 #if INCL_PLAID_OUT /* Plaid data monitoring included? */
920 void sp_record_xint(PROTO_DECL2 fix15 int_num); /* Record xint data */
921 void sp_record_yint(PROTO_DECL2 fix15 int_num); /* Record yint data */
922 void sp_begin_plaid_data(PROTO_DECL1); /* Signal start of plaid data */
923 void sp_begin_ctrl_zones(PROTO_DECL2 fix15, no_X_zones, fix15 no_Y_zones); /* Signal start of control zones */
924 void sp_record_ctrl_zone(PROTO_DECL2 fix31 start, fix31 end, fix15 constr); /* Record control zone data */
925 void sp_begin_int_zones(PROTO_DECL2 fix15 no_X_int_zones, fix15 no_Y_int_zones); /* Signal start of interpolation zones */
926 void sp_record_int_zone(PROTO_DECL2 fix31 start, fix31 end); /* Record interpolation zone data */
927 void sp_end_plaid_data(PROTO_DECL1); /* Signal end of plaid data */
930 #else /* NO PROTOTYPES AVAILABLE */
934 /* do_char.c functions */
935 boolean sp_make_char(); /* Make specified character */
937 fix31 sp_compute_isw_scale();
938 static boolean sp_do_make_char();
939 boolean sp_make_char_isw(); /* Make specified character with */
940 /* imported set widths.*/
941 static boolean sp_reset_xmax();
943 #if INCL_ISW || INCL_SQUEEZING
944 static void sp_preview_bounding_box();
946 ufix16 sp_get_char_id(); /* Get character id for specified char */
948 #if INCL_METRICS /* Metrics functions supported? */
949 fix31 sp_get_char_width(); /* Get character width for specified char */
950 fix15 sp_get_track_kern(); /* Get track kerning for specified size */
951 fix31 sp_get_pair_kern(); /* Get kerning for specified char pair */
952 boolean sp_get_char_bbox();
955 /* do_trns.c functions */
956 ufix8 FONTFAR *sp_read_bbox(); /* Read bounding box */
957 void sp_proc_outl_data(); /* Process outline data */
959 /* out_0c.c functions */
960 boolean sp_init_black();
961 boolean sp_begin_char_black();
962 void sp_begin_contour_black();
963 void sp_line_black();
964 boolean sp_end_char_black();
966 /* out_util.c functions */
967 #if INCL_BLACK || INCL_SCREEN || INCL_2D
969 void sp_init_char_out();
970 void sp_begin_sub_char_out();
972 void sp_end_contour_out();
973 void sp_end_sub_char_out();
974 void sp_init_intercepts_out();
975 void sp_restart_intercepts_out();
976 void sp_set_first_band_out();
977 void sp_reduce_band_size_out();
978 boolean sp_next_band_out();
982 boolean sp_init_userout();
985 /* reset.c functions */
986 void sp_reset(); /* Initialize Fontware mechanism */
991 ufix16 sp_get_cust_no();
993 /* set_spcs.c functions */
994 boolean sp_set_specs(); /* Set specifications */
995 void sp_type_tcb(); /* Update transformation class in tcb */
997 fix31 sp_read_long(); /* Read long as 3 bytes encrypted */
998 fix15 sp_read_word_u(); /* Read word as 2 bytes unencrypted */
1000 /* set_trns.c functions */
1001 void sp_init_tcb(); /* Initialize current trans control block */
1002 void sp_scale_tcb(); /* Transform trans control block */
1003 ufix8 FONTFAR *sp_plaid_tcb(); /* Enable intelligent transformation */
1004 ufix8 FONTFAR *sp_skip_interpolation_table();
1005 ufix8 FONTFAR *sp_skip_control_zone();
1007 ufix8 FONTFAR *sp_read_oru_table(); /* Read controlled coord table */
1008 #if INCL_SQUEEZING || INCL_ISW
1009 static void sp_calculate_x_pix();
1012 static void sp_calculate_y_pix();
1013 boolean sp_calculate_x_scale();
1014 boolean sp_calculate_y_scale() ;
1017 /* user defined functions */
1019 #if INCL_BLACK || INCL_SCREEN || INCL_2D
1020 void sp_open_bitmap();
1021 void sp_set_bitmap_bits();
1022 void sp_close_bitmap();
1026 void sp_open_outline();
1027 void sp_start_new_char();
1028 void sp_start_contour();
1031 void sp_close_contour();
1032 void sp_close_outline();
1035 #if INCL_LCD /* Dynamic load character data supported? */
1036 buff_t *sp_load_char_data(); /* Load character data from font file */
1039 #if INCL_PLAID_OUT /* Plaid data monitoring included? */
1040 void sp_record_xint(); /* Record xint data */
1041 void sp_record_yint(); /* Record yint data */
1042 void sp_begin_plaid_data(); /* Signal start of plaid data */
1043 void sp_begin_ctrl_zones(); /* Signal start of control zones */
1044 void sp_record_ctrl_zone(); /* Record control zone data */
1045 void sp_begin_int_zones(); /* Signal start of interpolation zones */
1046 void sp_record_int_zone(); /* Record interpolation zone data */
1047 void sp_end_plaid_data(); /* Signal end of plaid data */
1050 boolean sp_init_screen(); /* If only screen-writer mode supported */
1051 boolean sp_begin_char_screen(); /* If screenwriter mode supported */
1052 void sp_begin_contour_screen(); /* If screenwriter mode supported */
1053 void sp_line_screen(); /* If screenwriter mode supported */
1054 void sp_curve_screen(); /* If screenwriter mode supported */
1055 void sp_scan_curve_screen();
1056 void sp_vert_line_screen();
1057 void sp_end_contour_screen();
1058 boolean sp_end_char_screen(); /* If screenwriter mode supported */
1061 boolean sp_init_outline(); /* If only vector output mode supported */
1062 boolean sp_begin_char_outline(); /* If only vector output mode supported */
1063 void sp_begin_sub_char_outline(); /* If only vector output mode supported */
1064 void sp_begin_contour_outline(); /* If only vector output mode supported */
1065 void sp_curve_outline(); /* If only vector output mode supported */
1066 void sp_line_outline(); /* If only vector output mode supported */
1067 void sp_end_contour_outline(); /* If only vector output mode supported */
1068 void sp_end_sub_char_outline(); /* If only vector output mode supported */
1069 boolean sp_end_char_outline(); /* If only vector output mode supported */
1071 boolean sp_init_2d(); /* If screen-writer and other modes supported */
1072 boolean sp_begin_char_2d(); /* If screen-writer and other modes supported */
1073 void sp_begin_contour_2d(); /* If screen-writer and other modes supported */
1074 void sp_line_2d(); /* If screen-writer and other modes supported */
1075 boolean sp_end_char_2d(); /* If screen-writer and other modes supported */
1081 #endif /* _SPEEDO_H_ */