Back to index

Classes | Functions
load_tfm.hpp File Reference
#include "file.hpp"
#include "tex_files.hpp"
#include "resource.hpp"
#include "bitmap_font.hpp"
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.


struct  tex_font_metric_rep


 RESOURCE (tex_font_metric)
tex_font_metric load_tfm (url file_name, string family, int size)

Function Documentation

tex_font_metric load_tfm ( url  file_name,
string  family,
int  size 

Definition at line 373 of file load_tfm.cpp.

  tex_font_metric tfm=
    tm_new<tex_font_metric_rep> (family * as_string (size) * ".tfm");

  int i= 0;
  string s;
  (void) load_string (file_name, s, true);
  bench_start ("decode tfm");

  parse (s, i, tfm->lf);
  parse (s, i, tfm->lh);
  parse (s, i, tfm->bc);
  parse (s, i, tfm->ec);
  parse (s, i, tfm->nw);
  parse (s, i, tfm->nh);
  parse (s, i, tfm->nd);
  parse (s, i, tfm->ni);
  parse (s, i, tfm->nl);
  parse (s, i, tfm->nk);
  parse (s, i, tfm->ne);
  parse (s, i, tfm->np);

  if ((tfm->lf-6) !=
      (tfm->lh + (tfm->ec + 1 - tfm->bc) +
       tfm->nw + tfm->nh + tfm->nd + tfm->ni +
       tfm->nl + tfm->nk + tfm->ne + tfm->np))
    FAILED ("invalid tfm file");
  parse (s, i, tfm->header, tfm->lh);
  parse (s, i, tfm->char_info, tfm->ec+1- tfm->bc);
  parse (s, i, tfm->width, tfm->nw);
  parse (s, i, tfm->height, tfm->nh);
  parse (s, i, tfm->depth, tfm->nd);
  parse (s, i, tfm->italic, tfm->ni);
  parse (s, i, tfm->lig_kern, tfm->nl);
  parse (s, i, tfm->kern, tfm->nk);
  parse (s, i, tfm->exten, tfm->ne);
  parse (s, i, tfm->param, tfm->np);
  tfm->left= tfm->right= tfm->left_prog= tfm->right_prog= -1;
  if (tfm->nl > 0) {
    int l= tfm->lig_kern [0];
    int r= tfm->lig_kern [tfm->nl- 1];
    if (byte0 (l) == 255) tfm->right= byte1 (l);
    if (byte0 (r) == 255) tfm->left_prog= word1 (r);

  tfm->size= (tfm->header[1] + (1<<19)) >> 20;

  bench_cumul ("decode tfm");
  return tfm;

Here is the call graph for this function:

Here is the caller graph for this function:

RESOURCE ( tex_font_metric  )