Back to index

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

Go to the source code of this file.

Functions

void type1_set_verbose (void)
pdf_objtype1_font_resource (int type1_id)
char * type1_font_used (int type1_id)
void type1_disable_partial (void)
int type1_font (const char *tex_name, int tfm_font_id, char *resource_name, int encoding_id, int remap)
void type1_set_mapfile (const char *name)
void type1_close_all (void)

Function Documentation

Definition at line 1325 of file type1.c.

{
  int i, j;
  /* Three arrays are created by this module and need to be released */
  /* First, each TeX font name that ends up as a postscript font gets
     added to type1_fonts (yes, even Times-Roman, etc.) */
  /* The first thing to do is to resolve all character references to 
     actual glyph references.  If an external encoding is specified,
     we simply look up the glyph name in the encoding.  If the internal
     encoding is being used, we add it to the used_chars array of
     the internal encoding */
  for (i=0; i<num_type1_fonts; i++) {
    /* If font subsetting is enabled, each used character needs
       to be added to the used_glyphs array in the corresponding pfb
    */
    if (partial_enabled) {
      /* We always consider .notdef to be used */
      pfb_add_to_used_glyphs (type1_fonts[i].pfb_id, ".notdef");
      for (j=0; j<256; j++) {
       char *glyph;
       if (type1_fonts[i].pfb_id >= 0 &&
           type1_fonts[i].encoding_id >= 0 &&
           (type1_fonts[i].used_chars)[j]) {
         glyph = encoding_glyph (type1_fonts[i].encoding_id,
                                   j);
         pfb_add_to_used_glyphs (type1_fonts[i].pfb_id, glyph);
       }
       if (type1_fonts[i].pfb_id >= 0 &&
           type1_fonts[i].encoding_id < 0 &&
           (type1_fonts[i].used_chars)[j])
         pfb_add_to_used_chars (type1_fonts[i].pfb_id, j);
      }
    }
    if (type1_fonts[i].used_chars)
      RELEASE (type1_fonts[i].used_chars);
    pdf_release_obj (type1_fonts[i].indirect);
  }
  RELEASE (type1_fonts);
  /* Second every distinct pfb name ends up in pfbs.  It is possible
     that two distinct tex names map to the same pfb name.  That's why
     there is a separate array for pfbs */

  /* Read any necessary font files and flush them */
  pfb_flush_all();

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 79 of file type1.c.

{
  partial_enabled = 0;
}

Here is the caller graph for this function:

int type1_font ( const char *  tex_name,
int  tfm_font_id,
char *  resource_name,
int  encoding_id,
int  remap 
)

Definition at line 1213 of file type1.c.

{
  int i, result = -1;
  int tfm_firstchar, tfm_lastchar;
  int pdf_firstchar, pdf_lastchar;
  int pfb_id = -1;
  pdf_obj *font_resource, *tmp1, *font_encoding_ref;

  if (num_type1_fonts >= max_type1_fonts) {
    max_type1_fonts = MAX (max_type1_fonts+MAX_FONTS, num_type1_fonts+1);
    type1_fonts = RENEW (type1_fonts, max_type1_fonts, struct
                      a_type1_font);
  }

  if ((map_name && is_a_base_font(map_name)) ||
      (pfb_id = pfb_get_id(map_name)) >= 0) {
    /* Looks like we have a physical font (either a reader font or a
       Type 1 font binary file).  */
    init_a_type1_font (type1_fonts+num_type1_fonts);
    type1_fonts[num_type1_fonts].pfb_id = pfb_id;
    type1_fonts[num_type1_fonts].encoding_id = encoding_id;
  /* Allocate a dictionary for the physical font */
    font_resource = pdf_new_dict ();
    if (type1_fonts[num_type1_fonts].encoding_id >= 0) {
      font_encoding_ref = encoding_ref (encoding_id);
      pdf_add_dict (font_resource,
                  pdf_new_name ("Encoding"),
                  font_encoding_ref);
    }
    pdf_add_dict (font_resource,
                pdf_new_name ("Type"),
                pdf_new_name ("Font"));
    pdf_add_dict (font_resource,
                pdf_new_name ("Subtype"),
                pdf_new_name ("Type1"));
    pdf_add_dict (font_resource, 
                pdf_new_name ("Name"),
                pdf_new_name (resource_name));
    if (type1_fonts[num_type1_fonts].pfb_id >= 0) {
      pdf_add_dict (font_resource, 
                  pdf_new_name ("FontDescriptor"),
                  pdf_ref_obj(pfbs[type1_fonts[num_type1_fonts].pfb_id].descriptor));
    }
      /* If we are embedding this font, it may have been used by another virtual
        font and we need to use the same mangled name.  Mangled
        names are known only to the pfb module, so we call it to get
        the name */
    if (type1_fonts[num_type1_fonts].pfb_id >= 0) {
      pdf_add_dict (font_resource, 
                  pdf_new_name ("BaseFont"),
                  pdf_new_name
                  (type1_fontname(type1_fonts[num_type1_fonts].pfb_id)));
       /* Otherwise we use the base name */
    } else {
      pdf_add_dict (font_resource,
                  pdf_new_name ("BaseFont"),
                  pdf_new_name (map_name));
    }
    if (!(map_name && is_a_base_font (map_name))) {
      tfm_firstchar = tfm_get_firstchar(tfm_font_id);
      tfm_lastchar = tfm_get_lastchar(tfm_font_id);
      if (remap) {
       unsigned char t;
       pdf_firstchar=255; pdf_lastchar=0;
       for (i=tfm_firstchar; i<=tfm_lastchar; i++) {
         if ((t=twiddle(i)) < pdf_firstchar)
           pdf_firstchar = t;
         if (t > pdf_lastchar)
           pdf_lastchar = t;
       }
      } else {
       pdf_firstchar = tfm_firstchar;
       pdf_lastchar = tfm_lastchar;
      }
      pdf_add_dict (font_resource,
                  pdf_new_name ("FirstChar"),
                  pdf_new_number (pdf_firstchar));
      pdf_add_dict (font_resource,
                  pdf_new_name ("LastChar"),
                  pdf_new_number (pdf_lastchar));
      tmp1 = pdf_new_array ();
      for (i=pdf_firstchar; i<=pdf_lastchar; i++) {
       if (remap) {
         int t;
         if ((t=untwiddle(i)) <= tfm_lastchar && t>=tfm_firstchar)
           pdf_add_array (tmp1,
                        pdf_new_number(ROUND(tfm_get_width
                                          (tfm_font_id,t)*1000.0,0.1)));
         else
           pdf_add_array (tmp1,
                        pdf_new_number(0.0));
       } else
         pdf_add_array (tmp1,
                      pdf_new_number(ROUND(tfm_get_width
                                         (tfm_font_id, i)*1000.0,0.1)));
      }
      pdf_add_dict (font_resource,
                  pdf_new_name ("Widths"),
                  tmp1);
    }
    type1_fonts[num_type1_fonts].indirect = pdf_ref_obj(font_resource);
    pdf_release_obj (font_resource);
    result = num_type1_fonts;
    num_type1_fonts += 1;
  } else { /* Don't have a physical font */
    result = -1;
  }
  return result;

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1173 of file type1.c.

{
  if (type1_id>=0 && type1_id<max_type1_fonts)
    return pdf_link_obj(type1_fonts[type1_id].indirect);
  else {
    ERROR ("Invalid font id in type1_font_resource");
    return NULL;
  }

Here is the call graph for this function:

Here is the caller graph for this function:

char* type1_font_used ( int  type1_id)

Definition at line 1183 of file type1.c.

{
  char *result;
  if (type1_id>=0 && type1_id<max_type1_fonts) {
    result = type1_fonts[type1_id].used_chars;
  } else {
    fprintf (stderr, "type1_font_used: type1_id=%d\n", type1_id);
    ERROR ("Invalid font id in type1_font_used");
  }
  return result;

Here is the call graph for this function:

Here is the caller graph for this function:

void type1_set_mapfile ( const char *  name)

Definition at line 49 of file type1.c.

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

Here is the caller graph for this function: