Back to index

texmacs  1.0.7.15
Public Member Functions | Public Attributes
tex_font_metric_rep Struct Reference

#include <load_tfm.hpp>

Inheritance diagram for tex_font_metric_rep:
Inheritance graph
[legend]
Collaboration diagram for tex_font_metric_rep:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 tex_font_metric_rep (string name)
 ~tex_font_metric_rep ()
SI w (QN c)
SI h (QN c)
SI d (QN c)
SI i (QN c)
SI tag (QN c)
SI rem (QN c)
int list_len (QN c)
QN nth_in_list (QN c, int n)
QN top (QN c)
QN mid (QN c)
QN bot (QN c)
QN rep (QN c)
SI design_size ()
double slope ()
SI spc ()
SI spc_stretch ()
SI spc_shrink ()
SI x_height ()
SI spc_quad ()
SI spc_extra ()
SI parameter (int i)
void execute (SI *s, int n, SI *buf, SI *ker, int &m)
void get_xpositions (int *s, int n, double unit, SI *xpos)

Public Attributes

HN lf
HN lh
HN bc
HN ec
HN nw
HN nh
HN nd
HN ni
HN nl
HN nk
HN ne
HN np
SIheader
SIchar_info
SIwidth
SIheight
SIdepth
SIitalic
SIlig_kern
SIkern
SIexten
SIparam
SI left
SI right
SI left_prog
SI right_prog
int size
string res_name

Detailed Description

Definition at line 21 of file load_tfm.hpp.


Constructor & Destructor Documentation

Definition at line 25 of file load_tfm.cpp.

                                                    :
  rep_tex_font_metric (name)
{
  header   = NULL;
  char_info= NULL;
  width    = NULL;
  height   = NULL;
  depth    = NULL;
  italic   = NULL;
  lig_kern = NULL;
  kern     = NULL;
  exten    = NULL;
  param    = NULL;
}

Definition at line 40 of file load_tfm.cpp.

                                           {
  if (header != NULL) tm_delete_array (header);
  if (char_info != NULL) tm_delete_array (char_info);
  if (width != NULL) tm_delete_array (width);
  if (height != NULL) tm_delete_array (height);
  if (depth != NULL) tm_delete_array (depth);
  if (italic != NULL) tm_delete_array (italic);
  if (lig_kern != NULL) tm_delete_array (lig_kern);
  if (kern != NULL) tm_delete_array (kern);
  if (exten != NULL) tm_delete_array (exten);
  if (param != NULL) tm_delete_array (param);
}

Here is the call graph for this function:


Member Function Documentation

Definition at line 85 of file load_tfm.cpp.

{ return (QN) byte2 (exten [rem (c)]); }

Here is the call graph for this function:

Definition at line 75 of file load_tfm.cpp.

                                {
  if ((c<bc) || (c>ec)) return 0;
  return depth [byte1b (char_info[c-bc])]; }

Definition at line 87 of file load_tfm.cpp.

{ return header[1]; }
void tex_font_metric_rep::execute ( SI s,
int  n,
SI buf,
SI ker,
int &  m 
)

Definition at line 127 of file load_tfm.cpp.

                                                                       {
  STACK_NEW_ARRAY (stack, int, m);
  int bp, sp=0, i;

  for (i=0; i<n; i++) stack[sp++]= s[n-1-i];
  sp--; bp= 0;

  while (sp>=0) {
    int cur_char= stack [sp]& 255;
    // cout << "Processing " << (char) cur_char << "\n";

    /***************** the ligature-kerning program ******************/
    if ((cur_char<bc) || (cur_char>ec)) sp--;
    else if ((tag (cur_char)==1) && (sp>0)) {
      register int next_char= stack [sp-1]& 255;
      register int pc= rem (cur_char);
      if (byte0 (lig_kern [pc]) > 128) pc= word1 (lig_kern [pc]);

      while (true) {
       register int instr= lig_kern [pc];

       //if (byte0 (instr) >= 128) { // halt
       //  // cout << "  Halt\n";
       //  ker [bp]  = 0;
       //  buf [bp++]= stack[sp--];
       //  break;
       //}

       if (byte1 (instr) != next_char) { // continue
         // cout << "  " << (char) byte1 (instr) << " != " << (char) next_char
         //      << " => pc := pc + " << (byte0 (instr)+1) << "\n";
         int skip_byte = byte0(instr);
         if (skip_byte >= 128) { // current instruction is the final instruction
           // cout << "  Halt\n";
           ker [bp]  = 0;
           buf [bp++]= stack[sp--];
           break;
         }
         else {
           pc += skip_byte+1;
           continue;
         }
       }

       // cout << "  " << (char) byte1 (instr) << " == "
       //      << (char) next_char << " => ";

       if (byte2 (instr) < 128) { // ligature
         // cout << "Ligature ";
         int code= byte2 (instr);
         int a   = code>>2;
         int b   = (code>>1)&1;
         int c   = code&1;
         // cout << "(" << a << "," << b << "," << c << ")\n";
         if (b==0) sp--;
         stack [sp++]= byte3 (instr);
         if (c!=0) stack[sp++]= cur_char;
         sp--;
         while (a>0) {
           ker [bp]  = 0;
           buf [bp++]= stack [sp--];
           a--;
         }
         break;
       }

       else { // kerning
         // cout << "Kerning (" << kern  [word1x (instr)] << ")\n";
         ker [bp]  = kern  [word1x (instr)];
         buf [bp++]= stack [sp--];
         break;
       }
      }
    }
    else {
      ker [bp]  = 0;
      buf [bp++]= stack [sp--];
    }
    /***************** end ligature-kerning program ******************/

    if ((bp>=m-2) || (sp>=m-2)) {
      cerr << "\nString is ";
      for (i=0; i<n; i++) cerr << (char) s[i];
      cerr << "\n";
      FAILED ("string too complex for ligature kerning");
    }
  }
  
  m= bp;
  STACK_DELETE_ARRAY (stack);
}

Here is the call graph for this function:

void tex_font_metric_rep::get_xpositions ( int *  s,
int  n,
double  unit,
SI xpos 
)

Definition at line 238 of file load_tfm.cpp.

                                                                         {
  SI  x    = 0;
  SI  x_bis= 0;
  int pos  = 1;

  int m= n + 16;
  STACK_NEW_ARRAY (stack, int, m);
  int bp, sp=0, i;

  for (i=0; i<n; i++) stack[sp++]= s[n-1-i];
  sp--; bp= 0;

  while (sp>=0) {
    int cur_char= stack [sp]& 255;

    /***************** the ligature-kerning program ******************/
    if ((cur_char<bc) || (cur_char>ec)) { SKIP; }
    else if ((tag (cur_char)==1) && (sp>0)) {
      register int next_char= stack [sp-1]& 255;
      register int pc= rem (cur_char);
      if (byte0 (lig_kern [pc]) > 128) pc= word1 (lig_kern [pc]);

      while (true) {
       register int instr= lig_kern [pc];
       if (byte0 (instr) >= 128) { ADVANCE (0); break; }
       if (byte1 (instr) != next_char) { pc += byte0 (instr)+1; continue; }
       if (byte2 (instr) < 128) {
         int code= byte2 (instr);
         int a   = code>>2;
         int b   = (code>>1)&1;
         int c   = code&1;
         if (b==0) SKIP;
         stack [sp++]= byte3 (instr);
         if (c!=0) stack [sp++]= cur_char;
         SKIP;
         while (a>0) { ADVANCE (0); a--; }
         break;
       }
       else { ADVANCE (kern [word1x (instr)]); break; }
      }
    }
    else ADVANCE (0);
    /***************** end ligature-kerning program ******************/

    if ((bp>=m-2) || (sp>=m-2)) {
      cerr << "\nString is ";
      for (i=0; i<n; i++) cerr << (char) s[i];
      cerr << "\n";
      FAILED ("string too complex for ligature kerning");
    }
  }
  STACK_DELETE_ARRAY (stack);
}

Here is the call graph for this function:

Definition at line 72 of file load_tfm.cpp.

                                {
  if ((c<bc) || (c>ec)) return 0;
  return height [byte1a (char_info[c-bc])]; }

Definition at line 78 of file load_tfm.cpp.

                                {
  if ((c<bc) || (c>ec)) return 0;
  return italic [byte2x (char_info[c-bc])]; }

Here is the caller graph for this function:

Definition at line 97 of file load_tfm.cpp.

                                   {
  if (tag(c)!=2) return 1;
  return list_len (rem (c)) + 1;
}

Here is the call graph for this function:

Definition at line 84 of file load_tfm.cpp.

{ return (QN) byte1 (exten [rem (c)]); }

Here is the call graph for this function:

Definition at line 103 of file load_tfm.cpp.

                                             {
  if ((n==1) || (tag(c)!=2)) return c;
  return nth_in_list (rem (c), n-1);
}

Here is the call graph for this function:

Definition at line 88 of file load_tfm.cpp.

{ return (i<np)? param [i]: 0; }

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 82 of file load_tfm.cpp.

{ return char_info  [c-bc] & 255; }

Here is the caller graph for this function:

Definition at line 86 of file load_tfm.cpp.

{ return (QN) byte3 (exten [rem (c)]); }

Here is the call graph for this function:

Definition at line 109 of file load_tfm.cpp.

                            {
  double slope= ((double) parameter(0)) / ((double) (1<<20));
  if (slope >= 1.0) slope= 0.25;
  if (slope <= -1.0) slope= -0.25;
  return slope;
}

Here is the call graph for this function:

Definition at line 89 of file load_tfm.cpp.

{ return parameter (1); }

Here is the call graph for this function:

Definition at line 94 of file load_tfm.cpp.

{ return parameter (6); }

Here is the call graph for this function:

Definition at line 93 of file load_tfm.cpp.

{ return parameter (5); }

Here is the call graph for this function:

Definition at line 91 of file load_tfm.cpp.

{ return parameter (3); }

Here is the call graph for this function:

Definition at line 90 of file load_tfm.cpp.

{ return parameter (2); }

Here is the call graph for this function:

Definition at line 81 of file load_tfm.cpp.

{ return (char_info [c-bc]>>8)&3; }

Here is the caller graph for this function:

Definition at line 83 of file load_tfm.cpp.

{ return (QN) byte0 (exten [rem (c)]); }

Here is the call graph for this function:

Definition at line 69 of file load_tfm.cpp.

                                {
  if ((c<bc) || (c>ec)) return 0;
  return width [byte0 (char_info[c-bc])]; }

Definition at line 92 of file load_tfm.cpp.

{ return parameter (4); }

Here is the call graph for this function:


Member Data Documentation

Definition at line 22 of file load_tfm.hpp.

Definition at line 27 of file load_tfm.hpp.

Definition at line 30 of file load_tfm.hpp.

Definition at line 22 of file load_tfm.hpp.

Definition at line 34 of file load_tfm.hpp.

Definition at line 26 of file load_tfm.hpp.

Definition at line 29 of file load_tfm.hpp.

Definition at line 31 of file load_tfm.hpp.

Definition at line 33 of file load_tfm.hpp.

Definition at line 37 of file load_tfm.hpp.

Definition at line 38 of file load_tfm.hpp.

Definition at line 22 of file load_tfm.hpp.

Definition at line 22 of file load_tfm.hpp.

Definition at line 32 of file load_tfm.hpp.

Definition at line 23 of file load_tfm.hpp.

Definition at line 24 of file load_tfm.hpp.

Definition at line 23 of file load_tfm.hpp.

Definition at line 23 of file load_tfm.hpp.

Definition at line 24 of file load_tfm.hpp.

Definition at line 24 of file load_tfm.hpp.

Definition at line 24 of file load_tfm.hpp.

Definition at line 23 of file load_tfm.hpp.

Definition at line 35 of file load_tfm.hpp.

string rep< tex_font_metric >::res_name [inherited]

Definition at line 17 of file resource.hpp.

Definition at line 37 of file load_tfm.hpp.

Definition at line 38 of file load_tfm.hpp.

Definition at line 40 of file load_tfm.hpp.

Definition at line 28 of file load_tfm.hpp.


The documentation for this struct was generated from the following files: