Back to index

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

List of all members.

Public Member Functions

 tex_rubber_font_rep (string name, string trl_name, string family, int size, int dpi, int dsize)
void get_extents (int c, metric &ex)
void get_partial_extents (int c, metric &ex)
void get_extents (string s, metric &ex)
void draw (renderer ren, int c, SI x, SI &y, SI &real_y)
void draw (renderer ren, string s, SI x, SI y)
double get_left_slope (string s)
double get_right_slope (string s)
SI get_right_correction (string s)
void copy_math_pars (font fn)
virtual void get_xpositions (string s, SI *xpos)
virtual SI get_left_correction (string s)
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)
virtual glyph get_glyph (string s)

Public Attributes

string family
int dpi
int dsize
translator ext
tex_font_metric tfm
font_glyphs pk
double unit
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 20 of file tex_rubber_font.cpp.


Constructor & Destructor Documentation

tex_rubber_font_rep::tex_rubber_font_rep ( string  name,
string  trl_name,
string  family,
int  size,
int  dpi,
int  dsize 
)

Definition at line 55 of file tex_rubber_font.cpp.

                                                                   :
    font_rep (name), dsize (dsize2), ext (load_translator (trl_name))
{
  load_tex (family2, size2, dpi2, dsize, tfm, pk);

  family       = family2;
  size         = size2;
  dpi          = dpi2;
  design_size  = tfm->design_size () >> 12;
  display_size = (((design_size*dpi)/72)*PIXEL) >> 8;
  unit         = ((double) display_size) / ((double) (1<<20));
  slope        = tfm->slope ();
  spc->def     = conv (tfm->spc ());
  spc->min     = spc->def - conv (tfm->spc_shrink ());
  spc->max     = spc->def + conv (tfm->spc_stretch ());
  extra        = conv (tfm->spc_extra ());
  extra->min   = extra->min >> 1;
  extra->max   = extra->min << 1;
  sep          = ((((dpi*PIXEL)/72)*design_size) >> 8) / 10;

  y1           = conv (-262080);
  y2           = y1+ display_size;
  yx           = conv (tfm->x_height ());
  yfrac        = yx >> 1;
  ysub_lo_base = -yx/3;
  ysub_hi_lim  = (5*yx)/6;
  ysup_lo_lim  = yx/2;
  ysup_lo_base = (5*yx)/6;
  ysup_hi_lim  = yx;
  yshift       = yx/6;

  wpt          = (dpi*PIXEL)/72;
  wfn          = (wpt*design_size) >> 8;
  wline        = wfn/20;
  wquad        = conv (tfm->spc_quad ());
}

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 tex_rubber_font_rep::draw ( renderer  ren,
int  c,
SI  x,
SI y,
SI real_y 
)

Definition at line 202 of file tex_rubber_font.cpp.

                                                                       {
  ren->draw (c, pk, x, y);
  SI delta  = conv (tfm->h (c)+ tfm->d (c));
  SI pixel  = PIXEL * ren->sfactor;
  y        -= pixel * (delta/pixel);
  real_y   -= delta;
  while (y >= real_y + pixel) y -= pixel;
}

Here is the call graph for this function:

Here is the caller graph for this function:

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

Implements font_rep.

Definition at line 212 of file tex_rubber_font.cpp.

                                                             {
  metric ex;
  get_extents (s, ex);

  // determining base character and serial number
  int i;
  for (i=N(s)-1; i>0; i--) if (s[i]=='-') break;
  string r= s (0, i) * ">";
  QN pre_c= ext->dict[r];
  int n= as_int (s (i+1, N(s)-1));

  // draw the character
  if ((pre_c<tfm->bc) || (pre_c>tfm->ec)) return;
  QN c = tfm->nth_in_list (pre_c, n);

  if (tfm->tag (c) != 3) ren->draw (c, pk, x, y);
  else {
    int i;
    int nr_rep= n- tfm->list_len (pre_c);

    SI real_y= y; // may be necessary to round y
                  // using SI temp= x; decode (temp, y); encode (temp, y);
    if (tfm->top (c)!=0) draw (ren, tfm->top (c), x, y, real_y);
    if (tfm->rep (c)!=0)
      for (i=0; i<nr_rep; i++)
       draw (ren, tfm->rep (c), x, y, real_y);
    if (tfm->mid (c)!=0) draw (ren, tfm->mid (c), x, y, real_y);
    if ((tfm->rep (c)!=0) && (tfm->mid (c)!=0))
      for (i=0; i<nr_rep; i++)
       draw (ren, tfm->rep (c), x, y, real_y);
    if (tfm->bot (c)!=0) draw (ren, tfm->bot (c), x, y, real_y);
  }
}

Here is the call graph for this function:

void tex_rubber_font_rep::get_extents ( int  c,
metric ex 
)

Definition at line 106 of file tex_rubber_font.cpp.

                                                   {
  glyph gl= pk->get (c);
  if (is_nil (gl))
    ex->x1= ex->y1= ex->x2= ex->y2= ex->x3= ex->y3= ex->x4= ex->y4= 0;
  else {
    ex->x1=  0;
    ex->y1= -conv (tfm->d(c));
    ex->x2=  conv (tfm->w(c));
    ex->y2=  conv (tfm->h(c));
    ex->x3= -((int) gl->xoff) * PIXEL;
    ex->x4=  ((int) (gl->width- gl->xoff)) * PIXEL;
    ex->y3=  ((int) (gl->yoff- gl->height)) * PIXEL;
    ex->y4=  ((int) gl->yoff) * PIXEL;

    ex->x3 -= 2*PIXEL; ex->x4 += 2*PIXEL;
    ex->y3 -= 2*PIXEL; ex->y4 += 3*PIXEL;
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

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

Implements font_rep.

Definition at line 136 of file tex_rubber_font.cpp.

                                                      {
  ASSERT ((N(s)>=2) && (s[0]=='<') && (s[N(s)-1]=='>'),
         "invalid rubber character");

  // determining base character and serial number
  int i;
  for (i=N(s)-1; i>0; i--) if (s[i]=='-') break;
  string r= s (0, i) * ">";
  QN pre_c= ext->dict[r];
  int n= as_int (s (i+1, N(s)-1));
  if ((pre_c<tfm->bc) || (pre_c>tfm->ec)) {
    ex->x1= ex->y1= ex->x2= ex->y2= ex->x3= ex->y3= ex->x4= ex->y4= 0;
    return;
  }

  // get extents
  QN c= tfm->nth_in_list (pre_c, n);
  if (tfm->tag (c) != 3) get_extents (c, ex);
  else {
    int i, nr_rep= n- tfm->list_len (pre_c);

    ex->x1= ex->x3= ex->y3= PLUS_INFINITY;
    ex->x2= ex->x4= ex->y4= MINUS_INFINITY;
    ex->y1= ex->y2= 0;

    if (tfm->top (c)!=0) get_partial_extents (tfm->top (c), ex);
    if ((tfm->rep (c)!=0) && (tfm->mid (c)!=0))
      for (i=0; i<nr_rep; i++) get_partial_extents (tfm->rep (c), ex);
    if (tfm->mid (c)!=0) get_partial_extents (tfm->mid (c), ex);
    if (tfm->rep (c)!=0)
      for (i=0; i<nr_rep; i++) get_partial_extents (tfm->rep (c), ex);
    if (tfm->bot (c)!=0) get_partial_extents (tfm->bot (c), ex);
  }

  if ((N(s) >= 7) && (s(0,5) == "<big-") && (n == 2)) {
    // correction for very big operators
    ex->y1 += ex->y2;
    ex->y2  = 0;
  }
  else {
    // correction for large delimiters
    int j;
    for (j=1; j<N(s); j++) if (s[j]=='-') break;
    if (j==N(s)) return; else j++;
    switch (s[j]) {
    case 'r':
      if ((N(s) >= j+6) && (s(j+1,j+6) == "angle")) {
       ex->x1= ex->x3- sep;
       ex->x2= ex->x4+ sep;
       break;
      }
    case ']':
    case '|':
      ex->x1= ex->x3- sep;
      ex->x2= ex->x4+ (3*sep/2);
      break;
    case 's':
      break;
    default:
      ex->x1= ex->x3- sep;
      ex->x2= ex->x4+ sep;
    }
  }
}

Here is the call graph for this function:

glyph font_rep::get_glyph ( string  s) [virtual, inherited]

Reimplemented in tex_font_rep, math_font_rep, x_font_rep, compound_font_rep, and virtual_font_rep.

Definition at line 138 of file font.cpp.

                             {
  cerr << "glyph name: " << s << "\n";
  FAILED ("no bitmap available");
  return glyph ();
}

Here is the caller graph for this function:

SI font_rep::get_left_correction ( string  s) [virtual, inherited]

Reimplemented in math_font_rep, tex_font_rep, and compound_font_rep.

Definition at line 64 of file font.cpp.

{ (void) s; return 0; }

Reimplemented from font_rep.

Definition at line 251 of file tex_rubber_font.cpp.

                                             {
  if ((N(s)>=5) && (s(0,5)=="<big-") && (get_right_correction(s)!=0))
    return 0.25;
  return slope;
}

Here is the call graph for this function:

Definition at line 126 of file tex_rubber_font.cpp.

                                                           {
  metric ey;
  get_extents (c, ey);
  ex->x1= min (ex->x1, ey->x1); ex->y1 -= (ey->y2-ey->y1);
  ex->x2= max (ex->x2, ey->x2);
  ex->x3= min (ex->x3, ey->x3); ex->y3= min (ex->y3, ex->y1+ (ey->y3-ey->y1));
  ex->x4= max (ex->x4, ey->x4); ex->y4= max (ex->y4, ex->y1+ (ey->y4-ey->y1));
}

Here is the call graph for this function:

Here is the caller graph for this function:

Reimplemented from font_rep.

Definition at line 265 of file tex_rubber_font.cpp.

                                                   {
  if ((N(s)>=5) && (s(0,5)=="<big-")) {
    int i;
    for (i=N(s)-1; i>0; i--) if (s[i]=='-') break;
    string r= s (0, i) * ">";
    QN  pre_c= ext->dict[r];
    int n    = as_int (s (i+1, N(s)-1));
    QN  c    = tfm->nth_in_list (pre_c, n);
    return conv (tfm->i (c));
  }
  return 0;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Reimplemented from font_rep.

Definition at line 258 of file tex_rubber_font.cpp.

                                              {
  if ((N(s)>=5) && (s(0,5)=="<big-") && (get_right_correction(s)!=0))
    return 0.25;
  return slope;
}

Here is the call graph for this function:

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

Reimplemented in error_font_rep, math_font_rep, tex_font_rep, and x_font_rep.

Definition at line 68 of file font.cpp.

                                            {
  int i= 0;
  SI  x= 0;
  metric ex;
  while (i < N(s)) {
    if (s[i] == '<')
      while ((i < N(s)) && (s[i] != '>')) {
       i++;
       xpos[i]= x;
      }
    i++;
    get_extents (s (0, i), ex);
    x= ex->x2;
    xpos[i]= x;
  }
}

Here is the call 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 32 of file font.hpp.

Definition at line 33 of file font.hpp.

Definition at line 22 of file tex_rubber_font.cpp.

Definition at line 23 of file tex_rubber_font.cpp.

Definition at line 24 of file tex_rubber_font.cpp.

space font_rep::extra [inherited]

Definition at line 36 of file font.hpp.

Definition at line 21 of file tex_rubber_font.cpp.

Definition at line 26 of file tex_rubber_font.cpp.

string rep< font >::res_name [inherited]

Definition at line 17 of file resource.hpp.

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.

tex_font_metric tex_rubber_font_rep::tfm

Definition at line 25 of file tex_rubber_font.cpp.

int font_rep::type [inherited]

Definition at line 30 of file font.hpp.

Definition at line 27 of file tex_rubber_font.cpp.

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: