X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2FTextMetrics.cpp;h=4e70dc0b82091b5b207a45e49d8f3c43d648796d;hb=4db3e641ed6765e005343010cb90ee8af26f8f99;hp=12b560760e6091199bd57c94f9f59a24eb77dd26;hpb=1b1f8dd235ba8e168348cd23c824063f2595a0c5;p=lyx.git diff --git a/src/TextMetrics.cpp b/src/TextMetrics.cpp index 12b560760e..4e70dc0b82 100644 --- a/src/TextMetrics.cpp +++ b/src/TextMetrics.cpp @@ -129,7 +129,7 @@ static int numberOfHfills(Paragraph const & par, Row const & row) 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; @@ -159,7 +159,7 @@ pair TextMetrics::first() const pair 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); } @@ -180,7 +180,7 @@ ParagraphMetrics & TextMetrics::parMetrics(pit_type pit, bool redo) 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_; @@ -417,7 +417,7 @@ bool TextMetrics::redoParagraph(pit_type const pit) // should be. bv_->buffer().updateBuffer(); parPos = text_->macrocontextPosition(); - LBUFERR(!parPos.empty(), _("Text metrics error.")); + LBUFERR(!parPos.empty()); parPos.pit() = pit; } @@ -693,7 +693,7 @@ int TextMetrics::labelFill(pit_type const pit, Row const & row) const 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; @@ -771,7 +771,7 @@ public: 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; } @@ -1343,7 +1343,7 @@ pos_type TextMetrics::x2pos(pit_type pit, int row, int x) const // 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); @@ -1446,7 +1446,7 @@ Row const & TextMetrics::getPitAndRowNearY(int & y, pit_type & pit, 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; @@ -1557,7 +1557,7 @@ void TextMetrics::setCursorFromCoordinates(Cursor & cur, int const x, int const " 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)