diff options
Diffstat (limited to 'src/Speedo')
-rw-r--r-- | src/Speedo/bics-iso.h | 1 | ||||
-rw-r--r-- | src/Speedo/do_char.c | 123 | ||||
-rw-r--r-- | src/Speedo/do_trns.c | 40 | ||||
-rw-r--r-- | src/Speedo/out_bl2d.c | 49 | ||||
-rw-r--r-- | src/Speedo/out_blk.c | 35 | ||||
-rw-r--r-- | src/Speedo/out_scrn.c | 56 | ||||
-rw-r--r-- | src/Speedo/out_util.c | 25 | ||||
-rw-r--r-- | src/Speedo/reset.c | 9 | ||||
-rw-r--r-- | src/Speedo/set_spcs.c | 75 | ||||
-rw-r--r-- | src/Speedo/set_trns.c | 119 | ||||
-rw-r--r-- | src/Speedo/spdo_prv.h | 8 | ||||
-rw-r--r-- | src/Speedo/speedo.h | 201 | ||||
-rw-r--r-- | src/Speedo/spencode.c | 6 | ||||
-rw-r--r-- | src/Speedo/sperr.c | 24 | ||||
-rw-r--r-- | src/Speedo/spfile.c | 150 | ||||
-rw-r--r-- | src/Speedo/spfont.c | 116 | ||||
-rw-r--r-- | src/Speedo/spfuncs.c | 61 | ||||
-rw-r--r-- | src/Speedo/spglyph.c | 41 | ||||
-rw-r--r-- | src/Speedo/spinfo.c | 60 | ||||
-rw-r--r-- | src/Speedo/spint.h | 42 |
20 files changed, 566 insertions, 675 deletions
diff --git a/src/Speedo/bics-iso.h b/src/Speedo/bics-iso.h index f520562..d3cd35b 100644 --- a/src/Speedo/bics-iso.h +++ b/src/Speedo/bics-iso.h @@ -26,6 +26,7 @@ other dealings in this Software without prior written authorization from The Open Group. */ +/* $XFree86: xc/lib/font/Speedo/bics-iso.h,v 1.7 2001/12/14 19:56:41 dawes Exp $ */ int sp_bics_map[] = { 32, 0, diff --git a/src/Speedo/do_char.c b/src/Speedo/do_char.c index 0ae416b..f28af7c 100644 --- a/src/Speedo/do_char.c +++ b/src/Speedo/do_char.c @@ -21,6 +21,7 @@ INCIDENTAL OR CONSEQUENTIAL DAMAGES, ARISING OUT OF OR IN ANY WAY CONNECTED WITH THE SPEEDO SOFTWARE OR THE BITSTREAM CHARTER OUTLINE FONT. */ +/* $XFree86: xc/lib/font/Speedo/do_char.c,v 1.4 2001/08/27 19:49:50 dawes Exp $ */ /***************************** D O - C H A R . C ***************************** * * @@ -52,24 +53,16 @@ WITH THE SPEEDO SOFTWARE OR THE BITSTREAM CHARTER OUTLINE FONT. /***** STATIC FUNCTIONS *****/ -#if PROTOS_AVAIL static boolean sp_make_simp_char(PROTO_DECL2 ufix8 FONTFAR *pointer,ufix8 format); static boolean sp_make_comp_char(PROTO_DECL2 ufix8 FONTFAR *pointer); static ufix8 FONTFAR *sp_get_char_org(PROTO_DECL2 ufix16 char_index,boolean top_level); static fix15 sp_get_posn_arg(PROTO_DECL2 ufix8 FONTFAR *STACKFAR *ppointer,ufix8 format); static fix15 sp_get_scale_arg(PROTO_DECL2 ufix8 FONTFAR *STACKFAR *ppointer,ufix8 format); -#else -static boolean sp_make_simp_char(); /* Process simple character data */ -static boolean sp_make_comp_char(); /* Process compound character data */ -static ufix8 FONTFAR *sp_get_char_org(); /* Look up char in character directory */ -static fix15 sp_get_posn_arg(); /* Read Xpos Ypos args in DOCH instruction */ -static fix15 sp_get_scale_arg(); /* read Xscale Yscale args in DOCH instruction */ -#endif -FUNCTION ufix16 get_char_id(char_index) +FUNCTION ufix16 get_char_id( GDECL -ufix16 char_index; /* Index to character in char directory */ +ufix16 char_index) /* Index to character in char directory */ /* * Returns character id for specified character index in currently * selected font. @@ -97,9 +90,9 @@ return 0xffff & NEXT_WORD(pointer); /* Return character id */ #if INCL_METRICS -FUNCTION fix31 get_char_width(char_index) +FUNCTION fix31 get_char_width( GDECL -ufix16 char_index; /* Index to character in char directory */ +ufix16 char_index) /* Index to character in char directory */ /* * Returns character set width for specified character index in currently * selected font in units of 1/65536 em. @@ -131,10 +124,10 @@ return set_width; /* Return in 1/65536 em units */ #endif #if INCL_METRICS -FUNCTION fix15 get_track_kern(track, point_size) +FUNCTION fix15 get_track_kern( GDECL -fix15 track; /* Track required (0 - 3) */ -fix15 point_size; /* Point size (units of whole points) */ +fix15 track, /* Track required (0 - 3) */ +fix15 point_size) /* Point size (units of whole points) */ /* * Returns inter-character spacing adjustment in units of 1/256 * points for the specified kerning track and point size. @@ -153,16 +146,16 @@ fix15 point_size; /* Point size (units of whole points) */ */ { ufix8 FONTFAR *pointer; /* Pointer to character data */ -fix15 no_tracks; /* Number of kerning tracks in font */ -ufix8 format; /* Track kerning format byte */ -fix15 i; /* Track counter */ -fix15 min_pt_size; /* Minimum point size for track */ -fix15 max_pt_size; /* Maximum point size for track */ -fix15 min_adj; /* Adjustment for min point size */ -fix15 max_adj; /* Adjustment for max point size */ -fix31 delta_pt_size;/* Max point size - min point size */ -fix31 delta_adj; /* Min adjustment - max adjustment */ -fix15 adj = 0; /* Interpolated adjustment */ +fix15 no_tracks; /* Number of kerning tracks in font */ +ufix8 format; /* Track kerning format byte */ +fix15 i; /* Track counter */ +fix15 min_pt_size = 0; /* Minimum point size for track */ +fix15 max_pt_size = 0; /* Maximum point size for track */ +fix15 min_adj = 0; /* Adjustment for min point size */ +fix15 max_adj = 0; /* Adjustment for max point size */ +fix31 delta_pt_size; /* Max point size - min point size */ +fix31 delta_adj; /* Min adjustment - max adjustment */ +fix15 adj = 0; /* Interpolated adjustment */ if (track == 0) /* Track zero selected? */ { @@ -220,10 +213,10 @@ return adj; /* Return interpolated adjustment (1/256 points #endif #if INCL_METRICS -FUNCTION fix31 get_pair_kern(char_index1, char_index2) +FUNCTION fix31 get_pair_kern( GDECL -ufix16 char_index1; /* Index to first character in char directory */ -ufix16 char_index2; /* Index to second character in char directory */ +ufix16 char_index1, /* Index to first character in char directory */ +ufix16 char_index2) /* Index to second character in char directory */ /* * Returns inter-character spacing adjustment in units of 1/65536 em * for the specified pair of characters. @@ -243,7 +236,7 @@ fix15 nn; /* Number of kern pairs in first partition */ fix15 base; /* Index to first record in rem kern pairs */ fix15 i; /* Index to kern pair being tested */ fix31 adj = 0; /* Returned value of adjustment */ -fix15 adj_base; /* Adjustment base for relative adjustments */ +fix15 adj_base = 0; /* Adjustment base for relative adjustments */ if (!sp_globals.specs_valid) /* Font specs not defined? */ { @@ -310,10 +303,10 @@ return adj; /* Return pair kerning adjustment */ #if INCL_METRICS #ifdef old -FUNCTION boolean get_char_bbox(char_index, bbox) +FUNCTION boolean get_char_bbox( GDECL -ufix16 char_index; -bbox_t *bbox; +ufix16 char_index, +bbox_t *bbox) { /* * returns true if character exists, false if it doesn't @@ -368,10 +361,10 @@ return TRUE; #else /* new code, 4/25/91 */ -FUNCTION boolean get_char_bbox(char_index, bbox) +FUNCTION boolean get_char_bbox( GDECL -ufix16 char_index; -bbox_t *bbox; +ufix16 char_index, +bbox_t *bbox) { /* * returns true if character exists, false if it doesn't @@ -447,10 +440,10 @@ return TRUE; #if INCL_ISW -FUNCTION boolean make_char_isw(char_index,imported_setwidth) +FUNCTION boolean make_char_isw( GDECL -ufix16 char_index; -ufix32 imported_setwidth; +ufix16 char_index, +ufix32 imported_setwidth) { fix15 xmin; /* Minimum X ORU value in font */ fix15 xmax; /* Maximum X ORU value in font */ @@ -481,17 +474,17 @@ if (sp_globals.isw_modified_constants) return (return_value); } -FUNCTION boolean make_char(char_index) +FUNCTION boolean make_char( GDECL -ufix16 char_index; /* Index to character in char directory */ +ufix16 char_index) /* Index to character in char directory */ { sp_globals.import_setwidth_act = FALSE; return (do_make_char(char_index)); } -FUNCTION static boolean do_make_char(char_index) +FUNCTION static boolean do_make_char(GDECL ufix16 char_index) #else -FUNCTION boolean make_char(char_index) +FUNCTION boolean make_char(GDECL ufix16 char_index) #endif /* * Outputs specified character using the currently selected font and @@ -500,8 +493,6 @@ FUNCTION boolean make_char(char_index) * previously set. * Reports Error 12 and returns FALSE if character data not available. */ -GDECL -ufix16 char_index; { ufix8 FONTFAR *pointer; /* Pointer to character data */ fix15 x_orus; @@ -594,10 +585,10 @@ else } } -FUNCTION static boolean sp_make_simp_char(pointer, format) +FUNCTION static boolean sp_make_simp_char( GDECL -ufix8 FONTFAR *pointer; /* Pointer to first byte of position argument */ -ufix8 format; /* Character format byte */ +ufix8 FONTFAR *pointer, /* Pointer to first byte of position argument */ +ufix8 format) /* Character format byte */ /* * Called by sp_make_char() to output a simple (non-compound) character. * Returns TRUE on completion. @@ -655,9 +646,9 @@ if (fn_begin_char(sp_globals.Psw, Pmin, Pmax)) /* Signal start of character return TRUE; } -FUNCTION static boolean sp_make_comp_char(pointer) +FUNCTION static boolean sp_make_comp_char( GDECL -ufix8 FONTFAR *pointer; /* Pointer to first byte of position argument */ +ufix8 FONTFAR *pointer) /* Pointer to first byte of position argument */ /* * Called by sp_make_char() to output a compound character. * Returns FALSE if data for any sub-character is not available. @@ -796,10 +787,10 @@ return TRUE; } #if INCL_LCD /* Dynamic load character data supported? */ -FUNCTION static ufix8 FONTFAR *sp_get_char_org(char_index, top_level) +FUNCTION static ufix8 FONTFAR *sp_get_char_org( GDECL -ufix16 char_index; /* Index of character to be accessed */ -boolean top_level; /* Not a compound character element */ +ufix16 char_index, /* Index of character to be accessed */ +boolean top_level) /* Not a compound character element */ /* * Called by sp_get_char_id(), sp_get_char_width(), sp_make_char() and * sp_make_comp_char() to get a pointer to the start of the character data @@ -864,10 +855,10 @@ return pchar_data->org; /* Return pointer into character data buff #if INCL_LCD #else /* Dynamic load character data not supported? */ -FUNCTION static ufix8 FONTFAR *sp_get_char_org(char_index, top_level) +FUNCTION static ufix8 FONTFAR *sp_get_char_org( GDECL -ufix16 char_index; /* Index of character to be accessed */ -boolean top_level; /* Not a compound character element */ +ufix16 char_index, /* Index of character to be accessed */ +boolean top_level) /* Not a compound character element */ /* * Called by sp_get_char_id(), sp_get_char_width(), sp_make_char() and * sp_make_comp_char() to get a pointer to the start of the character data @@ -915,10 +906,10 @@ return sp_globals.pfont->org + char_offset; /* Return pointer into font buf #endif -FUNCTION static fix15 sp_get_posn_arg(ppointer, format) +FUNCTION static fix15 sp_get_posn_arg( GDECL -ufix8 FONTFAR * STACKFAR *ppointer; /* Pointer to first byte of position argument */ -ufix8 format; /* Format of DOCH arguments */ +ufix8 FONTFAR * STACKFAR *ppointer, /* Pointer to first byte of position argument */ +ufix8 format) /* Format of DOCH arguments */ /* * Called by sp_make_comp_char() to read a position argument from the * specified point in the font/char buffer. @@ -939,10 +930,10 @@ default: } } -FUNCTION static fix15 sp_get_scale_arg(ppointer, format) +FUNCTION static fix15 sp_get_scale_arg( GDECL -ufix8 FONTFAR *STACKFAR *ppointer; /* Pointer to first byte of position argument */ -ufix8 format; /* Format of DOCH arguments */ +ufix8 FONTFAR *STACKFAR *ppointer, /* Pointer to first byte of position argument */ +ufix8 format) /* Format of DOCH arguments */ /* * Called by sp_make_comp_char() to read a scale argument from the * specified point in the font/char buffer. @@ -956,10 +947,10 @@ else return (fix15)ONE_SCALE; } #if INCL_ISW || INCL_SQUEEZING -FUNCTION static void preview_bounding_box(pointer,format) +FUNCTION static void preview_bounding_box( GDECL -ufix8 FONTFAR *pointer; /* Pointer to first byte of position argument */ -ufix8 format; /* Character format byte */ +ufix8 FONTFAR *pointer, /* Pointer to first byte of position argument */ +ufix8 format) /* Character format byte */ { point_t Pmin, Pmax; /* Transformed corners of bounding box */ @@ -984,9 +975,9 @@ x */ } #endif #if INCL_ISW -FUNCTION static boolean reset_xmax(xmax) +FUNCTION static boolean reset_xmax( GDECL -fix31 xmax; +fix31 xmax) { fix15 xmin; /* Minimum X ORU value in font */ diff --git a/src/Speedo/do_trns.c b/src/Speedo/do_trns.c index b003284..25bc02a 100644 --- a/src/Speedo/do_trns.c +++ b/src/Speedo/do_trns.c @@ -21,6 +21,7 @@ INCIDENTAL OR CONSEQUENTIAL DAMAGES, ARISING OUT OF OR IN ANY WAY CONNECTED WITH THE SPEEDO SOFTWARE OR THE BITSTREAM CHARTER OUTLINE FONT. */ +/* $XFree86: xc/lib/font/Speedo/do_trns.c,v 1.4 2001/08/27 19:49:50 dawes Exp $ */ /**************************** D O _ T R N S . C ****************************** * * @@ -53,21 +54,16 @@ WITH THE SPEEDO SOFTWARE OR THE BITSTREAM CHARTER OUTLINE FONT. /***** STATIC FUNCTIONS *****/ -#if PROTOS_AVAIL static void sp_split_curve(PROTO_DECL2 point_t P1,point_t P2,point_t P3,fix15 depth); static ufix8 FONTFAR *sp_get_args(PROTO_DECL2 ufix8 FONTFAR *pointer,ufix8 format,point_t STACKFAR *pP); -#else -static void sp_split_curve(); /* Split Bezier curve into vectors */ -static ufix8 FONTFAR *sp_get_args(); /* Read X Y argument pair */ -#endif -FUNCTION ufix8 FONTFAR *read_bbox(pointer, pPmin, pPmax, set_flag) +FUNCTION ufix8 FONTFAR *read_bbox( GDECL -ufix8 FONTFAR *pointer; /* Pointer to next byte in char data */ -point_t STACKFAR *pPmin; /* Lower left corner of bounding box */ -point_t STACKFAR *pPmax; /* Upper right corner of bounding box */ -boolean set_flag; /* flag to indicate whether global oru bbox should be saved */ +ufix8 FONTFAR *pointer, /* Pointer to next byte in char data */ +point_t STACKFAR *pPmin, /* Lower left corner of bounding box */ +point_t STACKFAR *pPmax, /* Upper right corner of bounding box */ +boolean set_flag) /* flag to indicate whether global oru bbox should be saved */ /* * Called by make_simp_char() and make_comp_char() to read the * bounding box data from the font. @@ -79,7 +75,7 @@ boolean set_flag; /* flag to indicate whether global oru bbox should be saved */ */ { ufix8 format1; -ufix8 format; +ufix8 format = 0; fix15 i; point_t P; @@ -155,9 +151,9 @@ printf("BBOX %6.1f(Xint 0), %6.1f(Yint 0), %6.1f(Xint %d), %6.1f(Yint %d)\n", return pointer; } -FUNCTION void proc_outl_data(pointer) +FUNCTION void proc_outl_data( GDECL -ufix8 FONTFAR *pointer; /* Pointer to next byte in char data */ +ufix8 FONTFAR *pointer) /* Pointer to next byte in char data */ /* * Called by make_simp_char() and make_comp_char() to read the * outline data from the font. @@ -310,12 +306,12 @@ record_yint((fix15)(sp_globals.y_int - sp_globals.Y_int_org)); /* Record yint da } } -FUNCTION static void sp_split_curve(P1, P2, P3, depth) +FUNCTION static void sp_split_curve( GDECL -point_t P1; /* First control point of Bezier curve */ -point_t P2; /* Second control point of Bezier curve */ -point_t P3; /* End point of Bezier curve */ -fix15 depth; /* Levels of recursive subdivision required */ +point_t P1, /* First control point of Bezier curve */ +point_t P2, /* Second control point of Bezier curve */ +point_t P3, /* End point of Bezier curve */ +fix15 depth) /* Levels of recursive subdivision required */ /* * Called by proc_outl_data() to subdivide Bezier curves into an * appropriate number of vectors, whenever curves are not enabled @@ -369,11 +365,11 @@ else } } -FUNCTION static ufix8 FONTFAR *sp_get_args(pointer, format, pP) +FUNCTION static ufix8 FONTFAR *sp_get_args( GDECL -ufix8 FONTFAR *pointer; /* Pointer to next byte in char data */ -ufix8 format; /* Format specifiaction of argument pair */ -point_t STACKFAR *pP; /* Resulting transformed point */ +ufix8 FONTFAR *pointer, /* Pointer to next byte in char data */ +ufix8 format, /* Format specifiaction of argument pair */ +point_t STACKFAR *pP) /* Resulting transformed point */ /* * Called by read_bbox() and proc_outl_data() to read an X Y argument * pair from the font. diff --git a/src/Speedo/out_bl2d.c b/src/Speedo/out_bl2d.c index d14f8c3..74a7310 100644 --- a/src/Speedo/out_bl2d.c +++ b/src/Speedo/out_bl2d.c @@ -21,6 +21,7 @@ INCIDENTAL OR CONSEQUENTIAL DAMAGES, ARISING OUT OF OR IN ANY WAY CONNECTED WITH THE SPEEDO SOFTWARE OR THE BITSTREAM CHARTER OUTLINE FONT. */ +/* $XFree86: xc/lib/font/Speedo/out_bl2d.c,v 1.4 2001/01/17 19:43:17 dawes Exp $ */ /*************************** O U T _ B L 2 D . C ***************************** * * @@ -54,21 +55,15 @@ WITH THE SPEEDO SOFTWARE OR THE BITSTREAM CHARTER OUTLINE FONT. /***** STATIC FUNCTIONS *****/ #if INCL_2D -#if PROTOS_AVAIL static void sp_draw_vector_to_2d(PROTO_DECL2 fix15 x0,fix15 y0,fix15 x1,fix15 y1,band_t GLOBALFAR *band); static void sp_add_intercept_2d(PROTO_DECL2 fix15 y,fix15 x); static void sp_proc_intercepts_2d(PROTO_DECL1); -#else -static void sp_add_intercept_2d(); -static void sp_proc_intercepts_2d(); -static void sp_draw_vector_to_2d(); -#endif #endif #if INCL_2D -FUNCTION boolean init_2d(specsarg) +FUNCTION boolean init_2d( GDECL -specs_t GLOBALFAR *specsarg; +specs_t GLOBALFAR *specsarg) /* * init_out_2d() is called by sp_set_specs() to initialize the output module. * Returns TRUE if output module can accept requested specifications. @@ -87,11 +82,11 @@ return TRUE; #endif #if INCL_2D -FUNCTION boolean begin_char_2d(Psw, Pmin, Pmax) +FUNCTION boolean begin_char_2d( GDECL -point_t Psw; -point_t Pmin; -point_t Pmax; +point_t Psw, +point_t Pmin, +point_t Pmax) /* Called once at the start of the character generation process * Initializes intercept table, either calculates pixel maxima or * decides that they need to be collected @@ -113,10 +108,10 @@ return TRUE; #if INCL_2D -FUNCTION void begin_contour_2d(P1, outside) +FUNCTION void begin_contour_2d( GDECL -point_t P1; -boolean outside; +point_t P1, +boolean outside) /* Called at the start of each contour */ { @@ -133,9 +128,9 @@ sp_globals.y0_spxl = P1.y; #endif #if INCL_2D -FUNCTION void line_2d(P1) +FUNCTION void line_2d( GDECL -point_t P1; +point_t P1) /* * Called for each vector in the transformed character * "draws" vector into intercept table @@ -180,13 +175,13 @@ sp_globals.x0_spxl = P1.x; sp_globals.y0_spxl = P1.y; /* update endpoint */ } -FUNCTION static void sp_draw_vector_to_2d(x0, y0, x1, y1, band) +FUNCTION static void sp_draw_vector_to_2d( GDECL -fix15 x0; /* X coordinate */ -fix15 y0; /* Y coordinate */ -fix15 x1; -fix15 y1; -band_t GLOBALFAR *band; +fix15 x0, /* X coordinate */ +fix15 y0, /* Y coordinate */ +fix15 x1, +fix15 y1, +band_t GLOBALFAR *band) { register fix15 how_many_y; /* # of intercepts at y = n + 1/2 */ register fix15 yc; /* Current scan-line */ @@ -290,7 +285,6 @@ if (how_many_y < 0) #if INCL_2D FUNCTION boolean end_char_2d() -GDECL /* Called when all character data has been output * Return TRUE if output process is complete * Return FALSE to repeat output of the transformed data beginning @@ -530,11 +524,11 @@ else #endif #if INCL_2D -FUNCTION static void sp_add_intercept_2d(y, x) +FUNCTION static void sp_add_intercept_2d( GDECL -fix15 y; /* Y coordinate in relative pixel units */ +fix15 y, /* Y coordinate in relative pixel units */ /* (0 is lowest sample in band) */ -fix15 x; /* X coordinate of intercept in subpixel units */ +fix15 x) /* X coordinate of intercept in subpixel units */ /* Called by line() to add an intercept to the intercept list structure */ @@ -609,7 +603,6 @@ if (++sp_globals.next_offset >= MAX_INTERCEPTS) /* Intercept buffer full? */ #if INCL_2D FUNCTION static void sp_proc_intercepts_2d() -GDECL /* Called by sp_make_char to output accumulated intercept lists * Clips output to xmin, xmax, sp_globals.ymin, ymax boundaries */ diff --git a/src/Speedo/out_blk.c b/src/Speedo/out_blk.c index 71e39af..e56eb1b 100644 --- a/src/Speedo/out_blk.c +++ b/src/Speedo/out_blk.c @@ -21,7 +21,7 @@ INCIDENTAL OR CONSEQUENTIAL DAMAGES, ARISING OUT OF OR IN ANY WAY CONNECTED WITH THE SPEEDO SOFTWARE OR THE BITSTREAM CHARTER OUTLINE FONT. */ - +/* $XFree86: xc/lib/font/Speedo/out_blk.c,v 1.3 2001/01/17 19:43:17 dawes Exp $ */ /*************************** O U T _ B L K . C ********************************* @@ -58,20 +58,15 @@ WITH THE SPEEDO SOFTWARE OR THE BITSTREAM CHARTER OUTLINE FONT. /***** STATIC FUNCTIONS *****/ #if INCL_BLACK -#if PROTOS_AVAIL static void sp_add_intercept_black(PROTO_DECL2 fix15 y, fix15 x); static void sp_proc_intercepts_black(PROTO_DECL1); -#else -static void sp_add_intercept_black(); -static void sp_proc_intercepts_black(); -#endif #endif #if INCL_BLACK -FUNCTION boolean init_black(specsarg) +FUNCTION boolean init_black( GDECL -specs_t GLOBALFAR *specsarg; +specs_t GLOBALFAR *specsarg) /* * init_out0() is called by sp_set_specs() to initialize the output module. * Returns TRUE if output module can accept requested specifications. @@ -89,11 +84,11 @@ return (TRUE); #if INCL_BLACK -FUNCTION boolean begin_char_black(Psw, Pmin, Pmax) +FUNCTION boolean begin_char_black( GDECL -point_t Psw; -point_t Pmin; -point_t Pmax; +point_t Psw, +point_t Pmin, +point_t Pmax) /* Called once at the start of the character generation process */ { @@ -110,10 +105,10 @@ return TRUE; #if INCL_BLACK -FUNCTION void begin_contour_black(P1, outside) +FUNCTION void begin_contour_black( GDECL -point_t P1; -boolean outside; +point_t P1, +boolean outside) /* Called at the start of each contour */ { @@ -129,9 +124,9 @@ sp_globals.y_pxl = (sp_globals.y0_spxl + sp_globals.pixrnd) >> sp_globals.pixshi #endif #if INCL_BLACK -FUNCTION void line_black(P1) +FUNCTION void line_black( GDECL -point_t P1; +point_t P1) /* Called for each vector in the transformed character */ { @@ -522,11 +517,11 @@ else #endif #if INCL_BLACK -FUNCTION LOCAL void sp_add_intercept_black(y, x) +FUNCTION LOCAL void sp_add_intercept_black( GDECL -fix15 y; /* Y coordinate in relative pixel units */ +fix15 y, /* Y coordinate in relative pixel units */ /* (0 is lowest sample in band) */ -fix15 x; /* X coordinate of intercept in subpixel units */ +fix15 x) /* X coordinate of intercept in subpixel units */ /* Called by line() to add an intercept to the intercept list structure */ diff --git a/src/Speedo/out_scrn.c b/src/Speedo/out_scrn.c index 3d04db6..e17f7f6 100644 --- a/src/Speedo/out_scrn.c +++ b/src/Speedo/out_scrn.c @@ -21,6 +21,7 @@ INCIDENTAL OR CONSEQUENTIAL DAMAGES, ARISING OUT OF OR IN ANY WAY CONNECTED WITH THE SPEEDO SOFTWARE OR THE BITSTREAM CHARTER OUTLINE FONT. */ +/* $XFree86: xc/lib/font/Speedo/out_scrn.c,v 1.5 2001/01/17 19:43:17 dawes Exp $ */ /*************************** O U T _ S C R N . C ***************************** @@ -56,19 +57,14 @@ WITH THE SPEEDO SOFTWARE OR THE BITSTREAM CHARTER OUTLINE FONT. /***** STATIC FUNCTIONS *****/ -#if PROTOS_AVAIL static void sp_add_intercept_screen(PROTO_DECL2 fix15 y,fix31 x); static void sp_proc_intercepts_screen(PROTO_DECL1); -#else -static void sp_add_intercept_screen(); -static void sp_proc_intercepts_screen(); -#endif #if INCL_SCREEN -FUNCTION boolean init_screen(specsarg) +FUNCTION boolean init_screen( GDECL -specs_t FONTFAR *specsarg; +specs_t FONTFAR *specsarg) /* * init_out0() is called by sp_set_specs() to initialize the output module. * Returns TRUE if output module can accept requested specifications. @@ -84,11 +80,11 @@ return (TRUE); #if INCL_SCREEN -FUNCTION boolean begin_char_screen(Psw, Pmin, Pmax) +FUNCTION boolean begin_char_screen( GDECL -point_t Psw; -point_t Pmin; -point_t Pmax; +point_t Psw, +point_t Pmin, +point_t Pmax) /* Called once at the start of the character generation process */ { @@ -111,10 +107,10 @@ return TRUE; #if INCL_SCREEN -FUNCTION void begin_contour_screen(P1, outside) +FUNCTION void begin_contour_screen( GDECL -point_t P1; -boolean outside; +point_t P1, +boolean outside) /* Called at the start of each contour */ { @@ -130,10 +126,10 @@ sp_globals.y_pxl = (sp_globals.y0_spxl + sp_globals.pixrnd) >> sp_globals.pixshi #endif #if INCL_SCREEN -FUNCTION void curve_screen(P1, P2, P3, depth) +FUNCTION void curve_screen( GDECL -point_t P1, P2, P3; -fix15 depth; +point_t P1, point_t P2, point_t P3, +fix15 depth) { fix31 X0; fix31 Y0; @@ -187,9 +183,9 @@ sp_globals.y0_spxl = P3.y; sp_globals.y_pxl = (P3.y + sp_globals.pixrnd) >> sp_globals.pixshift; /* calculate new end-scan sp_globals.line */ } -FUNCTION void scan_curve_screen(X0,Y0,X1,Y1,X2,Y2,X3,Y3) +FUNCTION void scan_curve_screen( GDECL -fix31 X0,Y0,X1,Y1,X2,Y2,X3,Y3; +fix31 X0, fix31 Y0, fix31 X1, fix31 Y1, fix31 X2, fix31 Y2, fix31 X3, fix31 Y3) /* Called for each curve in the transformed character if curves out enabled */ { @@ -200,7 +196,7 @@ fix31 Pctrl1y; fix31 Pctrl2x; fix31 Pctrl2y; -#if DBGCRV +#ifdef DBGCRV printf("SCAN_CURVE_SCREEN(%6.4f, %6.4f, %6.4f, %6.4f, %6.4f, %6.4f, %6.4f, %6.4f)\n", (real)(X0-32768) / 65536.0, (real)(Y0-32768) / 65536.0, (real)(X1-32768) / 65536.0, (real)(Y1-32768) / 65536.0, @@ -214,7 +210,7 @@ if (((Y3 >> 16)) == (Y0 >> 16) || (Y3+1) == Y0 || Y3 == (Y0+1)) } if ((X3 >> 16) == (X0 >> 16)) { - vert_line_screen(X3,(Y0>>16),(Y3>>16)); + vert_line_screen(X3,(fix15)(Y0>>16),(fix15)(Y3>>16)); return; } Pmidx = (X0 + (X1 + X2) * 3 + X3 + 4 ) >> 3; @@ -233,13 +229,13 @@ Pctrl2y = (Y2 + Y3 + 1 ) >> 1; scan_curve_screen(Pmidx,Pmidy, Pctrl1x,Pctrl1y, Pctrl2x,Pctrl2y, X3,Y3); } -FUNCTION void vert_line_screen(x,y1,y2) +FUNCTION void vert_line_screen( GDECL -fix31 x; -fix15 y1, y2; +fix31 x, +fix15 y1, fix15 y2) { -#if DBGCRV +#ifdef DBGCRV printf("VERT_LINE_SCREEN(%6.4f, %6.4f, %6.4f)\n", (real)(x - 32768) / 65536.0, (real)(y1 - 32768) / 65536.0, @@ -287,9 +283,9 @@ else if (y2 > y1) /* Line goes upwards ? */ #if INCL_SCREEN -FUNCTION void line_screen(P1) +FUNCTION void line_screen( GDECL -point_t P1; +point_t P1) /* Called for each vector in the transformed character */ { @@ -683,11 +679,11 @@ else #endif #if INCL_SCREEN -FUNCTION LOCAL void sp_add_intercept_screen(y, x) +FUNCTION LOCAL void sp_add_intercept_screen( GDECL -fix15 y; /* Y coordinate in relative pixel units */ +fix15 y, /* Y coordinate in relative pixel units */ /* (0 is lowest sample in band) */ -fix31 x; /* X coordinate of intercept in subpixel units */ +fix31 x) /* X coordinate of intercept in subpixel units */ /* Called by line() to add an intercept to the intercept list structure */ diff --git a/src/Speedo/out_util.c b/src/Speedo/out_util.c index b3316a5..357763f 100644 --- a/src/Speedo/out_util.c +++ b/src/Speedo/out_util.c @@ -21,6 +21,7 @@ INCIDENTAL OR CONSEQUENTIAL DAMAGES, ARISING OUT OF OR IN ANY WAY CONNECTED WITH THE SPEEDO SOFTWARE OR THE BITSTREAM CHARTER OUTLINE FONT. */ +/* $XFree86: xc/lib/font/Speedo/out_util.c,v 1.3 2001/01/17 19:43:17 dawes Exp $ */ #define DEBUG 0 @@ -37,9 +38,9 @@ WITH THE SPEEDO SOFTWARE OR THE BITSTREAM CHARTER OUTLINE FONT. #define ABS(X) ( (X < 0) ? -X : X) #if INCL_BLACK || INCL_2D || INCL_SCREEN -FUNCTION void init_char_out(Psw,Pmin,Pmax) +FUNCTION void init_char_out( GDECL -point_t Psw, Pmin, Pmax; +point_t Psw, point_t Pmin, point_t Pmax) { sp_globals.set_width.x = (fix31)Psw.x << sp_globals.poshift; sp_globals.set_width.y = (fix31)Psw.y << sp_globals.poshift; @@ -64,11 +65,11 @@ else sp_globals.first_pass = TRUE; } -FUNCTION void begin_sub_char_out(Psw, Pmin, Pmax) +FUNCTION void begin_sub_char_out( GDECL -point_t Psw; -point_t Pmin; -point_t Pmax; +point_t Psw, +point_t Pmin, +point_t Pmax) /* Called at the start of each sub-character in a composite character */ { @@ -89,10 +90,10 @@ if (!sp_globals.extents_running) } } -FUNCTION void curve_out(P1, P2, P3,depth) +FUNCTION void curve_out( GDECL -point_t P1, P2, P3; -fix15 depth; +point_t P1, point_t P2, point_t P3, +fix15 depth) /* Called for each curve in the transformed character if curves out enabled */ { @@ -216,10 +217,10 @@ sp_globals.first_offset = sp_globals.next_offset; -FUNCTION void set_first_band_out(Pmin, Pmax) +FUNCTION void set_first_band_out( GDECL -point_t Pmin; -point_t Pmax; +point_t Pmin, +point_t Pmax) { sp_globals.ymin = Pmin.y; diff --git a/src/Speedo/reset.c b/src/Speedo/reset.c index 786ec43..7711951 100644 --- a/src/Speedo/reset.c +++ b/src/Speedo/reset.c @@ -21,6 +21,7 @@ INCIDENTAL OR CONSEQUENTIAL DAMAGES, ARISING OUT OF OR IN ANY WAY CONNECTED WITH THE SPEEDO SOFTWARE OR THE BITSTREAM CHARTER OUTLINE FONT. */ +/* $XFree86: xc/lib/font/Speedo/reset.c,v 1.3 2001/01/17 19:43:17 dawes Exp $ */ @@ -85,9 +86,9 @@ sp_globals.outline_device_set = FALSE; } #if INCL_KEYS -FUNCTION void set_key(key) +FUNCTION void set_key( GDECL -ufix8 key[]; /* Specified decryption key */ +ufix8 key[]) /* Specified decryption key */ /* * Dynamically sets font decryption key. */ @@ -102,9 +103,9 @@ sp_globals.key8 = key[8]; -FUNCTION ufix16 get_cust_no(font_buff) +FUNCTION ufix16 get_cust_no( GDECL -buff_t font_buff; +buff_t font_buff) /* returns customer number from font */ diff --git a/src/Speedo/set_spcs.c b/src/Speedo/set_spcs.c index d060a4b..14ab53e 100644 --- a/src/Speedo/set_spcs.c +++ b/src/Speedo/set_spcs.c @@ -21,6 +21,7 @@ INCIDENTAL OR CONSEQUENTIAL DAMAGES, ARISING OUT OF OR IN ANY WAY CONNECTED WITH THE SPEEDO SOFTWARE OR THE BITSTREAM CHARTER OUTLINE FONT. */ +/* $XFree86: xc/lib/font/Speedo/set_spcs.c,v 1.4 2001/08/27 19:49:50 dawes Exp $ */ /*************************** S E T _ S P C S . C ***************************** @@ -52,24 +53,17 @@ WITH THE SPEEDO SOFTWARE OR THE BITSTREAM CHARTER OUTLINE FONT. /****** STATIC FUNCTIONS *****/ -#if PROTOS_AVAIL static boolean sp_setup_consts(PROTO_DECL2 fix15 xmin, fix15 xmax, fix15 ymin, fix15 ymax); static void sp_setup_tcb(PROTO_DECL2 tcb_t GLOBALFAR *ptcb); static fix15 sp_setup_mult(PROTO_DECL2 fix31 input_mult); static fix31 sp_setup_offset(PROTO_DECL2 fix31 input_offset); -#else -static void sp_setup_tcb(); /* Set up transformation control block */ -static fix15 sp_setup_mult(); /* Convert mult to internal form */ -static fix31 sp_setup_offset(); /* Convert offset to internal form */ -static boolean sp_setup_consts(); /* Set up scaling constants */ -#endif -FUNCTION boolean set_specs(specsarg) +FUNCTION boolean set_specs( GDECL -specs_t STACKFAR *specsarg; /* Bundle of conversion specifications */ +specs_t STACKFAR *specsarg) /* Bundle of conversion specifications */ /* * Called by host software to set character generation specifications */ @@ -336,10 +330,10 @@ return TRUE; #if INCL_MULTIDEV #if INCL_BLACK || INCL_SCREEN || INCL_2D -FUNCTION boolean set_bitmap_device(bfuncs,size) +FUNCTION boolean set_bitmap_device( GDECL -bitmap_t *bfuncs; -ufix16 size; +bitmap_t *bfuncs, +ufix16 size) { if (size != sizeof(sp_globals.bitmap_device)) @@ -351,10 +345,10 @@ sp_globals.bitmap_device_set = TRUE; #endif #if INCL_OUTLINE -FUNCTION boolean set_outline_device(ofuncs,size) +FUNCTION boolean set_outline_device( GDECL -outline_t *ofuncs; -ufix16 size; +outline_t *ofuncs, +ufix16 size) { if (size != sizeof(sp_globals.outline_device)) @@ -368,15 +362,20 @@ sp_globals.outline_device_set = TRUE; #ifdef old -FUNCTION boolean sp_setup_consts(xmin, xmax, ymin, ymax) +FUNCTION boolean sp_setup_consts( +GDECL +fix15 xmin, /* Minimum X ORU value in font */ +fix15 xmax, /* Maximum X ORU value in font */ +fix15 ymin, /* Minimum Y ORU value in font */ +fix15 ymax) /* Maximum Y ORU value in font */ #else -static FUNCTION boolean sp_setup_consts(xmin, xmax, ymin, ymax) -#endif +static FUNCTION boolean sp_setup_consts( GDECL -fix15 xmin; /* Minimum X ORU value in font */ -fix15 xmax; /* Maximum X ORU value in font */ -fix15 ymin; /* Minimum Y ORU value in font */ -fix15 ymax; /* Maximum Y ORU value in font */ +fix15 xmin, /* Minimum X ORU value in font */ +fix15 xmax, /* Maximum X ORU value in font */ +fix15 ymin, /* Minimum Y ORU value in font */ +fix15 ymax) /* Maximum Y ORU value in font */ +#endif /* * Sets the following constants used for fixed point arithmetic: * sp_globals.multshift multipliers and products; range is 14 to 8 @@ -403,7 +402,7 @@ fix31 offset; /* Constant in transformation */ fix15 i; /* Loop counter */ fix15 x, y; /* Successive corners of bounding box in ORUs */ fix31 pixval; /* Successive pixel values multiplied by orus per em */ -fix15 xx, yy; /* Bounding box corner that produces max pixel value */ +fix15 xx = 0, yy = 0;/* Bounding box corner that produces max pixel value */ /* Determine numerator and denominator of largest multiplier value */ mult = sp_globals.pspecs->xxmult >> 16; @@ -531,12 +530,14 @@ return TRUE; } #ifdef old -FUNCTION void sp_setup_tcb(ptcb) +FUNCTION void sp_setup_tcb( +GDECL +tcb_t GLOBALFAR *ptcb) /* Pointer to transformation control bloxk */ #else -static FUNCTION void sp_setup_tcb(ptcb) -#endif +static FUNCTION void sp_setup_tcb( GDECL -tcb_t GLOBALFAR *ptcb; /* Pointer to transformation control bloxk */ +tcb_t GLOBALFAR *ptcb) /* Pointer to transformation control bloxk */ +#endif /* * Convert transformation coeffs to internal form */ @@ -559,9 +560,9 @@ SHOW(ptcb->yoffset); type_tcb(ptcb); /* Classify transformation type */ } -FUNCTION static fix15 sp_setup_mult(input_mult) +FUNCTION static fix15 sp_setup_mult( GDECL -fix31 input_mult; /* Multiplier in input format */ +fix31 input_mult) /* Multiplier in input format */ /* * Called by sp_setup_tcb() to convert multiplier in transformation * matrix from external to internal form. @@ -582,9 +583,9 @@ else return -(fix15)((-input_mult + imrnd) / imdenom); } -FUNCTION static fix31 sp_setup_offset(input_offset) +FUNCTION static fix31 sp_setup_offset( GDECL -fix31 input_offset; /* Multiplier in input format */ +fix31 input_offset) /* Multiplier in input format */ /* * Called by sp_setup_tcb() to convert offset in transformation * matrix from external to internal form. @@ -599,9 +600,9 @@ imrnd = ((fix31)1 << imshift) >> 1; return (((input_offset >> 1) + imrnd) >> imshift) + sp_globals.mprnd; } -FUNCTION void type_tcb(ptcb) +FUNCTION void type_tcb( GDECL -tcb_t GLOBALFAR *ptcb; /* Pointer to transformation control bloxk */ +tcb_t GLOBALFAR *ptcb) /* Pointer to transformation control bloxk */ { fix15 x_trans_type; fix15 y_trans_type; @@ -733,9 +734,9 @@ SHOW(ptcb->xpos); SHOW(ptcb->ypos); } -FUNCTION fix31 read_long(pointer) +FUNCTION fix31 read_long( GDECL -ufix8 FONTFAR *pointer; /* Pointer to first byte of encrypted 3-byte integer */ +ufix8 FONTFAR *pointer) /* Pointer to first byte of encrypted 3-byte integer */ /* * Reads a 3-byte encrypted integer from the byte string starting at * the specified point. @@ -750,9 +751,9 @@ tmpfix31 += (fix31)((*pointer) ^ sp_globals.key6); /* Read le return tmpfix31; } -FUNCTION fix15 read_word_u(pointer) +FUNCTION fix15 read_word_u( GDECL -ufix8 FONTFAR *pointer; /* Pointer to first byte of unencrypted 2-byte integer */ +ufix8 FONTFAR *pointer) /* Pointer to first byte of unencrypted 2-byte integer */ /* * Reads a 2-byte unencrypted integer from the byte string starting at * the specified point. diff --git a/src/Speedo/set_trns.c b/src/Speedo/set_trns.c index 8ef34ac..b7f0e31 100644 --- a/src/Speedo/set_trns.c +++ b/src/Speedo/set_trns.c @@ -21,6 +21,7 @@ INCIDENTAL OR CONSEQUENTIAL DAMAGES, ARISING OUT OF OR IN ANY WAY CONNECTED WITH THE SPEEDO SOFTWARE OR THE BITSTREAM CHARTER OUTLINE FONT. */ +/* $XFree86: xc/lib/font/Speedo/set_trns.c,v 1.5 2002/09/18 17:11:44 tsi Exp $ */ @@ -65,15 +66,9 @@ WITH THE SPEEDO SOFTWARE OR THE BITSTREAM CHARTER OUTLINE FONT. /***** STATIC FUNCTIONS *****/ -#if PROTOS_AVAIL static void sp_constr_update(PROTO_DECL1); static ufix8 FONTFAR *sp_setup_pix_table(PROTO_DECL2 ufix8 FONTFAR *pointer,boolean short_form,fix15 no_X_ctrl_zones,fix15 no_Y_ctrl_zones); static ufix8 FONTFAR *sp_setup_int_table(PROTO_DECL2 ufix8 FONTFAR *pointer,fix15 no_X_int_zones,fix15 no_Y_int_zones); -#else -static void sp_constr_update(); /* Update constraint table */ -static ufix8 FONTFAR *sp_setup_pix_table(); /* Read control zone table */ -static ufix8 FONTFAR *sp_setup_int_table(); /* Read interpolation zone table */ -#endif FUNCTION void init_tcb() @@ -86,13 +81,13 @@ GDECL sp_globals.tcb = sp_globals.tcb0; } -FUNCTION void scale_tcb(ptcb, x_pos, y_pos, x_scale, y_scale) +FUNCTION void scale_tcb( GDECL -tcb_t GLOBALFAR *ptcb; /* Transformation control block */ -fix15 x_pos; /* X position (outline res units) */ -fix15 y_pos; /* Y position (outline res units) */ -fix15 x_scale; /* X scale factor * ONE_SCALE */ -fix15 y_scale; /* Y scale factor * ONE_SCALE */ +tcb_t GLOBALFAR *ptcb, /* Transformation control block */ +fix15 x_pos, /* X position (outline res units) */ +fix15 y_pos, /* Y position (outline res units) */ +fix15 x_scale, /* X scale factor * ONE_SCALE */ +fix15 y_scale) /* Y scale factor * ONE_SCALE */ /* * Called by make_comp_char() to apply position and scale for each of the * components of a compound character. @@ -115,10 +110,10 @@ ptcb->yoffset = MULT16(yx_mult, x_pos) + MULT16(yy_mult, y_pos) + y_offset; type_tcb(ptcb); /* Reclassify transformation types */ } -FUNCTION ufix8 FONTFAR *skip_interpolation_table(pointer,format) +FUNCTION ufix8 FONTFAR *skip_interpolation_table( GDECL -ufix8 FONTFAR *pointer; /* Pointer to next byte in char data */ -ufix8 format; /* Character format byte */ +ufix8 FONTFAR *pointer, /* Pointer to next byte in char data */ +ufix8 format) /* Character format byte */ { fix15 i,n; ufix8 intsize[9]; @@ -133,8 +128,8 @@ intsize[6] = 2; intsize[7] = 0; intsize[8] = 0; -n = ((format & BIT6)? (fix15)NEXT_BYTE(pointer): 0) + - ((format & BIT7)? (fix15)NEXT_BYTE(pointer): 0); +n = ((format & BIT6)? (fix15)NEXT_BYTE(pointer): 0); +n += ((format & BIT7)? (fix15)NEXT_BYTE(pointer): 0); for (i = 0; i < n; i++) /* For each entry in int table ... */ { format = NEXT_BYTE(pointer); /* Read format byte */ @@ -150,10 +145,10 @@ for (i = 0; i < n; i++) /* For each entry in int table ... */ } return pointer; } -FUNCTION ufix8 FONTFAR *skip_control_zone(pointer,format) +FUNCTION ufix8 FONTFAR *skip_control_zone( GDECL -ufix8 FONTFAR *pointer; /* Pointer to next byte in char data */ -ufix8 format; /* Character format byte */ +ufix8 FONTFAR *pointer, /* Pointer to next byte in char data */ +ufix8 format) /* Character format byte */ { fix15 i,n; ufix16 tmpufix16; @@ -175,10 +170,10 @@ return pointer; #if INCL_RULES #else -FUNCTION ufix8 FONTFAR *plaid_tcb(pointer, format) +FUNCTION ufix8 FONTFAR *plaid_tcb( GDECL -ufix8 FONTFAR *pointer; /* Pointer to next byte in char data */ -ufix8 format; /* Character format byte */ +ufix8 FONTFAR *pointer, /* Pointer to next byte in char data */ +ufix8 format) /* Character format byte */ /* * Called by make_simp_char() and make_comp_char() to set up the controlled * coordinate table and skip all other intelligent scaling rules embedded @@ -211,10 +206,10 @@ return pointer; #endif #if INCL_RULES -FUNCTION ufix8 FONTFAR *plaid_tcb(pointer, format) +FUNCTION ufix8 FONTFAR *plaid_tcb( GDECL -ufix8 FONTFAR *pointer; /* Pointer to next byte in char data */ -ufix8 format; /* Character format byte */ +ufix8 FONTFAR *pointer, /* Pointer to next byte in char data */ +ufix8 format) /* Character format byte */ /* * Called by make_simp_char() and make_comp_char() to set up the controlled * coordinate table and process all intelligent scaling rules embedded @@ -442,9 +437,9 @@ for (i = 0; i < n; i++) } #endif -FUNCTION ufix8 FONTFAR *read_oru_table(pointer) +FUNCTION ufix8 FONTFAR *read_oru_table( GDECL -ufix8 FONTFAR *pointer; /* Pointer to first byte in controlled coord table */ +ufix8 FONTFAR *pointer) /* Pointer to first byte in controlled coord table */ /* * Called by plaid_tcb() to read the controlled coordinate table from the * character data in the font. @@ -525,15 +520,14 @@ for (i = 0; i < n; i++) return pointer; /* Update pointer */ } #if INCL_SQUEEZING || INCL_ISW -FUNCTION static void calculate_x_pix(start_edge, end_edge, constr_nr, - x_scale, x_offset, ppo, setwidth_pix) +FUNCTION static void calculate_x_pix( GDECL -ufix8 start_edge, end_edge; -ufix16 constr_nr; -fix31 x_scale; -fix31 x_offset; -fix31 ppo; -fix15 setwidth_pix; +ufix8 start_edge, ufix8 end_edge, +ufix16 constr_nr, +fix31 x_scale, +fix31 x_offset, +fix31 ppo, +fix15 setwidth_pix) /* * Called by sp_setup_pix_table() when X squeezing is necessary * to insert the correct edge in the global pix array @@ -593,14 +587,13 @@ if ((sp_globals.pspecs->flags & SQUEEZE_RIGHT) && #endif #if INCL_SQUEEZING -FUNCTION static void calculate_y_pix(start_edge, end_edge,constr_nr, - top_scale, bottom_scale,ppo,em_top_pix, em_bot_pix) +FUNCTION static void calculate_y_pix( GDECL -ufix8 start_edge, end_edge; -ufix16 constr_nr; -fix31 top_scale, bottom_scale; -fix31 ppo; -fix15 em_top_pix, em_bot_pix; +ufix8 start_edge, ufix8 end_edge, +ufix16 constr_nr, +fix31 top_scale, fix31 bottom_scale, +fix31 ppo, +fix15 em_top_pix, fix15 em_bot_pix) /* * Called by sp_setup_pix_table() when Y squeezing is necessary @@ -697,9 +690,9 @@ if ((sp_globals.pspecs->flags & SQUEEZE_BOTTOM) && FUNCTION boolean calculate_x_scale(x_factor, x_offset, no_X_ctrl_zones) GDECL -fix31 *x_factor; -fix31 *x_offset; -fix15 no_X_ctrl_zones; /* Number of X control zones */ +fix31 *x_factor, +fix31 *x_offset, +fix15 no_X_ctrl_zones) /* Number of X control zones */ /* * Called by sp_setup_pix_table() when squeezing is included * to determine whether X scaling is necessary. If it is, the @@ -850,12 +843,11 @@ for (i=0; i < (no_X_ctrl_zones+1); i++) return TRUE; } -FUNCTION boolean calculate_y_scale(top_scale, bottom_scale, - first_Y_zone, no_Y_ctrl_zones) +FUNCTION boolean calculate_y_scale( GDECL -fix31 *top_scale, *bottom_scale; -fix15 first_Y_zone; -fix15 no_Y_ctrl_zones; +fix31 *top_scale, fix31 *bottom_scale, +fix15 first_Y_zone, +fix15 no_Y_ctrl_zones) /* * Called by sp_setup_pix_table() when squeezing is included * to determine whether Y scaling is necessary. If it is, @@ -929,12 +921,11 @@ return TRUE; #if INCL_RULES FUNCTION static ufix8 FONTFAR *sp_setup_pix_table( - pointer, short_form, no_X_ctrl_zones, no_Y_ctrl_zones) GDECL -ufix8 FONTFAR *pointer; /* Pointer to first byte in control zone table */ -boolean short_form; /* TRUE if 1 byte from/to specification */ -fix15 no_X_ctrl_zones; /* Number of X control zones */ -fix15 no_Y_ctrl_zones; /* Number of Y control zones */ +ufix8 FONTFAR *pointer, /* Pointer to first byte in control zone table */ +boolean short_form, /* TRUE if 1 byte from/to specification */ +fix15 no_X_ctrl_zones, /* Number of X control zones */ +fix15 no_Y_ctrl_zones) /* Number of Y control zones */ /* * Called by plaid_tcb() to read the control zone table from the * character data in the font. @@ -1158,11 +1149,11 @@ return pointer; #if INCL_RULES -FUNCTION static ufix8 FONTFAR *sp_setup_int_table(pointer, no_X_int_zones, no_Y_int_zones) +FUNCTION static ufix8 FONTFAR *sp_setup_int_table( GDECL -ufix8 FONTFAR *pointer; /* Pointer to first byte in interpolation zone table */ -fix15 no_X_int_zones; /* Number of X interpolation zones */ -fix15 no_Y_int_zones; /* Number of X interpolation zones */ +ufix8 FONTFAR *pointer, /* Pointer to first byte in interpolation zone table */ +fix15 no_X_int_zones, /* Number of X interpolation zones */ +fix15 no_Y_int_zones) /* Number of X interpolation zones */ /* * Called by plaid_tcb() to read the interpolation zone table from the * character data in the font. @@ -1176,15 +1167,15 @@ fix15 i, j, k, l, n; ufix8 format; ufix8 format_copy; ufix8 tmpufix8; -fix15 start_orus; +fix15 start_orus = 0; ufix8 edge_org; ufix8 edge; ufix16 adj_factor; fix15 adj_orus; -fix15 end_orus; +fix15 end_orus = 0; fix31 zone_orus; -fix15 start_pix; -fix15 end_pix; +fix15 start_pix = 0; +fix15 end_pix = 0; #if INCL_PLAID_OUT /* Plaid data monitoring included? */ diff --git a/src/Speedo/spdo_prv.h b/src/Speedo/spdo_prv.h index 47c5252..272ffbf 100644 --- a/src/Speedo/spdo_prv.h +++ b/src/Speedo/spdo_prv.h @@ -21,6 +21,7 @@ INCIDENTAL OR CONSEQUENTIAL DAMAGES, ARISING OUT OF OR IN ANY WAY CONNECTED WITH THE SPEEDO SOFTWARE OR THE BITSTREAM CHARTER OUTLINE FONT. */ +/* $XFree86: xc/lib/font/Speedo/spdo_prv.h,v 1.5 2001/01/17 19:43:18 dawes Exp $ */ @@ -31,11 +32,6 @@ WITH THE SPEEDO SOFTWARE OR THE BITSTREAM CHARTER OUTLINE FONT. /***** CONFIGURATION DEFINITIONS *****/ -#ifndef INCL_PLAID_OUT -#define INCL_PLAID_OUT 0 /* 1 to include plaid data monitoring */ -#endif /* 0 to omit plaid data monitoring */ - - /***** PRIVATE FONT HEADER OFFSET CONSTANTS *****/ #define FH_ORUMX 0 /* U Max ORU value 2 bytes */ #define FH_PIXMX 2 /* U Max Pixel value 2 bytes */ @@ -269,7 +265,7 @@ WITH THE SPEEDO SOFTWARE OR THE BITSTREAM CHARTER OUTLINE FONT. #else -#define GDECL SPEEDO_GLOBALS* sp_global_ptr; +#define GDECL SPEEDO_GLOBALS* sp_global_ptr, #define get_char_id(char_index) sp_get_char_id(sp_global_ptr,char_index) #define get_char_width(char_index) sp_get_char_width(sp_global_ptr,char_index) diff --git a/src/Speedo/speedo.h b/src/Speedo/speedo.h index 277c6a6..a0b607f 100644 --- a/src/Speedo/speedo.h +++ b/src/Speedo/speedo.h @@ -21,6 +21,7 @@ INCIDENTAL OR CONSEQUENTIAL DAMAGES, ARISING OUT OF OR IN ANY WAY CONNECTED WITH THE SPEEDO SOFTWARE OR THE BITSTREAM CHARTER OUTLINE FONT. */ +/* $XFree86: xc/lib/font/Speedo/speedo.h,v 3.6 2001/07/25 15:04:55 dawes Exp $ */ #ifndef _SPEEDO_H_ #define _SPEEDO_H_ @@ -94,9 +95,9 @@ WITH THE SPEEDO SOFTWARE OR THE BITSTREAM CHARTER OUTLINE FONT. #define SHORT_LISTS 1 /* 1 to allocate small intercept lists */ #endif -#ifndef PROTOS_AVAIL /* 1 to use function prototyping */ -#define PROTOS_AVAIL 0 /* 0 to suppress it */ -#endif +#ifndef INCL_PLAID_OUT +#define INCL_PLAID_OUT 0 /* 1 to include plaid data monitoring */ +#endif /* 0 to omit plaid data monitoring */ #ifndef FONTFAR /* if Intel mixed memory model implementation */ #define FONTFAR /* pointer type modifier for font buffer */ @@ -171,7 +172,7 @@ typedef CARD32 ufix32; #endif #ifndef NULL -#define NULL 0 +#include <stddef.h> #endif #define FUNCTION @@ -215,8 +216,6 @@ typedef CARD32 ufix32; #endif /***** STRUCTURE DEFINITIONS *****/ -#if PROTOS_AVAIL - #if REENTRANT_ALLOC #define PROTO_DECL1 struct speedo_global_data GLOBALFAR *sp_global_ptr #define PROTO_DECL2 PROTO_DECL1 , @@ -224,7 +223,6 @@ typedef CARD32 ufix32; #define PROTO_DECL1 void #define PROTO_DECL2 #endif -#endif typedef struct buff_tag @@ -280,11 +278,7 @@ typedef struct specs_tag /* Bit 14: Clip top if set */ /* Bit 15: Clip bottom if set */ /* Bits 16-31 not used */ -#ifdef __STDC__ void *out_info; /* information for output module */ -#else - char *out_info; -#endif } specs_t; /* Specs structure for fw_set_specs */ @@ -365,7 +359,6 @@ typedef struct plaid_tag #endif #if INCL_MULTIDEV -#if PROTOS_AVAIL typedef struct bitmap_tag { void (*p_open_bitmap)(PROTO_DECL2 fix31 x_set_width, fix31 y_set_width, fix31 xorg, fix31 yorg, fix15 xsize,fix15 ysize); @@ -383,25 +376,6 @@ typedef struct outline_tag void (*p_close_contour)(PROTO_DECL1); void (*p_close_outline)(PROTO_DECL1); } outline_t; -#else -typedef struct bitmap_tag - { - void (*p_open_bitmap)(); - void (*p_set_bits)(); - void (*p_close_bitmap)(); - } bitmap_t; - -typedef struct outline_tag - { - void (*p_open_outline)(); - void (*p_start_char)(); - void (*p_start_contour)(); - void (*p_curve)(); - void (*p_line)(); - void (*p_close_contour)(); - void (*p_close_outline)(); - } outline_t; -#endif #endif /* ---------------------------------------------------*/ @@ -521,7 +495,6 @@ typedef struct speedo_global_data fix15 pixfix; /* Mask to remove fractional pixels */ fix15 onepix; /* 1.0 pixels in sub-pixel units */ -#if PROTOS_AVAIL boolean (*init_out)(PROTO_DECL2 specs_t GLOBALFAR *specsarg); boolean (*begin_char)(PROTO_DECL2 point_t Psw,point_t Pmin,point_t Pmax); void (*begin_sub_char)(PROTO_DECL2 point_t Psw,point_t Pmin,point_t Pmax); @@ -531,18 +504,6 @@ typedef struct speedo_global_data void (*end_contour)(PROTO_DECL1); void (*end_sub_char)(PROTO_DECL1); boolean (*end_char)(PROTO_DECL1); -#else /* if not protos */ - boolean (*init_out)(); - boolean (*begin_char)(); - void (*begin_sub_char)(); - void (*begin_contour)(); - void (*curve)(); - void (*line)(); - void (*end_contour)(); - void (*end_sub_char)(); - boolean (*end_char)(); -#endif /* end not protos */ - specs_t GLOBALFAR *pspecs; /* Pointer to specifications bundle */ specs_t specs; /* copy specs onto stack */ ufix8 FONTFAR *font_org; /* Pointer to start of font data */ @@ -762,7 +723,6 @@ EXTERN SPEEDO_GLOBALS GLOBALFAR *sp_global_ptr; * ***********************************************************************************/ -#if PROTOS_AVAIL /* do_char.c functions */ ufix16 sp_get_char_id(PROTO_DECL2 ufix16 char_index); boolean sp_make_char(PROTO_DECL2 ufix16 char_index); @@ -927,155 +887,4 @@ void sp_record_int_zone(PROTO_DECL2 fix31 start, fix31 end); /* Record void sp_end_plaid_data(PROTO_DECL1); /* Signal end of plaid data */ #endif -#else /* NO PROTOTYPES AVAILABLE */ - - - -/* do_char.c functions */ -boolean sp_make_char(); /* Make specified character */ -#if INCL_ISW -fix31 sp_compute_isw_scale(); -static boolean sp_do_make_char(); -boolean sp_make_char_isw(); /* Make specified character with */ - /* imported set widths.*/ -static boolean sp_reset_xmax(); -#endif -#if INCL_ISW || INCL_SQUEEZING -static void sp_preview_bounding_box(); -#endif -ufix16 sp_get_char_id(); /* Get character id for specified char */ - -#if INCL_METRICS /* Metrics functions supported? */ -fix31 sp_get_char_width(); /* Get character width for specified char */ -fix15 sp_get_track_kern(); /* Get track kerning for specified size */ -fix31 sp_get_pair_kern(); /* Get kerning for specified char pair */ -boolean sp_get_char_bbox(); -#endif - -/* do_trns.c functions */ -ufix8 FONTFAR *sp_read_bbox(); /* Read bounding box */ -void sp_proc_outl_data(); /* Process outline data */ - -/* out_0c.c functions */ -boolean sp_init_black(); -boolean sp_begin_char_black(); -void sp_begin_contour_black(); -void sp_line_black(); -boolean sp_end_char_black(); - -/* out_util.c functions */ -#if INCL_BLACK || INCL_SCREEN || INCL_2D - -void sp_init_char_out(); -void sp_begin_sub_char_out(); -void sp_curve_out(); -void sp_end_contour_out(); -void sp_end_sub_char_out(); -void sp_init_intercepts_out(); -void sp_restart_intercepts_out(); -void sp_set_first_band_out(); -void sp_reduce_band_size_out(); -boolean sp_next_band_out(); -#endif - -#if INCL_USEROUT -boolean sp_init_userout(); -#endif - -/* reset.c functions */ -void sp_reset(); /* Initialize Fontware mechanism */ - -#if INCL_KEYS -void sp_set_key(); -#endif -ufix16 sp_get_cust_no(); - -/* set_spcs.c functions */ -boolean sp_set_specs(); /* Set specifications */ -void sp_type_tcb(); /* Update transformation class in tcb */ - -fix31 sp_read_long(); /* Read long as 3 bytes encrypted */ -fix15 sp_read_word_u(); /* Read word as 2 bytes unencrypted */ - -/* set_trns.c functions */ -void sp_init_tcb(); /* Initialize current trans control block */ -void sp_scale_tcb(); /* Transform trans control block */ -ufix8 FONTFAR *sp_plaid_tcb(); /* Enable intelligent transformation */ -ufix8 FONTFAR *sp_skip_interpolation_table(); -ufix8 FONTFAR *sp_skip_control_zone(); - -ufix8 FONTFAR *sp_read_oru_table(); /* Read controlled coord table */ -#if INCL_SQUEEZING || INCL_ISW -static void sp_calculate_x_pix(); -#endif -#if INCL_SQUEEZING -static void sp_calculate_y_pix(); -boolean sp_calculate_x_scale(); -boolean sp_calculate_y_scale() ; -#endif - -/* user defined functions */ - -#if INCL_BLACK || INCL_SCREEN || INCL_2D -void sp_open_bitmap(); -void sp_set_bitmap_bits(); -void sp_close_bitmap(); -#endif - -#if INCL_OUTLINE -void sp_open_outline(); -void sp_start_new_char(); -void sp_start_contour(); -void sp_curve_to(); -void sp_line_to(); -void sp_close_contour(); -void sp_close_outline(); -#endif - -#if INCL_LCD /* Dynamic load character data supported? */ -buff_t *sp_load_char_data(); /* Load character data from font file */ -#endif - -#if INCL_PLAID_OUT /* Plaid data monitoring included? */ -void sp_record_xint(); /* Record xint data */ -void sp_record_yint(); /* Record yint data */ -void sp_begin_plaid_data(); /* Signal start of plaid data */ -void sp_begin_ctrl_zones(); /* Signal start of control zones */ -void sp_record_ctrl_zone(); /* Record control zone data */ -void sp_begin_int_zones(); /* Signal start of interpolation zones */ -void sp_record_int_zone(); /* Record interpolation zone data */ -void sp_end_plaid_data(); /* Signal end of plaid data */ -#endif - -boolean sp_init_screen(); /* If only screen-writer mode supported */ -boolean sp_begin_char_screen(); /* If screenwriter mode supported */ -void sp_begin_contour_screen(); /* If screenwriter mode supported */ -void sp_line_screen(); /* If screenwriter mode supported */ -void sp_curve_screen(); /* If screenwriter mode supported */ -void sp_scan_curve_screen(); -void sp_vert_line_screen(); -void sp_end_contour_screen(); -boolean sp_end_char_screen(); /* If screenwriter mode supported */ - - -boolean sp_init_outline(); /* If only vector output mode supported */ -boolean sp_begin_char_outline(); /* If only vector output mode supported */ -void sp_begin_sub_char_outline(); /* If only vector output mode supported */ -void sp_begin_contour_outline(); /* If only vector output mode supported */ -void sp_curve_outline(); /* If only vector output mode supported */ -void sp_line_outline(); /* If only vector output mode supported */ -void sp_end_contour_outline(); /* If only vector output mode supported */ -void sp_end_sub_char_outline(); /* If only vector output mode supported */ -boolean sp_end_char_outline(); /* If only vector output mode supported */ - -boolean sp_init_2d(); /* If screen-writer and other modes supported */ -boolean sp_begin_char_2d(); /* If screen-writer and other modes supported */ -void sp_begin_contour_2d(); /* If screen-writer and other modes supported */ -void sp_line_2d(); /* If screen-writer and other modes supported */ -boolean sp_end_char_2d(); /* If screen-writer and other modes supported */ - -#endif - - - #endif /* _SPEEDO_H_ */ diff --git a/src/Speedo/spencode.c b/src/Speedo/spencode.c index b74e71d..0daccff 100644 --- a/src/Speedo/spencode.c +++ b/src/Speedo/spencode.c @@ -47,12 +47,14 @@ other dealings in this Software without prior written authorization from The Open Group. */ +/* $XFree86: xc/lib/font/Speedo/spencode.c,v 1.7 2001/12/14 19:56:41 dawes Exp $ */ #include "spint.h" -#include "bics-iso.h" +/* No longer needed with new encoding code */ +/* #include "bics-iso.h" -int sp_bics_map_size = (sizeof(sp_bics_map) / (sizeof(int) * 2)); +int sp_bics_map_size = (sizeof(sp_bics_map) / (sizeof(int) * 2));*/ #ifdef EXTRAFONTS #include "adobe-iso.h" diff --git a/src/Speedo/sperr.c b/src/Speedo/sperr.c index 8d94d85..8be42c6 100644 --- a/src/Speedo/sperr.c +++ b/src/Speedo/sperr.c @@ -52,10 +52,15 @@ other dealings in this Software without prior written authorization from The Open Group. */ +/* $XFree86: xc/lib/font/Speedo/sperr.c,v 1.7 2002/05/31 18:45:48 dawes Exp $ */ + #include "spint.h" -#if NeedVarargsPrototypes +#ifndef FONTMODULE #include <stdarg.h> +#endif + +extern void ErrorF(const char* f, ...); void SpeedoErr(char *str, ...) @@ -70,20 +75,6 @@ SpeedoErr(char *str, ...) va_end(v); } -#else - -/* VARARGS1 */ -void -SpeedoErr(str, a1) - char *str; - char *a1; -{ - ErrorF("Speedo: "); - ErrorF(str, a1); -} -#endif /* NeedVarargsPrototypes else */ - - /* * Called by Speedo character generator to report an error. * @@ -91,8 +82,7 @@ SpeedoErr(str, a1) * that happens many times, don't report it to user */ void -sp_report_error(n) - fix15 n; +sp_report_error(fix15 n) { switch (n) { case 1: diff --git a/src/Speedo/spfile.c b/src/Speedo/spfile.c index 2eac82e..a5c34b3 100644 --- a/src/Speedo/spfile.c +++ b/src/Speedo/spfile.c @@ -49,11 +49,18 @@ other dealings in this Software without prior written authorization from The Open Group. */ +/* $XFree86: xc/lib/font/Speedo/spfile.c,v 1.14 2001/12/14 19:56:41 dawes Exp $ */ -#include <stdio.h> #include "fntfilst.h" +#include "fontenc.h" +#ifndef FONTMODULE +#include <stdio.h> +#else +#include "xf86_ansic.h" +#endif #include "spint.h" +#include "bics-unicode.h" SpeedoFontPtr sp_fp_cur = (SpeedoFontPtr) 0; @@ -122,8 +129,7 @@ static ufix8 mkey[] = static fix15 -read_2b(ptr) - ufix8 *ptr; +read_2b(ufix8 *ptr) { fix15 tmp; @@ -133,8 +139,7 @@ read_2b(ptr) } static fix31 -read_4b(ptr) - ufix8 *ptr; +read_4b(ufix8 *ptr) { fix31 tmp; @@ -149,10 +154,7 @@ read_4b(ptr) * loads the specified char's data */ buff_t * -sp_load_char_data(file_offset, num, cb_offset) - fix31 file_offset; - fix15 num; - fix15 cb_offset; +sp_load_char_data(fix31 file_offset, fix15 num, fix15 cb_offset) { SpeedoMasterFontPtr master = sp_fp_cur->master; @@ -172,10 +174,115 @@ sp_load_char_data(file_offset, num, cb_offset) return &master->char_data; } +struct speedo_encoding { + char *name; + int *enc; + int enc_size; +}; + +/* Takes care of caching encodings already referenced */ +static int +find_encoding(const char *fontname, const char *filename, + int **enc, int *enc_size) +{ + static struct speedo_encoding *known_encodings=0; + static int number_known_encodings=0; + static int known_encodings_size=0; + + char *encoding_name; + int iso8859_1; + FontMapPtr mapping; + int i, j, k, size; + struct speedo_encoding *temp; + int *new_enc; + char *new_name; + + iso8859_1 = 0; + + encoding_name = FontEncFromXLFD(fontname, strlen(fontname)); + if(!encoding_name) { + encoding_name="iso8859-1"; + iso8859_1=1; + } + /* We don't go through the font library if asked for Latin-1 */ + iso8859_1 = iso8859_1 || !strcmp(encoding_name, "iso8859-1"); + + for(i=0; i<number_known_encodings; i++) { + if(!strcmp(encoding_name, known_encodings[i].name)) { + *enc=known_encodings[i].enc; + *enc_size=known_encodings[i].enc_size; + return Successful; + } + } + + /* it hasn't been cached yet, need to compute it */ + + /* ensure we've got enough storage first */ + + if(known_encodings==0) { + if((known_encodings= + (struct speedo_encoding*)xalloc(2*sizeof(struct speedo_encoding))) + ==0) + return AllocError; + number_known_encodings=0; + known_encodings_size=2; + } + + if(number_known_encodings >= known_encodings_size) { + if((temp= + (struct speedo_encoding*)xrealloc(known_encodings, + 2*sizeof(struct speedo_encoding)* + known_encodings_size))==0) + return AllocError; + known_encodings=temp; + known_encodings_size*=2; + } + + mapping=0; + if(!iso8859_1) { + mapping = FontEncMapFind(encoding_name, + FONT_ENCODING_UNICODE, -1, -1, + filename); + } +#define SPEEDO_RECODE(c) \ + (mapping? \ + unicode_to_bics(FontEncRecode(c, mapping)): \ + unicode_to_bics(c)) + + if((new_name = (char*)xalloc(strlen(encoding_name)))==0) + return AllocError; + strcpy(new_name, encoding_name); + + /* For now, we limit ourselves to 256 glyphs */ + size=0; + for(i=0; i < (mapping?mapping->encoding->size:256) && i < 256; i++) + if(SPEEDO_RECODE(i)>=0) + size++; + new_enc = (int*)xalloc(2*size*sizeof(int)); + if(!new_enc) { + xfree(new_name); + return AllocError; + } + for(i=j=0; i < (mapping?mapping->encoding->size:256) && i < 256; i++) + if((k = SPEEDO_RECODE(i))>=0) { + new_enc[2*j] = i; + new_enc[2*j+1] = k; + j++; + } + known_encodings[number_known_encodings].name = new_name; + known_encodings[number_known_encodings].enc = new_enc; + known_encodings[number_known_encodings].enc_size = size; + number_known_encodings++; + + *enc = new_enc; + *enc_size = size; + return Successful; +#undef SPEEDO_RECODE +} + int -sp_open_master(filename, master) - char *filename; - SpeedoMasterFontPtr *master; +sp_open_master(const char *fontname, const char *filename, + SpeedoMasterFontPtr *master) { SpeedoMasterFontPtr spmf; ufix8 tmp[16]; @@ -273,8 +380,8 @@ sp_open_master(filename, master) spmf->num_chars = read_2b(f_buffer + FH_NCHRL); - spmf->enc = sp_bics_map; - spmf->enc_size = sp_bics_map_size; + spmf->enc = 0; + spmf->enc_size = 0; #ifdef EXTRAFONTS { /* choose the proper encoding */ @@ -291,7 +398,11 @@ sp_open_master(filename, master) } #endif - /* XXX slam back to ISO Latin1 */ + if(!spmf->enc) + if((ret=find_encoding(fontname, filename, &spmf->enc, &spmf->enc_size)) + !=Successful) + goto cleanup; + spmf->first_char_id = spmf->enc[0]; /* size of extents array */ spmf->max_id = spmf->enc[(spmf->enc_size - 1) * 2]; @@ -308,8 +419,7 @@ cleanup: } void -sp_close_master_font(spmf) - SpeedoMasterFontPtr spmf; +sp_close_master_font(SpeedoMasterFontPtr spmf) { if (!spmf) return; @@ -324,8 +434,7 @@ sp_close_master_font(spmf) } void -sp_close_master_file(spmf) - SpeedoMasterFontPtr spmf; +sp_close_master_file(SpeedoMasterFontPtr spmf) { (void) fclose(spmf->fp); spmf->state &= ~MasterFileOpen; @@ -336,8 +445,7 @@ sp_close_master_file(spmf) * reset the encryption key, and make sure the file is opened */ void -sp_reset_master(spmf) - SpeedoMasterFontPtr spmf; +sp_reset_master(SpeedoMasterFontPtr spmf) { sp_set_key(spmf->key); if (!(spmf->state & MasterFileOpen)) { diff --git a/src/Speedo/spfont.c b/src/Speedo/spfont.c index ebfc526..61ec6d4 100644 --- a/src/Speedo/spfont.c +++ b/src/Speedo/spfont.c @@ -21,6 +21,7 @@ * * Author: Dave Lemke, Network Computing Devices Inc */ +/* $XFree86: xc/lib/font/Speedo/spfont.c,v 3.12 2001/12/14 19:56:41 dawes Exp $ */ /* @@ -56,7 +57,9 @@ from The Open Group. #include "FSproto.h" #include "spint.h" -#include <servermd.h> +#include "servermd.h" +#include "fontutil.h" +#ifndef FONTMODULE #ifdef _XOPEN_SOURCE #include <math.h> #else @@ -64,6 +67,9 @@ from The Open Group. #include <math.h> #undef _XOPEN_SOURCE #endif +#else +#include "xf86_ansic.h" +#endif #ifndef M_PI #define M_PI 3.14159 @@ -78,19 +84,16 @@ from The Open Group. #endif -extern void SpeedoCloseFont(); -static int sp_get_glyphs(); -static int sp_get_metrics(); -static int sp_load_font(); +static void SpeedoCloseFont(FontPtr pfont); static int -sp_get_glyphs(pFont, count, chars, charEncoding, glyphCount, glyphs) - FontPtr pFont; - unsigned long count; - register unsigned char *chars; - FontEncoding charEncoding; - unsigned long *glyphCount; /* RETURN */ - CharInfoPtr *glyphs; /* RETURN */ +sp_get_glyphs( + FontPtr pFont, + unsigned long count, + register unsigned char *chars, + FontEncoding charEncoding, + unsigned long *glyphCount, /* RETURN */ + CharInfoPtr *glyphs) /* RETURN */ { SpeedoFontPtr spf; unsigned int firstCol; @@ -196,13 +199,13 @@ sp_get_glyphs(pFont, count, chars, charEncoding, glyphCount, glyphs) static CharInfoRec nonExistantChar; static int -sp_get_metrics(pFont, count, chars, charEncoding, glyphCount, glyphs) - FontPtr pFont; - unsigned long count; - register unsigned char *chars; - FontEncoding charEncoding; - unsigned long *glyphCount; /* RETURN */ - xCharInfo **glyphs; /* RETURN */ +sp_get_metrics( + FontPtr pFont, + unsigned long count, + register unsigned char *chars, + FontEncoding charEncoding, + unsigned long *glyphCount, /* RETURN */ + xCharInfo **glyphs) /* RETURN */ { int ret; SpeedoFontPtr spf; @@ -219,15 +222,15 @@ sp_get_metrics(pFont, count, chars, charEncoding, glyphCount, glyphs) } int -sp_open_font(fontname, filename, entry, vals, format, fmask, flags, spfont) - char *fontname, - *filename; - FontEntryPtr entry; - FontScalablePtr vals; - fsBitmapFormat format; - fsBitmapFormatMask fmask; - Mask flags; - SpeedoFontPtr *spfont; +sp_open_font( + char *fontname, + char *filename, + FontEntryPtr entry, + FontScalablePtr vals, + fsBitmapFormat format, + fsBitmapFormatMask fmask, + Mask flags, + SpeedoFontPtr *spfont) { SpeedoFontPtr spf; SpeedoMasterFontPtr spmf; @@ -239,7 +242,7 @@ sp_open_font(fontname, filename, entry, vals, format, fmask, flags, spfont) spmf = (SpeedoMasterFontPtr) entry->u.scalable.extra->private; if (!spmf) { - ret = sp_open_master(filename, &spmf); + ret = sp_open_master(fontname, filename, &spmf); if (ret != Successful) return ret; entry->u.scalable.extra->private = (pointer) spmf; @@ -314,15 +317,15 @@ sp_open_font(fontname, filename, entry, vals, format, fmask, flags, spfont) } static int -sp_load_font(fontname, filename, entry, vals, format, fmask, pfont, flags) +sp_load_font( char *fontname, - *filename; - FontEntryPtr entry; - FontScalablePtr vals; - fsBitmapFormat format; - fsBitmapFormatMask fmask; - FontPtr pfont; - Mask flags; + char *filename, + FontEntryPtr entry, + FontScalablePtr vals, + fsBitmapFormat format, + fsBitmapFormatMask fmask, + FontPtr pfont, + Mask flags) { SpeedoFontPtr spf; SpeedoMasterFontPtr spmf; @@ -377,8 +380,6 @@ sp_load_font(fontname, filename, entry, vals, format, fmask, pfont, flags) pfont->unload_font = SpeedoCloseFont; pfont->unload_glyphs = NULL; pfont->refcnt = 0; - pfont->maxPrivate = -1; - pfont->devPrivates = (pointer *) 0; /* have to hold on to master for min/max id */ sp_close_master_file(spmf); @@ -387,15 +388,15 @@ sp_load_font(fontname, filename, entry, vals, format, fmask, pfont, flags) } int -SpeedoFontLoad(ppfont, fontname, filename, entry, vals, format, fmask, flags) - FontPtr *ppfont; - char *fontname; - char *filename; - FontEntryPtr entry; - FontScalablePtr vals; - fsBitmapFormat format; - fsBitmapFormatMask fmask; - Mask flags; +SpeedoFontLoad( + FontPtr *ppfont, + char *fontname, + char *filename, + FontEntryPtr entry, + FontScalablePtr vals, + fsBitmapFormat format, + fsBitmapFormatMask fmask, + Mask flags) { FontPtr pfont; int ret; @@ -405,24 +406,22 @@ SpeedoFontLoad(ppfont, fontname, filename, entry, vals, format, fmask, flags) hypot(vals->pixel_matrix[2], vals->pixel_matrix[3]) < 1.0) return BadFontName; - pfont = (FontPtr) xalloc(sizeof(FontRec)); - if (!pfont) { + if (!(pfont = CreateFontRec())) return AllocError; - } + ret = sp_load_font(fontname, filename, entry, vals, format, fmask, pfont, flags); if (ret == Successful) *ppfont = pfont; else - xfree (pfont); + DestroyFontRec (pfont); return ret; } void -sp_close_font(spf) - SpeedoFontPtr spf; +sp_close_font(SpeedoFontPtr spf) { SpeedoMasterFontPtr spmf; @@ -435,9 +434,8 @@ sp_close_font(spf) xfree(spf); } -void -SpeedoCloseFont(pfont) - FontPtr pfont; +static void +SpeedoCloseFont(FontPtr pfont) { SpeedoFontPtr spf; @@ -445,6 +443,6 @@ SpeedoCloseFont(pfont) sp_close_font(spf); xfree(pfont->info.isStringProp); xfree(pfont->info.props); - xfree(pfont->devPrivates); - xfree(pfont); + DestroyFontRec(pfont); + } diff --git a/src/Speedo/spfuncs.c b/src/Speedo/spfuncs.c index 0cd09ee..18204eb 100644 --- a/src/Speedo/spfuncs.c +++ b/src/Speedo/spfuncs.c @@ -49,24 +49,27 @@ other dealings in this Software without prior written authorization from The Open Group. */ +/* $XFree86: xc/lib/font/Speedo/spfuncs.c,v 1.8 2001/12/14 19:56:42 dawes Exp $ */ +#ifndef FONTMODULE #include <X11/Xos.h> +#endif #include "fntfilst.h" +#include "fontutil.h" #include "spint.h" /* ARGSUSED */ -int -SpeedoOpenScalable (fpe, pFont, flags, entry, fileName, vals, format, fmask, - non_cachable_font) - FontPathElementPtr fpe; - FontPtr *pFont; - int flags; - FontEntryPtr entry; - char *fileName; - FontScalablePtr vals; - fsBitmapFormat format; - fsBitmapFormatMask fmask; - FontPtr non_cachable_font; /* We don't do licensing */ +static int +SpeedoOpenScalable ( + FontPathElementPtr fpe, + FontPtr *pFont, + int flags, + FontEntryPtr entry, + char *fileName, + FontScalablePtr vals, + fsBitmapFormat format, + fsBitmapFormatMask fmask, + FontPtr non_cachable_font) /* We don't do licensing */ { char fullName[MAXFONTNAMELEN]; @@ -85,13 +88,13 @@ SpeedoOpenScalable (fpe, pFont, flags, entry, fileName, vals, format, fmask, * and to simply save the values without doing the work. */ static int -get_font_info(pinfo, fontname, filename, entry, vals, spfont) - FontInfoPtr pinfo; - char *fontname; - char *filename; - FontEntryPtr entry; - FontScalablePtr vals; - SpeedoFontPtr *spfont; +get_font_info( + FontInfoPtr pinfo, + char *fontname, + char *filename, + FontEntryPtr entry, + FontScalablePtr vals, + SpeedoFontPtr *spfont) { SpeedoFontPtr spf; int err; @@ -122,14 +125,14 @@ get_font_info(pinfo, fontname, filename, entry, vals, spfont) } /* ARGSUSED */ -int -SpeedoGetInfoScaleable(fpe, pFontInfo, entry, fontName, fileName, vals) - FontPathElementPtr fpe; - FontInfoPtr pFontInfo; - FontEntryPtr entry; - FontNamePtr fontName; - char *fileName; - FontScalablePtr vals; +static int +SpeedoGetInfoScaleable( + FontPathElementPtr fpe, + FontInfoPtr pFontInfo, + FontEntryPtr entry, + FontNamePtr fontName, + char *fileName, + FontScalablePtr vals) { SpeedoFontPtr spf = NULL; char fullName[MAXFONTNAMELEN]; @@ -147,8 +150,8 @@ SpeedoGetInfoScaleable(fpe, pFontInfo, entry, fontName, fileName, vals) } static FontRendererRec renderer = { - ".spd", 4, (int (*)()) 0, SpeedoOpenScalable, - (int (*)()) 0, SpeedoGetInfoScaleable, 0 + ".spd", 4, NULL, SpeedoOpenScalable, + NULL, SpeedoGetInfoScaleable, 0 , CAP_MATRIX | CAP_CHARSUBSETTING }; diff --git a/src/Speedo/spglyph.c b/src/Speedo/spglyph.c index ff0f370..6db6302 100644 --- a/src/Speedo/spglyph.c +++ b/src/Speedo/spglyph.c @@ -49,9 +49,11 @@ other dealings in this Software without prior written authorization from The Open Group. */ +/* $XFree86: xc/lib/font/Speedo/spglyph.c,v 1.7 2001/12/14 19:56:42 dawes Exp $ */ #include <X11/X.h> /* for bit order #defines */ #include "spint.h" +#include "fontutil.h" #undef CLIP_BBOX_NOISE @@ -62,12 +64,12 @@ static int bit_order, scan; unsigned long -sp_compute_data_size(pfont, mappad, scanlinepad, start, end) - FontPtr pfont; +sp_compute_data_size( + FontPtr pfont, int mappad, - scanlinepad; + int scanlinepad, unsigned long start, - end; + unsigned long end) { unsigned long ch; unsigned long size = 0; @@ -121,8 +123,7 @@ sp_compute_data_size(pfont, mappad, scanlinepad, start, end) } static void -finish_line(spf) - SpeedoFontPtr spf; +finish_line(SpeedoFontPtr spf) { int bpr = cfv->bpr; CharInfoPtr ci = &spf->encoding[cfv->char_id - spf->master->first_char_id]; @@ -131,17 +132,14 @@ finish_line(spf) bpr = GLYPH_SIZE(ci, cfv->scanpad); } if (bpr) { /* char may not have any metrics... */ - cfv->bp += bpr; + cfv->bp = (char *)cfv->bp + bpr; } assert(cfv->bp - sp_fp_cur->bitmaps <= sp_fp_cur->bitmap_size); } void -sp_set_bitmap_bits(y, xbit1, xbit2) - fix15 y; - fix15 xbit1, - xbit2; +sp_set_bitmap_bits(fix15 y, fix15 xbit1, fix15 xbit2) { int nmiddle; CARD8 startmask, @@ -188,7 +186,7 @@ sp_set_bitmap_bits(y, xbit1, xbit2) xbit1 = 0; nmiddle = (xbit1 >> 3); - dst = (CARD8 *) (cfv->bp + nmiddle); + dst = (CARD8 *)cfv->bp + nmiddle; xbit2 -= (xbit1 & ~7); nmiddle = (xbit2 >> 3); xbit1 &= 7; @@ -212,13 +210,8 @@ sp_set_bitmap_bits(y, xbit1, xbit2) /* ARGSUSED */ void -sp_open_bitmap(x_set_width, y_set_width, xorg, yorg, xsize, ysize) - fix31 x_set_width; - fix31 y_set_width; - fix31 xorg; - fix31 yorg; - fix15 xsize; - fix15 ysize; +sp_open_bitmap(fix31 x_set_width, fix31 y_set_width, fix31 xorg, fix31 yorg, + fix15 xsize, fix15 ysize) { CharInfoPtr ci = &sp_fp_cur->encoding[cfv->char_id - sp_fp_cur->master->first_char_id]; @@ -314,10 +307,10 @@ sp_close_bitmap() } int -sp_build_all_bitmaps(pfont, format, fmask) - FontPtr pfont; - fsBitmapFormat format; - fsBitmapFormatMask fmask; +sp_build_all_bitmaps( + FontPtr pfont, + fsBitmapFormat format, + fsBitmapFormatMask fmask) { int ret, glyph = 1, @@ -372,7 +365,7 @@ sp_build_all_bitmaps(pfont, format, fmask) int j; cfv->char_index = spmf->enc[i * 2 + 1]; cfv->char_id = spmf->enc[i * 2]; -#if DEBUG +#ifdef DEBUG fprintf(stderr, "build_all_sp_bitmaps:i = %d, Char ID = %d\n", i, cfv->char_id); #endif if (!cfv->char_id) diff --git a/src/Speedo/spinfo.c b/src/Speedo/spinfo.c index 05d3f24..d857485 100644 --- a/src/Speedo/spinfo.c +++ b/src/Speedo/spinfo.c @@ -49,10 +49,16 @@ other dealings in this Software without prior written authorization from The Open Group. */ +/* $XFree86: xc/lib/font/Speedo/spinfo.c,v 1.13 2002/09/10 16:14:33 tsi Exp $ */ #include "fntfilst.h" +#include "fontutil.h" #include "spint.h" +#ifndef FONTMODULE #include <math.h> +#else +#include "xf86_ansic.h" +#endif /* percentage of pointsize used to specify ascent & descent */ #define STRETCH_FACTOR 120 @@ -95,7 +101,9 @@ static fontProp extraProps[] = { { "RAW_POINT_SIZE", 0, }, { "RAW_ASCENT", 0, }, { "RAW_DESCENT", 0, }, - { "RAW_AVERAGE_WIDTH", 0, } + { "RAW_AVERAGE_WIDTH", 0, }, + { "FONT_TYPE", 0, }, + { "RASTERIZER_NAME", 0, } }; /* this is a bit kludgy */ @@ -106,15 +114,14 @@ static fontProp extraProps[] = { #define RAWASCENTPROP 4 #define RAWDESCENTPROP 5 #define RAWWIDTHPROP 6 - +#define FONT_TYPEPROP 7 +#define RASTERIZER_NAMEPROP 8 #define NNAMEPROPS (sizeof(fontNamePropTable) / sizeof(fontProp)) #define NEXTRAPROPS (sizeof(extraProps) / sizeof(fontProp)) #define NPROPS (NNAMEPROPS + NEXTRAPROPS) -extern Atom MakeAtom(); - void sp_make_standard_props() { @@ -130,9 +137,9 @@ sp_make_standard_props() } void -sp_make_header(spf, pinfo) - SpeedoFontPtr spf; - FontInfoPtr pinfo; +sp_make_header( + SpeedoFontPtr spf, + FontInfoPtr pinfo) { int pixel_size; SpeedoMasterFontPtr spmf = spf->master; @@ -172,10 +179,10 @@ sp_make_header(spf, pinfo) } static void -adjust_min_max(minc, maxc, tmp) +adjust_min_max( xCharInfo *minc, - *maxc, - *tmp; + xCharInfo *maxc, + xCharInfo *tmp) { #define MINMAX(field,ci) \ if (minc->field > (ci)->field) \ @@ -199,11 +206,11 @@ adjust_min_max(minc, maxc, tmp) void -sp_compute_bounds(spf, pinfo, flags, sWidth) - SpeedoFontPtr spf; - FontInfoPtr pinfo; - unsigned long flags; - long *sWidth; +sp_compute_bounds( + SpeedoFontPtr spf, + FontInfoPtr pinfo, + unsigned long flags, + long *sWidth) { int i, id, @@ -327,18 +334,18 @@ sp_compute_bounds(spf, pinfo, flags, sWidth) } void -sp_compute_props(spf, fontname, pinfo, sWidth) - SpeedoFontPtr spf; - char *fontname; - FontInfoPtr pinfo; - long sWidth; +sp_compute_props( + SpeedoFontPtr spf, + char *fontname, + FontInfoPtr pinfo, + long sWidth) { FontPropPtr pp; int i, nprops; fontProp *fpt; char *is_str; - char *ptr1, + char *ptr1 = NULL, *ptr2; char *ptr3; char tmpname[1024]; @@ -352,6 +359,7 @@ sp_compute_props(spf, fontname, pinfo, sWidth) pinfo->isStringProp = (char *) 0; xfree(pinfo->props); pinfo->props = (FontPropPtr) 0; + pinfo->nprops = 0; return; } bzero(pinfo->isStringProp, (sizeof(char) * nprops)); @@ -416,6 +424,16 @@ sp_compute_props(spf, fontname, pinfo, sWidth) pp->value = MakeAtom(spf->master->copyright, strlen(spf->master->copyright), TRUE); break; + case FONT_TYPEPROP: + *is_str = TRUE; + pp->value = MakeAtom("Speedo", strlen("Speedo"), TRUE); + break; + case RASTERIZER_NAMEPROP: + *is_str = TRUE; + pp->value = MakeAtom("X Consortium Speedo Rasterizer", + strlen("X Consortium Speedo Rasterizer"), + TRUE); + break; case RAWPIXELPROP: *is_str = FALSE; pp->value = 1000; diff --git a/src/Speedo/spint.h b/src/Speedo/spint.h index d915238..377edd8 100644 --- a/src/Speedo/spint.h +++ b/src/Speedo/spint.h @@ -47,12 +47,17 @@ other dealings in this Software without prior written authorization from The Open Group. */ +/* $XFree86: xc/lib/font/Speedo/spint.h,v 1.10 2001/12/14 19:56:42 dawes Exp $ */ #ifndef _SPINT_H_ #define _SPINT_H_ -#include <stdio.h> #include "fntfilst.h" +#ifndef XFree86LOADER +#include <stdio.h> +#else +#include <xf86_ansic.h> +#endif #include <X11/Xfuncproto.h> #include "speedo.h" @@ -141,24 +146,27 @@ typedef struct _sp_font { extern SpeedoFontPtr sp_fp_cur; -extern int sp_open_font(); -extern int sp_open_master(); -extern void sp_close_font(); -extern void sp_close_master_font(); -extern void sp_close_master_file(); -extern void sp_reset_master(); -#if NeedVarargsPrototypes +extern int sp_open_font(char *, char *, FontEntryPtr, FontScalablePtr, + fsBitmapFormat, fsBitmapFormatMask, Mask, + SpeedoFontPtr *); +extern int sp_open_master(const char *, const char *, SpeedoMasterFontPtr *); +extern void sp_close_font(SpeedoFontPtr); +extern void sp_close_master_font(SpeedoMasterFontPtr); +extern void sp_close_master_file(SpeedoMasterFontPtr); +extern void sp_reset_master(SpeedoMasterFontPtr); extern void SpeedoErr(char *fmt, ...); -#else -extern void SpeedoErr(); -#endif -extern void sp_make_standard_props(); -extern void sp_make_header(); -extern void sp_compute_bounds(); -extern void sp_compute_props(); -extern int sp_build_all_bitmaps(); -extern unsigned long sp_compute_data_size(); +extern void sp_make_standard_props(void); +extern void sp_make_header(SpeedoFontPtr, FontInfoPtr); +extern void sp_compute_bounds(SpeedoFontPtr, FontInfoPtr, unsigned long, long *); +extern void sp_compute_props(SpeedoFontPtr, char *, FontInfoPtr, long); +extern int sp_build_all_bitmaps(FontPtr, fsBitmapFormat, fsBitmapFormatMask); +extern unsigned long sp_compute_data_size(FontPtr, int, int, unsigned long, + unsigned long); + +extern int SpeedoFontLoad(FontPtr *, char *, char *, FontEntryPtr, + FontScalablePtr, fsBitmapFormat, fsBitmapFormatMask, + Mask); extern int sp_bics_map[]; extern int sp_bics_map_size; |