Back to index

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

Go to the source code of this file.

Functions

void tfm_set_verbose (void)
void tfm_set_debug (void)
int tfm_open (const char *tex_font_name)
void tfm_close_all (void)
double tfm_get_width (int font_id, UNSIGNED_QUAD ch)
double tfm_get_height (int font_id, UNSIGNED_QUAD ch)
double tfm_get_depth (int font_id, UNSIGNED_QUAD ch)
fixword tfm_get_fw_width (int font_id, UNSIGNED_QUAD ch)
fixword tfm_get_fw_height (int font_id, UNSIGNED_QUAD ch)
fixword tfm_get_fw_depth (int font_id, UNSIGNED_QUAD ch)
fixword tfm_string_width (int font_id, unsigned char *s, unsigned len)
fixword tfm_string_depth (int font_id, unsigned char *s, unsigned len)
fixword tfm_string_height (int font_id, unsigned char *s, unsigned len)
double tfm_get_space (int font_id)
double tfm_get_it_slant (int font_id)
double tfm_get_x_height (int font_id)
UNSIGNED_PAIR tfm_get_firstchar (int font_id)
UNSIGNED_PAIR tfm_get_lastchar (int font_id)
double tfm_get_design_size (int font_id)
double tfm_get_max_height (int font_id)
double tfm_get_max_width (int font_id)
int tfm_is_fixed_width (int font_id)
double tfm_get_max_depth (int font_id)

Function Documentation

Definition at line 549 of file tfm.c.

{
  int i;
  for (i=0; i<numtfms; i++) {
    if (tfm[i].header)
      RELEASE (tfm[i].header);
    if (tfm[i].char_info)
      RELEASE (tfm[i].char_info);
    if (tfm[i].width)
      RELEASE (tfm[i].width);
    if (tfm[i].height)
      RELEASE (tfm[i].height);
    if (tfm[i].depth)
      RELEASE (tfm[i].depth);
    RELEASE (tfm[i].tex_name);
    RELEASE (tfm[i].unpacked_widths);
    RELEASE (tfm[i].unpacked_heights);
    RELEASE (tfm[i].unpacked_depths);
    if (tfm[i].width_index)
      RELEASE (tfm[i].width_index);
    if (tfm[i].height_index)
      RELEASE (tfm[i].height_index);
    if (tfm[i].depth_index)
      RELEASE (tfm[i].depth_index);
  }
  if (tfm)
    RELEASE (tfm);
}

Here is the call graph for this function:

Here is the caller graph for this function:

double tfm_get_depth ( int  font_id,
UNSIGNED_QUAD  ch 
)

Definition at line 594 of file tfm.c.

{
  if (tfm[font_id].unpacked_depths && ch <= tfm[font_id].ec)
    return (tfm[font_id].unpacked_depths)[ch]/FWBASE;
  else return 0.0;
}
double tfm_get_design_size ( int  font_id)

Definition at line 669 of file tfm.c.

{
  return ((tfm[font_id].header))[1]/FWBASE*(72.0/72.27);
}

Here is the caller graph for this function:

Definition at line 659 of file tfm.c.

{
  return tfm[font_id].bc;
}

Here is the caller graph for this function:

fixword tfm_get_fw_depth ( int  font_id,
UNSIGNED_QUAD  ch 
)

Definition at line 616 of file tfm.c.

{
  if (tfm[font_id].unpacked_depths && ch <= tfm[font_id].ec)
    return (tfm[font_id].unpacked_depths)[ch];
  return 0;
}

Here is the caller graph for this function:

fixword tfm_get_fw_height ( int  font_id,
UNSIGNED_QUAD  ch 
)

Definition at line 609 of file tfm.c.

{
  if (tfm[font_id].unpacked_heights && ch <= tfm[font_id].ec)
    return (tfm[font_id].unpacked_heights)[ch];
  return 0;
}

Here is the caller graph for this function:

fixword tfm_get_fw_width ( int  font_id,
UNSIGNED_QUAD  ch 
)

Definition at line 601 of file tfm.c.

{
  if (tfm[font_id].unpacked_widths && ch <= tfm[font_id].ec) {
    return (tfm[font_id].unpacked_widths)[ch];
  }
  return 0;
}

Here is the caller graph for this function:

double tfm_get_height ( int  font_id,
UNSIGNED_QUAD  ch 
)

Definition at line 587 of file tfm.c.

{
  if (tfm[font_id].unpacked_heights && ch <= tfm[font_id].ec)
    return (double) (tfm[font_id].unpacked_heights)[ch] / FWBASE;
  else return 0.0;
}
double tfm_get_it_slant ( int  font_id)

Definition at line 664 of file tfm.c.

{
  return tfm[font_id].ec;
}

Here is the caller graph for this function:

double tfm_get_max_depth ( int  font_id)

Definition at line 705 of file tfm.c.

{
  SIGNED_QUAD max = 0;
  int i;
  for (i=0; i<tfm[font_id].ndepths; i++) {
    if ((tfm[font_id].depth)[i] > max)
      max = (tfm[font_id].depth)[i];
  }
  return (max/FWBASE);
}

Here is the caller graph for this function:

double tfm_get_max_height ( int  font_id)

Definition at line 694 of file tfm.c.

{
  SIGNED_QUAD max = 0;
  int i;
  for (i=0; i<tfm[font_id].nheights; i++) {
    if ((tfm[font_id].height)[i] > max)
      max = (tfm[font_id].height)[i];
  }
  return (max/FWBASE);
}

Here is the caller graph for this function:

double tfm_get_max_width ( int  font_id)

Definition at line 675 of file tfm.c.

{
  SIGNED_QUAD max = 0;
  int i;
  for (i=0; i<tfm[font_id].nwidths; i++) {
    if ((tfm[font_id].width)[i] > max)
      max = (tfm[font_id].width)[i];
  }
  return (max/FWBASE);
}

Here is the caller graph for this function:

double tfm_get_space ( int  font_id)
double tfm_get_width ( int  font_id,
UNSIGNED_QUAD  ch 
)

Definition at line 580 of file tfm.c.

{
  if (tfm[font_id].unpacked_widths && ch <= tfm[font_id].ec)
    return (double) (tfm[font_id].unpacked_widths)[ch] / FWBASE;
  else return 0.0;
}

Here is the caller graph for this function:

double tfm_get_x_height ( int  font_id)
int tfm_is_fixed_width ( int  font_id)

Definition at line 686 of file tfm.c.

{
  /* We always have two widths since width[0] = 0.
     A fixed width font will have width[1] = something
     and not have any other widths */
  return (tfm[font_id].nwidths == 2);
}
int tfm_open ( const char *  tex_font_name)

Definition at line 488 of file tfm.c.

{
  FILE *tfm_file;
  int i;
  UNSIGNED_QUAD tfm_file_size;
  char *full_tfm_file_name;
  for (i=0; i<numtfms; i++) {
    if (!strcmp (tfm_name, tfm[i].tex_name))
      break;
  }
  if (i == numtfms) { /* Name hasn't already been loaded */
    if ((full_tfm_file_name = kpse_find_tfm (tfm_name))) {
      tfms_need (numtfms+1);
      a_tfm_init (tfm+numtfms);
      if (!(tfm_file = MFOPEN (full_tfm_file_name, FOPEN_RBIN_MODE))) {
       fprintf (stderr, "\n%s: ", tfm_name);
       ERROR ("Specified TFM file cannot be opened");
      }
      if (tfm_verbose == 1)
       fprintf (stderr, "(TFM:%s", tfm_name);
      if (tfm_verbose > 1)
       fprintf (stderr, "(TFM:%s", full_tfm_file_name);
      if ((tfm_file_size = file_size(tfm_file)) < 24) {
       ERROR ("TFM file too small to be a valid file\n");
      }
      get_tfm (tfm_file, tfm_file_size, &tfm[numtfms]);
#ifdef HAVE_OMEGA_FORMATS       
    } else if ((full_tfm_file_name = kpse_find_ofm (tfm_name))) {
      tfms_need (numtfms+1);
      a_tfm_init (tfm+numtfms);
      if (!(tfm_file = MFOPEN (full_tfm_file_name, FOPEN_RBIN_MODE))) {
       fprintf (stderr, "\n%s:  ", tfm_name);
       ERROR ("OFM file cannot be opened");
      }
      if (tfm_verbose == 1)
       fprintf (stderr, "(OFM:%s", tfm_name);
      if (tfm_verbose > 1)
       fprintf (stderr, "(OFM:%s", full_tfm_file_name);
      if ((tfm_file_size = file_size(tfm_file)) < 24) {
       ERROR ("OFM file too small to be a valid file\n");
      }
      get_ofm (tfm_file, tfm_file_size, &tfm[numtfms]);
#endif       
    } else {
      fprintf (stderr, "\n%s:  ", tfm_name);
      ERROR ("Unable to find a TFM or OFM file");
    }
    tfm[numtfms].tex_name = NEW (strlen(tfm_name)+1, char);
    strcpy (tfm[numtfms].tex_name, tfm_name);
    MFCLOSE (tfm_file);
    if (tfm_verbose) 
      fprintf (stderr, ")");
    if (tfm_verbose>3) {
      dump_sizes (&tfm[numtfms]);
    }
    return numtfms++;
  } else { /* Name has been loaded before */
    return i;
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 101 of file tfm.c.

{
  tfm_verbose = 1;
  tfm_debug = 1;
}

Definition at line 96 of file tfm.c.

{
  tfm_verbose += 1;
}

Here is the caller graph for this function:

fixword tfm_string_depth ( int  font_id,
unsigned char *  s,
unsigned  len 
)

Definition at line 635 of file tfm.c.

{
  fixword result = 0;
  unsigned i;
  if (tfm[font_id].unpacked_depths) 
    for (i=0; i<len; i++) {
      if (s[i] <= tfm[font_id].ec)
       result = MAX(result, tfm[font_id].unpacked_depths[s[i]]);
    }
  return result;
}

Here is the caller graph for this function:

fixword tfm_string_height ( int  font_id,
unsigned char *  s,
unsigned  len 
)

Definition at line 647 of file tfm.c.

{
  fixword result = 0;
  unsigned i;
  if (tfm[font_id].unpacked_heights) 
    for (i=0; i<len; i++) {
      if (s[i] <= tfm[font_id].ec)
       result = MAX(result, tfm[font_id].unpacked_heights[s[i]-tfm[font_id].bc]);
    }
  return result;
}

Here is the caller graph for this function:

fixword tfm_string_width ( int  font_id,
unsigned char *  s,
unsigned  len 
)

Definition at line 623 of file tfm.c.

{
  fixword result = 0;
  unsigned i;
  if (tfm[font_id].unpacked_widths) 
    for (i=0; i<len; i++) {
      if (s[i] <= tfm[font_id].ec)
       result += tfm[font_id].unpacked_widths[s[i]];
    }
  return result;
}

Here is the caller graph for this function: