1 /* $XConsortium: reset.c,v 1.2 91/05/11 09:53:59 rws 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.
27 /******************************* R E S E T . C *******************************
29 * This module provides initialization functions. *
31 ****************************************************************************/
33 #include "spdo_prv.h" /* General definitions for Speedo */
34 #include "keys.h" /* Font decryption keys */
40 #define SHOW(X) printf("X = %d\n", X)
45 /***** GLOBAL VARIABLES *****/
47 /***** GLOBAL FUNCTIONS *****/
49 /***** EXTERNAL VARIABLES *****/
51 /***** EXTERNAL FUNCTIONS *****/
53 /***** STATIC VARIABLES *****/
55 /***** STATIC FUNCTIONS *****/
61 * Called by the host software to intialize the Speedo mechanism
64 sp_globals.specs_valid = FALSE; /* Flag specs not valid */
66 /* Reset decryption key */
67 sp_globals.key32 = (KEY3 << 8) | KEY2;
68 sp_globals.key4 = KEY4;
69 sp_globals.key6 = KEY6;
70 sp_globals.key7 = KEY7;
71 sp_globals.key8 = KEY8;
74 sp_globals.constr.font_id_valid = FALSE;
78 #if INCL_BLACK || INCL_SCREEN || INCL_2D
79 sp_globals.bitmap_device_set = FALSE;
82 sp_globals.outline_device_set = FALSE;
88 FUNCTION void set_key(key)
90 ufix8 key[]; /* Specified decryption key */
92 * Dynamically sets font decryption key.
95 sp_globals.key32 = ((ufix16)key[3] << 8) | key[2];
96 sp_globals.key4 = key[4];
97 sp_globals.key6 = key[6];
98 sp_globals.key7 = key[7];
99 sp_globals.key8 = key[8];
105 FUNCTION ufix16 get_cust_no(font_buff)
109 returns customer number from font
112 ufix8 FONTFAR *hdr2_org;
115 private_off = read_word_u(font_buff.org + FH_HEDSZ);
116 if (private_off + FH_CUSNR > font_buff.no_bytes)
118 report_error(1); /* Insufficient font data loaded */
122 hdr2_org = font_buff.org + private_off;
124 return (read_word_u(hdr2_org + FH_CUSNR));