Back to index

tetex-bin  3.0
Functions
vf.h File Reference
#include "pdfdev.h"
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void vf_set_verbose (void)
int vf_locate_font (char *tex_name, spt_t ptsize)
void vf_set_char (SIGNED_QUAD ch, int vf_font)
void vf_close_all_fonts (void)

Function Documentation

Definition at line 982 of file vf.c.

{
  unsigned long i;
  int j;
  dev_font *one_font;
#ifdef MEM_DEBUG
MEM_START
#endif
  for (i=0; i<num_vf_fonts; i++) {
    /* Release the packet for each character */
    if (vf_fonts[i].ch_pkt) {
      for (j=0; j<vf_fonts[i].num_chars; j++) {
       if ((vf_fonts[i].ch_pkt)[j] != NULL)
         RELEASE ((vf_fonts[i].ch_pkt)[j]);
      }
      RELEASE (vf_fonts[i].ch_pkt);
    }
    if (vf_fonts[i].pkt_len)
      RELEASE (vf_fonts[i].pkt_len);
    if (vf_fonts[i].tex_name)
      RELEASE (vf_fonts[i].tex_name);
    /* Release each font record */
    for (j=0; j<vf_fonts[i].num_dev_fonts; j++) {
      one_font = &(vf_fonts[i].dev_fonts)[j];
      RELEASE (one_font -> directory);
      RELEASE (one_font -> name);
    }
    if (vf_fonts[i].dev_fonts != NULL)
      RELEASE (vf_fonts[i].dev_fonts);
  }
  if (vf_fonts != NULL)
    RELEASE (vf_fonts);
#ifdef MEM_DEBUG
MEM_END
#endif
  return;
}

Here is the caller graph for this function:

int vf_locate_font ( char *  tex_name,
spt_t  ptsize 
)

Definition at line 270 of file vf.c.

{
  int thisfont = -1, i;
  char *full_vf_file_name;
  FILE *vf_file;
  /* Has this name and ptsize already been loaded as a VF? */
  for (i=0; i<num_vf_fonts; i++) {
    if (!strcmp (vf_fonts[i].tex_name, tex_name) &&
       vf_fonts[i].ptsize == ptsize) 
      break;
  }
  if (i != num_vf_fonts) {
    thisfont = i;
  } else {
    /* It's hasn't already been loaded as a VF, so try to load it */
    full_vf_file_name = kpse_find_file (tex_name, 
                                   kpse_vf_format,
                                   1);
#ifdef HAVE_OMEGA_FORMATS
    if (!full_vf_file_name) {
      full_vf_file_name = kpse_find_file (tex_name, 
                                     kpse_ovf_format,
                                     1);
    }
#endif
    if (full_vf_file_name &&
       (vf_file = MFOPEN (full_vf_file_name, FOPEN_RBIN_MODE)) != NULL) {
      if (verbose == 1)
       fprintf (stderr, "(VF:%s", tex_name);
      if (verbose > 1)
       fprintf (stderr, "(VF:%s", full_vf_file_name);
      if (num_vf_fonts >= max_vf_fonts) {
       resize_vf_fonts (max_vf_fonts + VF_ALLOC_SIZE);
      }
      thisfont = num_vf_fonts++;
      { /* Initialize some pointers and such */
       vf_fonts[thisfont].tex_name = NEW (strlen(tex_name)+1, char);
       strcpy (vf_fonts[thisfont].tex_name, tex_name);
       vf_fonts[thisfont].ptsize = ptsize;
       vf_fonts[thisfont].num_chars = 0;
       vf_fonts[thisfont].ch_pkt = NULL;
       vf_fonts[thisfont].pkt_len = NULL;
      }
      read_header(vf_file, thisfont);
      process_vf_file (vf_file, thisfont);
      if (verbose)
       fprintf (stderr, ")");
      MFCLOSE (vf_file);
    }
  }
  return thisfont;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void vf_set_char ( SIGNED_QUAD  ch,
int  vf_font 
)

Definition at line 791 of file vf.c.

{
  unsigned char opcode;
  unsigned char *start, *end;
  spt_t ptsize;
  int default_font = -1;
  if (vf_font < num_vf_fonts) {
    /* Initialize to the first font or -1 if undefined */
    ptsize = vf_fonts[vf_font].ptsize;
    if (vf_fonts[vf_font].num_dev_fonts > 0)
      default_font = ((vf_fonts[vf_font].dev_fonts)[0]).dev_id;
    dvi_vf_init (default_font);
    if (ch >= vf_fonts[vf_font].num_chars ||
       !(start = (vf_fonts[vf_font].ch_pkt)[ch])) {
      fprintf (stderr, "\nchar=0x%lx(%ld)\n", ch, ch);
      fprintf (stderr, "Tried to set a nonexistent character in a virtual font");
      start = end = NULL;
    } else {
      end = start + (vf_fonts[vf_font].pkt_len)[ch];
    }
    while (start && start < end) {
      opcode = *(start++);
      if (debug) {
       fprintf (stderr, "VF opcode: %d", opcode);
       if (isprint (opcode)) fprintf (stderr, " (\'%c\')\n", opcode);
       else  fprintf (stderr, "\n");
      }
      switch (opcode)
       {
       case SET1:
         vf_set1(&start, end);
         break;
       case SET2:
         vf_set2(&start, end);
         break;
       case SET3:
       case SET4:
         ERROR ("Multibyte (>16 bits) character in VF packet.\nI can't handle this!");
         break;
       case SET_RULE:
         vf_setrule(&start, end, ptsize);
         break;
       case PUT1:
         vf_put1(&start, end);
         break;
       case PUT2:
         vf_put2(&start, end);
         break;
       case PUT3:
       case PUT4:
         ERROR ("Multibyte (>16 bits) character in VF packet.\nI can't handle this!");
         break;
       case PUT_RULE:
         vf_putrule(&start, end, ptsize);
         break;
       case NOP:
         break;
       case PUSH:
         vf_push();
         break;
       case POP:
         vf_pop();
         break;
       case RIGHT1:
         vf_right1(&start, end, ptsize);
         break;
       case RIGHT2:
         vf_right2(&start, end, ptsize);
         break;
       case RIGHT3:
         vf_right3(&start, end, ptsize);
         break;
       case RIGHT4:
         vf_right4(&start, end, ptsize);
         break;
       case W0:
         vf_w0();
         break;
       case W1:
         vf_w1(&start, end, ptsize);
         break;
       case W2:
         vf_w2(&start, end, ptsize);
         break;
       case W3:
         vf_w3(&start, end, ptsize);
         break;
       case W4:
         vf_w4(&start, end, ptsize);
         break;
       case X0:
         vf_x0();
         break;
       case X1:
         vf_x1(&start, end, ptsize);
         break;
       case X2:
         vf_x2(&start, end, ptsize);
         break;
       case X3:
         vf_x3(&start, end, ptsize);
         break;
       case X4:
         vf_x4(&start, end, ptsize);
         break;
       case DOWN1:
         vf_down1(&start, end, ptsize);
         break;
       case DOWN2:
         vf_down2(&start, end, ptsize);
         break;
       case DOWN3:
         vf_down3(&start, end, ptsize);
         break;
       case DOWN4:
         vf_down4(&start, end, ptsize);
         break;
       case Y0:
         vf_y0();
         break;
       case Y1:
         vf_y1(&start, end, ptsize);
         break;
       case Y2:
         vf_y2(&start, end, ptsize);
         break;
       case Y3:
         vf_y3(&start, end, ptsize);
         break;
       case Y4:
         vf_y4(&start, end, ptsize);
         break;
       case Z0:
         vf_z0();
         break;
       case Z1:
         vf_z1(&start, end, ptsize);
         break;
       case Z2:
         vf_z2(&start, end, ptsize);
         break;
       case Z3:
         vf_z3(&start, end, ptsize);
         break;
       case Z4:
         vf_z4(&start, end, ptsize);
         break;
       case FNT1:
         vf_fnt1(&start, end, vf_font);
         break;
       case FNT2:
         vf_fnt2(&start, end, vf_font);
         break;
       case FNT3:
         vf_fnt3(&start, end, vf_font);
         break;
       case FNT4:
         vf_fnt4(&start, end, vf_font);
         break;
       case XXX1:
         vf_xxx1(&start, end);
         break;
       case XXX2:
         vf_xxx2(&start, end);
         break;
       case XXX3:
         vf_xxx3(&start, end);
         break;
       case XXX4:
         vf_xxx4(&start, end);
         break;
       default:
         if (opcode <= SET_CHAR_127) {
           vf_set (opcode);
         } else if (opcode >= FNT_NUM_0 && opcode <= FNT_NUM_63) {
           vf_fnt (opcode - FNT_NUM_0, vf_font);
         } else {
           fprintf (stderr, "Unexpected opcode: %d\n", opcode);
           ERROR ("Unexpected opcode in vf file\n");
         }
       }
    }
    dvi_vf_finish();
  } else {
    fprintf (stderr, "vf_set_char: font: %d", vf_font);
    ERROR ("Font not loaded\n");
  }
  return;
}

Here is the caller graph for this function:

Definition at line 48 of file vf.c.

{
  if (verbose < 255) {
    verbose += 1;
  }
}

Here is the caller graph for this function: