Back to index

tetex-bin  3.0
Functions
pkfont.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 pk_set_verbose (void)
int pk_font (const char *tex_name, double ptsize, int tfm_id, char *res_name)
pdf_objpk_font_resource (int pk_id)
char * pk_font_used (int pk_id)
void pk_close_all (void)
void pk_set_dpi (int dpi)

Function Documentation

Definition at line 604 of file pkfont.c.

{
  int i;
  if (pk_encoding_ref)
    pdf_release_obj (pk_encoding_ref);
  for (i=0; i<num_pk_fonts; i++) {
    embed_pk_font (i);
    pdf_release_obj (pk_fonts[i].direct);
    pdf_release_obj (pk_fonts[i].indirect);
    RELEASE (pk_fonts[i].tex_name);
    RELEASE (pk_fonts[i].pk_file_name);
    RELEASE (pk_fonts[i].used_chars);
  }
  if (pk_fonts)
    RELEASE (pk_fonts);
}

Here is the call graph for this function:

Here is the caller graph for this function:

int pk_font ( const char *  tex_name,
double  ptsize,
int  tfm_id,
char *  res_name 
)

Definition at line 107 of file pkfont.c.

{
  int i, j;
  int firstchar, lastchar;
  pdf_obj *tmp1;
  for (i=0; i<num_pk_fonts; i++) {
    if (!strcmp (tex_name, pk_fonts[i].tex_name) &&
       (ptsize == pk_fonts[i].ptsize))
      break;
  }
  if (i == num_pk_fonts) {
    char *pk_file_name;
    kpse_glyph_file_type kpse_file_info;
    if ((pk_file_name = kpse_find_glyph(tex_name,
                                   font_dpi*ptsize/tfm_get_design_size(tfm_font_id)+0.5,
                                   kpse_pk_format,
                                   &kpse_file_info))) {
      /* Make sure there is enough room in pk_fonts for this entry */
      if (num_pk_fonts >= max_pk_fonts) {
       max_pk_fonts += MAX_FONTS;
       pk_fonts = RENEW (pk_fonts, max_pk_fonts, struct a_pk_font);
      }
      init_pk_record (pk_fonts+i);
      pk_fonts[i].pk_file_name = NEW (strlen(pk_file_name)+1, char);
      strcpy (pk_fonts[i].pk_file_name, pk_file_name);
      pk_fonts[i].tex_name = NEW (strlen (tex_name)+1, char);
      strcpy (pk_fonts[i].tex_name, tex_name);
      pk_fonts[i].ptsize = ptsize;
      pk_fonts[i].direct = pdf_new_dict ();
      pdf_add_dict (pk_fonts[i].direct,
                  pdf_new_name ("Type"),
                  pdf_new_name ("Font"));
      pdf_add_dict (pk_fonts[i].direct,
                  pdf_new_name ("Name"),
                  pdf_new_name (res_name));
      pdf_add_dict (pk_fonts[i].direct,
                  pdf_new_name ("Subtype"),
                  pdf_new_name ("Type3"));
      firstchar = tfm_get_firstchar(tfm_font_id);
      pdf_add_dict (pk_fonts[i].direct,
                  pdf_new_name ("FirstChar"),
                  pdf_new_number (firstchar));
      lastchar = tfm_get_lastchar(tfm_font_id);
      pdf_add_dict (pk_fonts[i].direct,
                  pdf_new_name ("LastChar"),
                  pdf_new_number (lastchar));
      tmp1 = pdf_new_array ();
      for (j=firstchar; j<=lastchar; j++) {
       pdf_add_array (tmp1,
                     pdf_new_number(ROUND(tfm_get_width (tfm_font_id, j)*1000.0,0.01)));
      }
      pdf_add_dict (pk_fonts[i].direct,
                  pdf_new_name ("Widths"),
                  tmp1);
      {
       double max_height, max_depth, max_width;
       max_height = tfm_get_max_height (tfm_font_id)*1000.0;
       max_depth = tfm_get_max_depth (tfm_font_id)*1000.0;
       max_width = tfm_get_max_width (tfm_font_id)*1000.0;
       max_height = ROUND(max_height, 1.0);
       max_depth = ROUND(max_depth, 1.0);
       max_width = ROUND(max_width, 1.0);
       tmp1 = pdf_new_array();
       pdf_add_array (tmp1, pdf_new_number(-0.10*max_width));
       pdf_add_array (tmp1,
                     pdf_new_number(-max_depth-0.20*(max_height+max_depth)));
       pdf_add_array (tmp1, pdf_new_number(1.10*max_width));
       pdf_add_array (tmp1, pdf_new_number(max_height+0.10*(max_height+max_depth)));
       pdf_add_dict (pk_fonts[i].direct, 
                    pdf_new_name ("FontBBox"), tmp1);
      }
      {
       tmp1 = pdf_new_array();
       pdf_add_array (tmp1, pdf_new_number (0.001));
       pdf_add_array (tmp1, pdf_new_number (0.0));
       pdf_add_array (tmp1, pdf_new_number (0.0));
       pdf_add_array (tmp1, pdf_new_number (0.001));
       pdf_add_array (tmp1, pdf_new_number (0.0));
       pdf_add_array (tmp1, pdf_new_number (0.0));
       pdf_add_dict (pk_fonts[i].direct, pdf_new_name ("FontMatrix"),
                    tmp1);
      }
      if (pk_encoding_ref == NULL) {
       make_pk_encoding_ref();
      }
      pdf_add_dict (pk_fonts[i].direct,
                  pdf_new_name ("Encoding"),
                  pdf_link_obj (pk_encoding_ref));
      pk_fonts[i].indirect = pdf_ref_obj (pk_fonts[i].direct);
      num_pk_fonts += 1;
    } else { /* Found no glyph file */
      i = -1;
    }
  }
  return i;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 205 of file pkfont.c.

{
  if (pk_id <0 || pk_id >= num_pk_fonts) {
    fprintf (stderr, "pk_id = %d\n", pk_id);
    ERROR ("pk_font_resource:  Invalid pk_id\n");
  }
  return pdf_link_obj (pk_fonts[pk_id].indirect);
}

Here is the call graph for this function:

Here is the caller graph for this function:

char* pk_font_used ( int  pk_id)

Definition at line 214 of file pkfont.c.

{
  if (pk_id < 0 || pk_id >= num_pk_fonts) {
    fprintf (stderr, "pk_id = %d\n", pk_id);
    ERROR ("pk_font_used:  Invalid pk_id\n");
  }
  return pk_fonts[pk_id].used_chars;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void pk_set_dpi ( int  dpi)

Definition at line 48 of file pkfont.c.

{
  font_dpi = dpi;
}

Here is the caller graph for this function:

Definition at line 41 of file pkfont.c.

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

Here is the caller graph for this function: