i = 0;
x = rtl ? int(full_width()) : 0;
break;
- case SEPARATOR:
case INSET:
case SPACE:
// those elements contain only one position. Round to
case Row::INSET:
os << "INSET: " << to_utf8(e.inset->layoutName()) << ", ";
break;
- case Row::SEPARATOR:
- os << "SEPARATOR: extra=" << e.extra << ", ";
- break;
case Row::SPACE:
os << "SPACE: ";
break;
}
-void Row::addSeparator(pos_type const pos, char_type const c,
- Font const & f, Change const & ch)
-{
- finalizeLast();
- Element e(SEPARATOR, pos, f, ch);
- e.str += c;
- e.dim.wid = theFontMetrics(f).width(c);
- elements_.push_back(e);
- dim_.wid += e.dim.wid;
-}
-
-
void Row::addSpace(pos_type const pos, int const width,
Font const & f, Change const & ch)
{
class DocIterator;
class Inset;
-/**
- * FIXME: Change Row object to operate only on integers and not doubles.
- *
- * This use of double is only useful to distribute the extra
- * horizontal space between separators in justified text. If we do
- * integer arithmetic, then it is possible to have two groups of
- * separators, with size s or s+1. Then strings can be drawn without
- * cutting at separators in justfied text, as it is done in
- * non-justified text. This will improve performance.
- */
-
-
/**
* An on-screen row of text. A paragraph is broken into a RowList for
* display. Each Row contains a tokenized description of the contents
* correspond to any paragraph contents
*/
VIRTUAL,
- // A stretchable space, basically
- SEPARATOR,
// An inset
INSET,
// Some spacing described by its width, not a string
// Non-zero only if element is an inset
Inset const * inset;
- // Only non-null for separator elements
+ // Only non-null for justified rows
double extra;
- // Non-empty if element is a string or separator
+ // Non-empty if element is a string or is virtual
docstring str;
//
Font font;
void addVirtual(pos_type pos, docstring const & s,
Font const & f, Change const & ch);
///
- void addSeparator(pos_type pos, char_type const c,
- Font const & f, Change const & ch);
- ///
void addSpace(pos_type pos, int width, Font const & f, Change const & ch);
///
friend std::ostream & operator<<(std::ostream & os, Row const & row);
- /// width of a separator (i.e. space)
+ /// additional width for separators in justified rows (i.e. space)
double separator;
/// width of hfills in the label
double label_hfill;
}
-void RowPainter::paintSeparator(double width, Font const & font)
-{
- pi_.pain.textDecoration(font.fontInfo(), int(x_), yo_, int(width));
- x_ += width;
-}
-
-
void RowPainter::paintForeignMark(double orig_x, Language const * lang, int desc) const
{
if (!lyxrc.mark_foreign_language)
foreign_descent = e.dim.descent();
}
break;
- case Row::SEPARATOR:
case Row::SPACE:
- paintSeparator(e.full_width(), e.font);
+ pi_.pain.textDecoration(e.font.fontInfo(), int(x_), yo_, int(e.full_width()));
+ x_ += e.full_width();
}
// The line that indicates word in a different language