diff options
Diffstat (limited to 'gf/gf_input.c')
-rw-r--r-- | gf/gf_input.c | 58 |
1 files changed, 29 insertions, 29 deletions
diff --git a/gf/gf_input.c b/gf/gf_input.c index a5f6ace..caff3be 100644 --- a/gf/gf_input.c +++ b/gf/gf_input.c @@ -108,7 +108,7 @@ void gf_close_input_file () { unsigned code; - + assert (gf_input_file != NULL); xfclose (gf_input_file, gf_input_filename); @@ -116,7 +116,7 @@ gf_close_input_file () gf_input_filename = NULL; gf_input_file = NULL; private_postamble = NULL; - + for (code = 0; code <= MAX_CHARCODE; code++) char_list[code] = NULL; } @@ -213,7 +213,7 @@ get_postamble () scaled by 2^16. */ GF_H_RESOLUTION (*private_postamble) = GF_GET_FOUR (); GF_V_RESOLUTION (*private_postamble) = GF_GET_FOUR (); - + MIN_COL (GF_FONT_BB (*private_postamble)) = GF_GET_SIGNED_FOUR (); MAX_COL (GF_FONT_BB (*private_postamble)) = GF_GET_SIGNED_FOUR (); MIN_ROW (GF_FONT_BB (*private_postamble)) = GF_GET_SIGNED_FOUR (); @@ -348,10 +348,10 @@ get_full_boc (gf_char_type *gf_char) charcode); GF_CHARCODE (*gf_char) = charcode; - + back_pointer = GF_GET_SIGNED_FOUR (); if (back_pointer != -1) - WARNING2 ("Character %u has a non-null back pointer (to %d)", + WARNING2 ("Character %u has a non-null back pointer (to %d)", GF_CHARCODE (*gf_char), back_pointer); GF_CHAR_MIN_COL (*gf_char) = GF_GET_SIGNED_FOUR (); @@ -473,7 +473,7 @@ deblank (gf_char_type *gf_char) || white_on_top > 0 || white_on_bottom > 0) { bitmap_type condensed; - + if (white_on_left + white_on_right > width) { /* The character was entirely blank. */ BITMAP_WIDTH (condensed) = BITMAP_HEIGHT (condensed) = 0; @@ -510,7 +510,7 @@ deblank (gf_char_type *gf_char) /* The ``bitmap'' is a sequence of commands that describe it in terms of run-length encoding. - GF's row and column numbers are the lower left corner of a pixel. + GF's row and column numbers are the lower left corner of a pixel. GF (0,0) is the Cartesian unit square: 0 <= x (col) <= 1, 0 <= y (row) <= 1. Yes, it's <=, not <. What does this mean for the maxes and mins? Let's take the height first: if a character has @@ -521,8 +521,8 @@ deblank (gf_char_type *gf_char) if a character has min_row = 0 and max_row = 4, the current x starts at zero, we paint four pixels (let's say), and now the current x is four (the max possible), so we cannot paint any more. Thus there are - four (4 - 0) columns in which we might paint pixels. - + four (4 - 0) columns in which we might paint pixels. + Weird, huh? */ static void @@ -553,7 +553,7 @@ get_character_bitmap (gf_char_type *gf_char) = BITMAP_WIDTH (GF_BITMAP (*gf_char)) = 0; BITMAP_BITS (GF_BITMAP (*gf_char)) = NULL; - + /* The next non-NO_OP byte should be EOC. */ while ((b = GF_GET_BYTE ()) == NO_OP) /* do nothing */ ; @@ -562,7 +562,7 @@ get_character_bitmap (gf_char_type *gf_char) return; } - + DIMENSIONS_HEIGHT (matrix_dimensions) = height; DIMENSIONS_WIDTH (matrix_dimensions) = width; GF_BITMAP (*gf_char) = new_bitmap (matrix_dimensions); @@ -749,25 +749,25 @@ gf_get_raw_char (one_byte charcode) (void) gf_get_postamble (); assert (private_postamble != NULL); - + char_locator = GF_CHAR_LOC (*private_postamble, charcode); char_pointer = char_locator.char_pointer; /* If the character doesn't exist in the font, we're done. */ if (char_pointer == NULL_BYTE_PTR) return NULL; - + /* Save where we are in the file; we'll restore it when we're done. */ old_pos = GF_FTELL (); GF_FSEEK (char_pointer, SEEK_SET); - + raw_char = xmalloc (sizeof (raw_char_type)); *raw_char = new_raw_gf_char (char_locator); /* Unfortunately, the GF format doesn't tell us how many bytes long the character description is. So, we must decode it enough to figure out how much to read. */ - + /* The first step is the boc: it might be either the one-byte or four-byte variant. */ b = GF_GET_BYTE (); @@ -778,7 +778,7 @@ gf_get_raw_char (one_byte charcode) APPEND_BYTES (24); else /* b == BOC1 */ APPEND_BYTES (5); - + /* Read the character definition; exit when we get to EOC. */ while ((b = GF_GET_BYTE ()) != EOC) { @@ -789,51 +789,51 @@ gf_get_raw_char (one_byte charcode) || b == SKIP0 || (NEW_ROW_0 <= b && b <= NEW_ROW_164)) APPEND_BYTES (0); - + /* Now the ones with a one-byte parameter. */ else if (b == PAINT1 || b == SKIP1) APPEND_BYTES (1); - + /* A two-byte parameter. */ else if (b == PAINT2 || b == SKIP2) APPEND_BYTES (2); - + /* Three-byte. */ else if (b == PAINT3 || b == SKIP3) APPEND_BYTES (3); - + /* Four. */ else if (b == YYY) APPEND_BYTES (4); - + /* Commands with a variable-size parameter. */ else if (b == XXX1) { one_byte size = GF_GET_BYTE (); APPEND_VAR_BYTES (size); } - + else if (b == XXX2) { two_bytes size = GF_GET_TWO (); APPEND_VAR_BYTES (size); } - + else if (b == XXX3) { four_bytes size = gf_get_three (); APPEND_VAR_BYTES (size); } - + else if (b == XXX4) { four_bytes size = GF_GET_FOUR (); APPEND_VAR_BYTES (size); } - + else if (b == NO_OP) /* do nothing */; - + else FATAL1 ("gf_get_raw_char: Bad command byte %u", b); } @@ -889,16 +889,16 @@ static raw_char_type new_raw_gf_char (gf_char_locator_type locator) { raw_char_type c; - + RAW_CHAR_ALLOCATED (c) = 1; RAW_CHAR_BYTES (c) = xmalloc (RAW_CHAR_ALLOCATED (c)); RAW_CHAR_USED (c) = 0; - + GF_CHARCODE (c) = locator.charcode; GF_H_ESCAPEMENT (c) = locator.h_escapement; GF_TFM_WIDTH (c) = locator.tfm_width; GF_CHAR_BB (c) = GF_FONT_BB (*private_postamble); - + /* Since we don't want to interpret the bounding box information in the character, we just make our bounding box be the font bounding box. Since the only thing a raw character is good for is being |