TextMetrics::TextMetrics(BufferView * bv, Text * text)
: bv_(bv), text_(text)
{
- LBUFERR(bv_, _("Text metrics error."));
+ LBUFERR(bv_);
max_width_ = bv_->workWidth();
dim_.wid = max_width_;
dim_.asc = 10;
pair<pit_type, ParagraphMetrics const *> TextMetrics::last() const
{
- LBUFERR(!par_metrics_.empty(), _("Text metrics error."));
+ LBUFERR(!par_metrics_.empty());
ParMetricsCache::const_reverse_iterator it = par_metrics_.rbegin();
return make_pair(it->first, &it->second);
}
bool TextMetrics::metrics(MetricsInfo & mi, Dimension & dim, int min_width)
{
- LBUFERR(mi.base.textwidth > 0, _("Text metrics error."));
+ LBUFERR(mi.base.textwidth > 0);
max_width_ = mi.base.textwidth;
// backup old dimension.
Dimension const old_dim = dim_;
// should be.
bv_->buffer().updateBuffer();
parPos = text_->macrocontextPosition();
- LBUFERR(!parPos.empty(), _("Text metrics error."));
+ LBUFERR(!parPos.empty());
parPos.pit() = pit;
}
Paragraph const & par = text_->getPar(pit);
pos_type last = par.beginOfBody();
- LBUFERR(last > 0, _("Text metrics error."));
+ LBUFERR(last > 0);
// -1 because a label ends with a space that is in the label
--last;
FontIterator & operator++()
{
++pos_;
- if (pos_ > endspan_ || pos_ == bodypos_) {
+ if (pos_ < par_.size() && (pos_ > endspan_ || pos_ == bodypos_)) {
font_ = tm_.displayFont(pit_, pos_);
endspan_ = par_.fontSpan(pos_).last;
}
// upDownInText() while in selection mode.
ParagraphMetrics const & pm = parMetrics(pit);
- LBUFERR(row < int(pm.rows().size()), _("Text metrics error."));
+ LBUFERR(row < int(pm.rows().size()));
bool bound = false;
Row const & r = pm.rows()[row];
return r.pos() + getColumnNearX(pit, r, x, bound);
ParagraphMetrics const & pm = par_metrics_[pit];
int yy = pm.position() - pm.ascent();
- LBUFERR(!pm.rows().empty(), _("Text metrics error."));
+ LBUFERR(!pm.rows().empty());
RowList::const_iterator rit = pm.rows().begin();
RowList::const_iterator rlast = pm.rows().end();
--rlast;
" pit: " << pit << " yy: " << yy);
int r = 0;
- LBUFERR(pm.rows().size(), _("Text metrics error."));
+ LBUFERR(pm.rows().size());
for (; r < int(pm.rows().size()) - 1; ++r) {
Row const & row = pm.rows()[r];
if (int(yy + row.height()) > y)