Back to index

tetex-bin  3.0
Defines | Typedefs | Functions
pkout.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Defines

#define BLACK   1
#define WHITE   0
#define OTHER(pixel)   (pixel==BLACK? WHITE: BLACK)

Typedefs

typedef int INT32

Functions

void pk_open (char *name)
void pk_close ()
void pk_preamble (char *comment, float pointsize, INT32 checksum, unsigned int h_res, unsigned int v_res)
void pk_char (int char_code, INT32 tfm_width, int h_escapement, unsigned int width, unsigned int height, int h_offset, int v_offset, int(*next_pixel)())
void pk_postamble ()
void ps2pk_postamble (char *fontname, char *encname, int base_res, int h_res, int v_res, float pointsize, char *args)

Define Documentation

#define BLACK   1

Definition at line 56 of file pkout.h.

#define OTHER (   pixel)    (pixel==BLACK? WHITE: BLACK)

Definition at line 58 of file pkout.h.

#define WHITE   0

Definition at line 57 of file pkout.h.


Typedef Documentation

typedef int INT32

Definition at line 17 of file pkout.h.


Function Documentation

void pk_char ( int  char_code,
INT32  tfm_width,
int  h_escapement,
unsigned int  width,
unsigned int  height,
int  h_offset,
int  v_offset,
int(*)()  next_pixel 
)

Definition at line 408 of file pkout.c.

{  int i, pl, current_value;
   short two_byte;   /* two_byte quantities? */
   unsigned short flag_byte;

   pk_runlengths(width, height, next_pixel);

   /* write a character preamble */

   flag_byte = dyn_f * 16;
   if (count[0] > 0) flag_byte += 8; /* starting in BLACK */
   if (tfm_width > 0XFFFFFF || width > 65535 || height > 65535
       || h_offset > 32767 || v_offset > 32767
       || h_offset < -32768 || v_offset < -32768
       || comp_size > 196594) 
   { /* write long format */
      fatal("Can't handle long format yet!\n");
   }
   else if (h_escapement > 255 || width > 255 || height > 255
            || h_offset > 127 || v_offset > 127
            || h_offset < -128 || v_offset < -128 
            || comp_size > 1015)
   { /* write two-byte short character preamble */
      comp_size += 13; flag_byte += comp_size / 65535 + 4; 
      pk1(flag_byte);
      pk2(comp_size % 65535);
      pk1(char_code);
      pk3(tfm_width);
      pk2(h_escapement); /* pixels ! */
      pk2(width);
      pk2(height);
      pk2(h_offset);
      pk2(v_offset);
   }
   else { /* write one-byte short character preamble */
      comp_size += 8;  flag_byte += comp_size / 256; 
      pk1(flag_byte);
      pk1(comp_size % 256);
      pk1(char_code);
      pk3(tfm_width);
      pk1(h_escapement); /* pixels ! */
      pk1(width);
      pk1(height);
      pk1(h_offset);
      pk1(v_offset);
   }

   /* and now the character itself */
   if (dyn_f != 14) { /* send compressed format */ 
      if (count[0] == 0) i = 1; else i = 0;
      bitweight = 16;
      for (i=i; i<cnt; i++) pk_number(count[i]);
      if (bitweight != 16) pk1(pk_output_byte);
   }
   else /* send bitmap */
      if (height > 0) pk_bitmap(width, cnt, count);

}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 45 of file pkout.c.

{
   fclose(pkfile);
}
void pk_open ( char *  name)

Definition at line 39 of file pkout.c.

{
   pkfile = fopen(pkname, WB);
   if (pkfile == NULL) fatal("Can not open %s\n", pkname);
}

Definition at line 543 of file pkout.c.

{      
   pk1(PK_POST);
   while (pk_len % 4 != 0) pk1(PK_NOOP);
}
void pk_preamble ( char *  comment,
float  pointsize,
INT32  checksum,
unsigned int  h_res,
unsigned int  v_res 
)

Definition at line 101 of file pkout.c.

{ 
   int i, len;

   /* compute MAX_COUNTS based upon pointsize, h_res and v_res */
   MAX_COUNTS = pointsize / DPI * h_res * (pointsize / DPI * v_res + 1);
   
   pk1(PK_PRE);
   pk1(PK_ID);
   len = strlen(comment);
   len = len>255? 255: len;
   pk1(len);
   for (i=0; i<len; i++) pk1(*comment++);

   pk4(pointsize * (1<<20) + 0.5);
   pk4(checksum);
   pk4(h_res / DPI * (1<<16)); pk4(v_res / DPI * (1<<16));
}
void ps2pk_postamble ( char *  fontname,
char *  encname,
int  base_res,
int  h_res,
int  v_res,
float  pointsize,
char *  args 
)

Definition at line 553 of file pkout.c.

{      
   int i;

   pkstring("ps2pk options: %s", args);
   pkstring("fontid=%s", fontname);
   if (encname) pkstring("codingscheme=%s", encname);
   pkstring("fontfacebyte"); 
   pk1(PK_NUMSPC);
   i = (pointsize < 127.0) ?
     ((254 - (int)((2 * pointsize)+0.5)) * (1 << 16)) : 0;
   pk4(i);
   pkstring("pixels_per_inch=%d", base_res);
   pkstring("mag=%s", magnification(h_res, base_res));
   if (v_res != h_res)
      pkstring("aspect ratio=%d / %d", 
         (int)((1.0 * v_res / h_res * base_res) + 0.5), base_res);

   pk1(PK_POST);
   while (pk_len % 4 != 0) pk1(PK_NOOP);
}