Back to index

texmacs  1.0.7.15
Functions
lazy_paragraph.cpp File Reference
#include "Line/lazy_paragraph.hpp"
#include "Line/lazy_vstream.hpp"
#include "Format/format.hpp"
#include "Boxes/construct.hpp"

Go to the source code of this file.

Functions

array< line_itemtypeset_concat (edit_env env, tree t, path ip)
void hyphenate (line_item item, int pos, line_item &item1, line_item &item2)
array< pathline_breaks (array< line_item > a, int start, int end, SI line_width, SI first_spc, SI last_spc, bool ragged)
static array< line_itemconvert (edit_env env, array< box > bs, path ip)
array< line_itemtypeset_concat_or_table (edit_env env, tree t, path ip)
array< page_itemtypeset_stack (edit_env env, tree t, path ip, array< line_item > a, array< line_item > b, stack_border &sb)
lazy make_lazy_paragraph (edit_env env, tree t, path ip)
lazy make_lazy_paragraph (edit_env env, array< box > bs, path ip)
array< line_itemjoin (array< line_item > a, array< line_item > b)

Function Documentation

static array<line_item> convert ( edit_env  env,
array< box bs,
path  ip 
) [static]

Definition at line 469 of file lazy_paragraph.cpp.

                                               {
  array<line_item> a;
  int i, n=N(bs);
  for (i=0; i<n; i++) {
    if (i==0) {
      box b= empty_box (decorate (ip), 0, 0, 0, env->fn->yx);
      tree ct= tuple ("env_par", PAR_FIRST, "0cm");
      a << line_item (CONTROL_ITEM, OP_SKIP, b, 0, ct);
    }
    a << line_item (STD_ITEM, env->mode_op, bs[i], 0);
    if (i<(n-1)) {
      box b= empty_box (decorate (ip), 0, 0, 0, env->fn->yx);
      a << line_item (CONTROL_ITEM, OP_SKIP, b, 0, NEXT_LINE);
    }
  }
  return a;
}

Here is the call graph for this function:

void hyphenate ( line_item  item,
int  pos,
line_item item1,
line_item item2 
)

Definition at line 112 of file line_breaker.cpp.

                                                                        {
  path ip= item->b->ip;
  int  x1= is_accessible (ip)? item->b->get_leaf_left_pos (): 0;
  int  x2= is_accessible (ip)? x1+ pos+ 1: 0;

  box b= item->b;
  string s  = b->get_leaf_string ();
  font   fn = b->get_leaf_font ();
  color  col= b->get_leaf_color ();

  string s1, s2;
  array<int> hp= item->lan->get_hyphens (s);
  item->lan->hyphenate (s, pos, s1, s2);
  item1= line_item (STRING_ITEM, OP_SKIP,
                  shorter_box (ip, text_box (ip, x1, s1, fn, col), pos+ 1),
                  hp[pos], item->lan);
  item2= line_item (STRING_ITEM, item->op_type,
                    text_box (ip, x2, s2, fn, col),
                  item->penalty, item->lan);
  item2->spc= item->spc;
  // cout << s << " ---> " << s1 << " " << s2 << "\n";
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 525 of file lazy_paragraph.cpp.

                                              {
  int i, m= N(a), n= N(b);
  array<line_item> c (m+n);
  for (i=0; i<m; i++) c[i  ]= a[i];
  for (i=0; i<n; i++) c[i+m]= b[i];
  return c;
}

Here is the call graph for this function:

array<path> line_breaks ( array< line_item a,
int  start,
int  end,
SI  line_width,
SI  first_spc,
SI  last_spc,
bool  ragged 
)

Definition at line 451 of file line_breaker.cpp.

{
  int tol= 5;         // extra tolerance of 5tmpt avoid rounding errors when
  line_width += tol;  // the widths of the boxes sum up to precisely 1par
  line_breaker_rep* H=
    tm_new<line_breaker_rep> (a, start, end, line_width, first_spc, last_spc);
  array<path> ap= ragged? H->compute_ragged_breaks (): H->compute_breaks ();
  tm_delete (H);
  return ap;
}

Here is the call graph for this function:

Here is the caller graph for this function:

lazy make_lazy_paragraph ( edit_env  env,
tree  t,
path  ip 
)

Definition at line 511 of file lazy_paragraph.cpp.

                                                    {
  lazy_paragraph par (env, ip);
  par->a= typeset_concat (env, t, ip);
  return par;
}

Here is the call graph for this function:

Here is the caller graph for this function:

lazy make_lazy_paragraph ( edit_env  env,
array< box bs,
path  ip 
)

Definition at line 518 of file lazy_paragraph.cpp.

                                                           {
  lazy_paragraph par (env, ip);
  par->a= convert (env, bs, ip);
  return par;
}

Here is the call graph for this function:

array<line_item> typeset_concat ( edit_env  env,
tree  t,
path  ip 
)

Definition at line 742 of file concater.cpp.

                                               {
  concater ccc= tm_new<concater_rep> (env);
  ccc->typeset (t, ip);
  ccc->finish ();
  array<line_item> a= ccc->a;
  tm_delete (ccc);
  return a;
}

Definition at line 488 of file lazy_paragraph.cpp.

                                                        {
  if (is_func (t, TABLE)) {
    array<box> bs= typeset_as_var_table (env, t, ip);
    return convert (env, bs, ip);
  }
  else return typeset_concat (env, t, ip);
}

Here is the call graph for this function:

Here is the caller graph for this function:

array<page_item> typeset_stack ( edit_env  env,
tree  t,
path  ip,
array< line_item a,
array< line_item b,
stack_border sb 
)

Definition at line 497 of file lazy_paragraph.cpp.

{
  // cout << "Typeset stack " << t << "\n";
  lazy_paragraph par (env, ip);
  par->a= a;
  par->a << typeset_concat_or_table (env, t, ip);
  par->a << b;
  par->format_paragraph ();
  sb= par->sss->sb;
  return par->sss->l;
}

Here is the call graph for this function:

Here is the caller graph for this function: