Back to index

texmacs  1.0.7.15
Public Member Functions | Public Attributes
math_font_rep Struct Reference
Inheritance diagram for math_font_rep:
Inheritance graph
[legend]
Collaboration diagram for math_font_rep:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 math_font_rep (string name, scheme_tree t, font base, font error)
void init_font (int fn_nr, font &fn)
void search_font (string &s, font &fn)
void get_extents (string s, metric &ex)
void get_xpositions (string s, SI *xpos)
void draw (renderer ren, string s, SI x, SI y)
glyph get_glyph (string s)
double get_left_slope (string s)
double get_right_slope (string s)
SI get_left_correction (string s)
SI get_right_correction (string s)
void copy_math_pars (font fn)
void var_get_extents (string s, metric &ex)
void var_get_xpositions (string s, SI *xpos)
void var_draw (renderer ren, string s, SI x, SI y)

Public Attributes

font base_fn
font error_fn
translator math
translator rubber
translator italic
array< treefont_name
array< font > font_table
array< treerubber_name
array< font > rubber_table
int type
SI size
SI design_size
SI display_size
double slope
space spc
space extra
SI sep
SI y1
SI y2
SI yx
SI yfrac
SI ysub_lo_base
SI ysub_hi_lim
SI ysup_lo_lim
SI ysup_lo_base
SI ysup_hi_lim
SI yshift
SI wpt
SI wfn
SI wline
SI wquad
string res_name

Detailed Description

Definition at line 28 of file math_font.cpp.


Constructor & Destructor Documentation

math_font_rep::math_font_rep ( string  name,
scheme_tree  t,
font  base,
font  error 
)

Definition at line 53 of file math_font.cpp.

                                                    :
    font_rep (name, base), base_fn (base), error_fn (error),
    math (load_translator (as_string (t[1][0]))),
    rubber (load_translator (as_string (t[2][0]))),
    italic (load_translator ("italic")),
    font_name (N(t[1])-1), font_table (N(t[1])-1),
    rubber_name (N(t[2])-1), rubber_table (N(t[2])-1)
{
  int i;
  for (i=1; i<N(t[1]); i++)
    font_name[i-1]= t[1][i];
  for (i=1; i<N(t[2]); i++)
    rubber_name[i-1]= t[2][i];
}

Here is the call graph for this function:


Member Function Documentation

void font_rep::copy_math_pars ( font  fn) [inherited]

Definition at line 45 of file font.cpp.

                                 {
  y1           = fn->y1;
  y2           = fn->y2;
  yx           = fn->yx;
  yfrac        = fn->yfrac;
  ysub_lo_base = fn->ysub_lo_base;
  ysub_hi_lim  = fn->ysub_hi_lim;
  ysup_lo_lim  = fn->ysup_lo_lim;
  ysup_lo_base = fn->ysup_lo_base;
  ysup_hi_lim  = fn->ysup_hi_lim;
  yshift       = fn->yshift;
  wpt          = fn->wpt;
  wfn          = fn->wfn;
  wline        = fn->wline;
  wquad        = fn->wquad;
}

Here is the caller graph for this function:

void math_font_rep::draw ( renderer  ren,
string  s,
SI  x,
SI  y 
) [virtual]

Implements font_rep.

Definition at line 167 of file math_font.cpp.

                                                       {
  font fn;
  search_font (s, fn);
  fn->draw (ren, s, x, y);
}

Here is the call graph for this function:

void math_font_rep::get_extents ( string  s,
metric ex 
) [virtual]

Implements font_rep.

Definition at line 145 of file math_font.cpp.

                                                {
  font fn;
  search_font (s, fn);
  fn->get_extents (s, ex);
}

Here is the call graph for this function:

Reimplemented from font_rep.

Definition at line 174 of file math_font.cpp.

                                  {
  font fn;
  search_font (s, fn);
  return fn->get_glyph (s);
}

Here is the call graph for this function:

Reimplemented from font_rep.

Definition at line 205 of file math_font.cpp.

                                             {
  font fn;
  search_font (s, fn);
  return fn->get_left_correction (s);
}

Here is the call graph for this function:

double math_font_rep::get_left_slope ( string  s) [virtual]

Reimplemented from font_rep.

Definition at line 185 of file math_font.cpp.

                                        {
  if (italic->dict->contains (s) || ((N(s) >= 2) && (s[0] != '<'))) {
    font fn;
    search_font (s, fn);
    return fn->get_left_slope (s);
  }
  else return 0;
}

Here is the call graph for this function:

Reimplemented from font_rep.

Definition at line 212 of file math_font.cpp.

                                             {
  font fn;
  search_font (s, fn);
  return fn->get_right_correction (s);
}

Here is the call graph for this function:

double math_font_rep::get_right_slope ( string  s) [virtual]

Reimplemented from font_rep.

Definition at line 195 of file math_font.cpp.

                                        {
  if (italic->dict->contains (s) || ((N(s) >= 2) && (s[0] != '<'))) {
    font fn;
    search_font (s, fn);
    return fn->get_right_slope (s);
  }
  else return 0;
}

Here is the call graph for this function:

void math_font_rep::get_xpositions ( string  s,
SI xpos 
) [virtual]

Reimplemented from font_rep.

Definition at line 152 of file math_font.cpp.

                                                 {
  if (s == "") return;
  font fn;
  string r= s;
  search_font (r, fn);
  if (r == s) fn->get_xpositions (s, xpos);
  else if (N(r) != 1) font_rep::get_xpositions (s, xpos);
  else {
    int i, n=N(s);
    for (i=1; i<n; i++) xpos[i]= 0;
    fn->get_xpositions (r, xpos+n-1);
  }
}

Here is the call graph for this function:

void math_font_rep::init_font ( int  fn_nr,
font &  fn 
)

Definition at line 74 of file math_font.cpp.

                                             {
  tree t= font_name [fn_nr];
  if (is_tuple (t, "virtual", 3))
    fn= virtual_font (this, as_string(t[1]), as_int(t[2]), as_int(t[3]));
  else {
    fn= find_font (t);
    ASSERT (!is_nil (fn), "font not found");
  }
  fn->copy_math_pars (base_fn);
  font_table [fn_nr]= fn;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void math_font_rep::search_font ( string s,
font &  fn 
)

Definition at line 87 of file math_font.cpp.

                                               {
  if ((N(s)>=9) && (s[N(s)-2]>='0') && (s[N(s)-2]<='9')) {
    int i;
    for (i=N(s)-1; i>0; i--)
      if (s[i]=='-') break;
    if (i>0) {
      string root= s(0,i) * ">";
      int c= rubber->dict [root];
      if ((c!=-1) && (s (N(s)-3, N(s)) != "-0>")) {
       int fn_nr= c/256;
       if (is_nil (rubber_table [fn_nr])) {
         fn= find_font (rubber_name [fn_nr]);
         ASSERT (!is_nil (fn), "font not found");
         fn->yfrac= base_fn->yfrac;
         // fn->copy_math_pars (base_fn);
         rubber_table [fn_nr]= fn;
       }
       else fn= rubber_table [fn_nr];
       return;
      }
      c= math->dict [s(0,i) * "-#>"];
      if (c != -1) {
       int fn_nr= c/256;
       fn= font_table [fn_nr];
       if (is_nil (fn)) init_font (fn_nr, fn);
       s= string ((char) (c&255)) * s (i+1, N(s));
       return;
      }
    }
  }

  int c= math->dict [s];
  if (c != -1) { 
    int fn_nr= c/256;
    fn= font_table [fn_nr];
    if (is_nil (fn)) init_font (fn_nr, fn);
    s= string ((char) (c&255));
  }
  else {
    int i, n= N(s);
    for (i=0; i<n; i++)
      if (((s[i]<'0') || (s[i]>'9')) &&
         ((s[i]<'a') || (s[i]>'z')) &&
         ((s[i]<'A') || (s[i]>'Z')) &&
         (s[i] != '.') && (s[i] != '\\') && (s[i] != '_'))
       {
         fn= error_fn;
         return;
       }
    fn= base_fn;
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void font_rep::var_draw ( renderer  ren,
string  s,
SI  x,
SI  y 
) [inherited]

Definition at line 121 of file font.cpp.

                                                      {
  SI dx=0;
  int start=0, end;
  while (start<N(s)) {
    for (end=start; (end<N(s)) && (s[end]!=' '); end++) {}
    if (start<end) {
      metric ex;
      draw (ren, s (start, end), x+dx, y);
      get_extents (s (start, end), ex);
      dx += ex->x2;
    }
    for (; (end<N(s)) && (s[end]==' '); end++) dx += spc->def;
    start= end;
  }
}

Here is the call graph for this function:

void font_rep::var_get_extents ( string  s,
metric ex 
) [inherited]

Definition at line 86 of file font.cpp.

                                               {
  bool flag=true;
  int start=0, end;
  get_extents ("", ex);
  while (start<N(s)) {
    for (end=start; (end<N(s)) && (s[end]!=' '); end++) {}
    if (start<end) {
      metric ey;
      get_extents (s (start, end), ey);
      if (flag) {
       ex->x3= ey->x3+ ex->x2; ex->y3= ey->y3+ ex->x2;
       ex->x4= ey->x4; ex->y4= ey->y4;
       ex->x2 += ey->x2;
       flag= false;
      }
      else {
       ex->x3= min (ex->x3, ex->x2+ ey->x3);
       ex->x4= max (ex->x4, ex->x2+ ey->x4);
       ex->y3= min (ex->y3, ey->y3);
       ex->y4= max (ex->y4, ey->y4);
       ex->x2 += ey->x2;
      }
    }
    for (; (end<N(s)) && (s[end]==' '); end++) ex->x2 += spc->def;
    start= end;
  }
}

Here is the call graph for this function:

void font_rep::var_get_xpositions ( string  s,
SI xpos 
) [inherited]

Definition at line 115 of file font.cpp.

                                                {
  (void) s; (void) xpos;
  FAILED ("not yet implemented");
}

Member Data Documentation

Definition at line 29 of file math_font.cpp.

Definition at line 32 of file font.hpp.

Definition at line 33 of file font.hpp.

Definition at line 30 of file math_font.cpp.

space font_rep::extra [inherited]

Definition at line 36 of file font.hpp.

Definition at line 34 of file math_font.cpp.

Definition at line 35 of file math_font.cpp.

Definition at line 33 of file math_font.cpp.

translator math_font_rep::math

Definition at line 31 of file math_font.cpp.

string rep< font >::res_name [inherited]

Definition at line 17 of file resource.hpp.

Definition at line 32 of file math_font.cpp.

Definition at line 36 of file math_font.cpp.

Definition at line 37 of file math_font.cpp.

SI font_rep::sep [inherited]

Definition at line 37 of file font.hpp.

SI font_rep::size [inherited]

Reimplemented in virtual_font_rep.

Definition at line 31 of file font.hpp.

double font_rep::slope [inherited]

Definition at line 34 of file font.hpp.

space font_rep::spc [inherited]

Definition at line 35 of file font.hpp.

int font_rep::type [inherited]

Definition at line 30 of file font.hpp.

SI font_rep::wfn [inherited]

Definition at line 51 of file font.hpp.

SI font_rep::wline [inherited]

Definition at line 52 of file font.hpp.

SI font_rep::wpt [inherited]

Definition at line 50 of file font.hpp.

SI font_rep::wquad [inherited]

Definition at line 53 of file font.hpp.

SI font_rep::y1 [inherited]

Definition at line 39 of file font.hpp.

SI font_rep::y2 [inherited]

Definition at line 40 of file font.hpp.

SI font_rep::yfrac [inherited]

Definition at line 42 of file font.hpp.

SI font_rep::yshift [inherited]

Definition at line 48 of file font.hpp.

Definition at line 44 of file font.hpp.

Definition at line 43 of file font.hpp.

Definition at line 47 of file font.hpp.

Definition at line 46 of file font.hpp.

Definition at line 45 of file font.hpp.

SI font_rep::yx [inherited]

Definition at line 41 of file font.hpp.


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