Back to index

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

Go to the source code of this file.

Classes

struct  metric_struct
struct  glyph_rep
struct  glyph
struct  font_metric_rep
struct  font_glyphs_rep

Typedefs

typedef int SI
typedef unsigned char QN
typedef metric_struct metric [1]

Functions

 RESOURCE (font_metric)
 RESOURCE (font_glyphs)
 CONCRETE_NULL_CODE (glyph)
tm_ostreamoperator<< (tm_ostream &out, glyph gl)
glyph shrink (glyph gl, int xf, int yf, SI &xo, SI &yo)
glyph join (glyph gl1, glyph gl2)
glyph glue (glyph gl1, glyph gl2)
glyph add (glyph gl1, glyph gl2)
glyph move (glyph gl, SI x, SI y)
glyph clip (glyph gl, SI x1, SI y1, SI x2, SI y3)
glyph hor_flip (glyph gl)
glyph ver_flip (glyph gl)
glyph pos_rotate (glyph gl)
glyph hor_extend (glyph gl, int pos, int by)
glyph ver_extend (glyph gl, int pos, int by)
font_metric std_font_metric (string s, metric *fnm, int bc, int ec)
font_glyphs std_font_glyphs (string name, glyph *fng, int bc, int ec)

Class Documentation

struct metric_struct

Definition at line 22 of file bitmap_font.hpp.

Class Members
SI x1
SI x2
SI x3
SI x4
SI y1
SI y2
SI y3
SI y4

Typedef Documentation

typedef metric_struct metric[1]

Definition at line 29 of file bitmap_font.hpp.

typedef unsigned char QN

Definition at line 20 of file bitmap_font.hpp.

typedef int SI

Definition at line 19 of file bitmap_font.hpp.


Function Documentation

glyph add ( glyph  gl1,
glyph  gl2 
)
glyph clip ( glyph  gl,
SI  x1,
SI  y1,
SI  x2,
SI  y3 
)

Definition at line 54 of file glyph_ops.cpp.

                                            {
  abs_round (x1, y1);
  abs_round (x2, y2);
  x1= x1/PIXEL; y1= y1/PIXEL;
  x2= x2/PIXEL; y2= y2/PIXEL;
  int i, j;
  int ww= gl->width, hh= gl->height;
  glyph bmr (ww, hh, gl->xoff, gl->yoff, gl->depth);
  for (j=0; j<hh; j++)
    for (i=0; i<ww; i++) {
      bool x_ok= (i+gl->xoff >= x1) && (i+gl->xoff < x2);
      bool y_ok= (gl->yoff-j >= y1) && (gl->yoff-j < y2);
      bmr->set_x (i, j, x_ok && y_ok? gl->get_x (i, j): 0);
    }
  return bmr;
}

Here is the call graph for this function:

Here is the caller graph for this function:

glyph glue ( glyph  gl1,
glyph  gl2 
)

Here is the caller graph for this function:

glyph hor_extend ( glyph  gl,
int  pos,
int  by 
)

Definition at line 107 of file glyph_ops.cpp.

                                       {
  int i, j;
  int ww= gl->width, hh= gl->height;
  bool ok= false;
  while (!ok) { // hack for corrupted pfb translations
    for (j=0; j<hh; j++)
      ok= ok || (gl->get_x (pos, j) != 0);
    if (!ok) pos += (pos < (ww>>1)? 1: -1);
    if (pos >= (ww>>2) && pos < (3*ww>>2)) break;
  }
  glyph bmr (ww+ by, hh, gl->xoff, gl->yoff, gl->depth);
  for (j=0; j<hh; j++)
    for (i=0; i<(ww+by); i++)
      bmr->set_x (i, j, gl->get_x (i<pos? i: (i<pos+by? pos: i-by), j));
  return bmr;
}

Here is the caller graph for this function:

glyph hor_flip ( glyph  gl)

Definition at line 72 of file glyph_ops.cpp.

                    {
  int i, j;
  int ww= gl->width, hh= gl->height;
  glyph bmr (ww, hh, gl->xoff, gl->yoff, gl->depth);
  for (j=0; j<hh; j++)
    for (i=0; i<ww; i++)
      bmr->set_x (ww-1-i, j, gl->get_x (i, j));
  bmr->lwidth= gl->lwidth;
  return bmr;
}

Here is the caller graph for this function:

glyph join ( glyph  gl1,
glyph  gl2 
)

Definition at line 16 of file glyph_ops.cpp.

                            {
  int x1= min (-gl1->xoff, -gl2->xoff);
  int y1= min (gl1->yoff- gl1->height, gl2->yoff- gl2->height);
  int x2= max (gl1->width- gl1->xoff, gl2->width- gl2->xoff);
  int y2= max (gl1->yoff, gl2->yoff);
  glyph bmr (x2-x1, y2-y1, -x1, y2, max (gl1->depth, gl2->depth));

  int i, j, dx, dy;
  dx= -gl1->xoff- x1, dy= y2- gl1->yoff;
  for (j=0; j<gl1->height; j++)
    for (i=0; i<gl1->width; i++)
      bmr->set_x (i+dx, j+dy, gl1->get_x (i, j));

  dx= -gl2->xoff- x1; dy= y2- gl2->yoff;
  for (j=0; j<gl2->height; j++)
    for (i=0; i<gl2->width; i++)
      bmr->set_x (i+dx, j+dy,
                max (bmr->get_x (i+dx, j+dy), gl2->get_x (i, j)));

  return bmr;
}
glyph move ( glyph  gl,
SI  x,
SI  y 
)

Definition at line 39 of file glyph_ops.cpp.

                            {
  x += PIXEL/2; y += PIXEL/2; abs_round (x, y);
  int xx= x/PIXEL, yy= y/PIXEL;
  int ww= gl->width, hh= gl->height;
  glyph bmr (ww, hh, gl->xoff- xx, gl->yoff+ yy, gl->depth);

  int i, j;
  for (j=0; j<hh; j++)
    for (i=0; i<ww; i++)
      bmr->set_x (i, j, gl->get_x (i, j));
  bmr->lwidth= gl->lwidth;
  return bmr;
}

Here is the call graph for this function:

Here is the caller graph for this function:

tm_ostream& operator<< ( tm_ostream out,
glyph  gl 
)

Definition at line 104 of file glyph.cpp.

                                        {
  int i, j;
  out << "Size  : (" << gl->width << ", " << gl->height << ")\n";
  out << "Offset: (" << gl->xoff << ", " << gl->yoff << ")\n";
  for (i=0; i<gl->width+2; i++) out << "-";
  out << "\n";
  for (j=0; j<gl->height; j++) {
    out << "|";
    for (i=0; i<gl->width; i++) {
      int k= gl->get_x (i, j);
      if (k==0) out << " ";
      else if (gl->depth==1) out << "*";
      else if (k <= 9) out << k;
      else out << ((char) (55+k));
    }
    out << "|\n";
  }
  for (i=0; i<gl->width+2; i++) out << "-";
  out << "\n";
  return out;
}

Definition at line 96 of file glyph_ops.cpp.

                      {
  int i, j;
  int ww= gl->width, hh= gl->height;
  glyph bmr (hh, ww, gl->yoff, gl->width- gl->xoff, gl->depth);
  for (j=0; j<hh; j++)
    for (i=0; i<ww; i++)
      bmr->set_x (j, ww-1-i, gl->get_x (i, j));
  return bmr;
}

Here is the caller graph for this function:

RESOURCE ( font_glyphs  )
glyph shrink ( glyph  gl,
int  xf,
int  yf,
SI xo,
SI yo 
)

Definition at line 216 of file glyph_shrink.cpp.

                                                            {
  if ((gl->width==0) || (gl->height==0))
    FAILED ("zero size character");

  int tx= xfactor/3;
  int ty= yfactor/3;
  int dx=0, dy=0;
  if ((gl->status==0) && (xfactor>1)) dx= get_hor_shift (gl, xfactor, tx);
  // if ((gl->status==0) && (yfactor>1)) dy= get_ver_shift (gl, yfactor, ty);

  glyph ret= shrink (gl, xfactor, yfactor, dx, dy, tx, ty, xo, yo);
#ifndef QTTEXMACS
  if (ret->status != 0) {
    if (ret->status&1) ret->adjust_top ();
    if (ret->status&2) ret->adjust_bot ();
    ret->yoff= yo= 0;
  }
#endif
  return ret;
}

Here is the call graph for this function:

Here is the caller graph for this function:

font_glyphs std_font_glyphs ( string  name,
glyph fng,
int  bc,
int  ec 
)

Definition at line 98 of file bitmap_font.cpp.

                                                          {
  return make (font_glyphs, name, tm_new<std_font_glyphs_rep> (name, fng, bc, ec));
}

Here is the caller graph for this function:

font_metric std_font_metric ( string  s,
metric fnm,
int  bc,
int  ec 
)

Definition at line 58 of file bitmap_font.cpp.

                                                           {
  return make (font_metric, name,
              tm_new<std_font_metric_rep> (name, fnm, bc, ec));
}

Here is the caller graph for this function:

glyph ver_extend ( glyph  gl,
int  pos,
int  by 
)

Definition at line 125 of file glyph_ops.cpp.

                                       {
  int i, j;
  int ww= gl->width, hh= gl->height;
  glyph bmr (ww, hh+by, gl->xoff, gl->yoff, gl->depth);
  for (j=0; j<(hh+by); j++)
    for (i=0; i<ww; i++)
      bmr->set_x (i, j, gl->get_x (i, j<pos? j: (j<pos+by? pos: j-by)));
  return bmr;
}

Here is the caller graph for this function:

glyph ver_flip ( glyph  gl)

Definition at line 84 of file glyph_ops.cpp.

                    {
  int i, j;
  int ww= gl->width, hh= gl->height;
  glyph bmr (ww, hh, gl->xoff, gl->yoff, gl->depth);
  for (j=0; j<hh; j++)
    for (i=0; i<ww; i++)
      bmr->set_x (i, hh-1-j, gl->get_x (i, j));
  bmr->lwidth= gl->lwidth;
  return bmr;
}

Here is the caller graph for this function: