diff --git a/src/BufferView.cpp b/src/BufferView.cpp index b3009da16a..cec416633d 100644 --- a/src/BufferView.cpp +++ b/src/BufferView.cpp @@ -1547,11 +1547,11 @@ void BufferView::draw(frontend::Painter & pain) LYXERR(Debug::PAINTING) << "\t\t*** START DRAWING ***" << endl; Text & text = buffer_.text(); TextMetrics const & tm = text_metrics_[&text]; + int y = metrics_info_.y1 + tm.parMetrics(metrics_info_.p1).ascent(); if (!pi.full_repaint) - tm.drawParagraph(pi, metrics_info_.p1, 0, - metrics_info_.y1 + tm.parMetrics(metrics_info_.p1).ascent()); + tm.drawParagraph(pi, metrics_info_.p1, 0, y); else - tm.draw(pi, 0, metrics_info_.y1); + tm.draw(pi, 0, y); LYXERR(Debug::PAINTING) << "\n\t\t*** END DRAWING ***" << endl; // and grey out above (should not happen later) diff --git a/src/TextMetrics.cpp b/src/TextMetrics.cpp index 2c6ec96c6d..f9c533e7e3 100644 --- a/src/TextMetrics.cpp +++ b/src/TextMetrics.cpp @@ -1806,6 +1806,7 @@ void TextMetrics::draw(PainterInfo & pi, int x, int y) const ParMetricsCache::const_iterator it = par_metrics_.begin(); ParMetricsCache::const_iterator const pm_end = par_metrics_.end(); + y -= it->second.ascent(); for (; it != pm_end; ++it) { ParagraphMetrics const & pmi = it->second; y += pmi.ascent(); diff --git a/src/insets/InsetCaption.cpp b/src/insets/InsetCaption.cpp index 3505728c93..7b25e463d1 100644 --- a/src/insets/InsetCaption.cpp +++ b/src/insets/InsetCaption.cpp @@ -163,8 +163,7 @@ void InsetCaption::draw(PainterInfo & pi, int x, int y) const labelwidth_ = pi.pain.text(x, y, full_label_, pi.base.font); // add some space to separate the label from the inset text labelwidth_ += 2 * TEXT_TO_INSET_OFFSET; - int const ty = y - ascent() + TEXT_TO_INSET_OFFSET; - InsetText::draw(pi, x + labelwidth_, ty); + InsetText::draw(pi, x + labelwidth_, y); setPosCache(pi, x, y); } diff --git a/src/insets/InsetCollapsable.cpp b/src/insets/InsetCollapsable.cpp index 47c55fe110..bec8c17c80 100644 --- a/src/insets/InsetCollapsable.cpp +++ b/src/insets/InsetCollapsable.cpp @@ -267,8 +267,7 @@ void InsetCollapsable::draw(PainterInfo & pi, int x, int y) const button_dim.y2 = 0; } - TextMetrics const & tm = pi.base.bv->textMetrics(&text_); - int const baseline = y - tm.ascent(); + int const baseline = y; int textx, texty; switch (geometry()) { case LeftButton: diff --git a/src/insets/InsetTabular.cpp b/src/insets/InsetTabular.cpp index d2a125c2eb..ff89ddd931 100644 --- a/src/insets/InsetTabular.cpp +++ b/src/insets/InsetTabular.cpp @@ -3015,7 +3015,6 @@ void InsetTabular::draw(PainterInfo & pi, int x, int y) const int const a = tabular.rowAscent(i); int const d = tabular.rowDescent(i); idx = tabular.cellIndex(i, 0); - int const cy = y - a; for (col_type j = 0; j < tabular.columnCount(); ++j) { if (tabular.isPartOfMultiColumn(i, j)) continue; @@ -3028,11 +3027,11 @@ void InsetTabular::draw(PainterInfo & pi, int x, int y) const || y + d < 0 || y - a > bv->workHeight()) { pi.pain.setDrawingEnabled(false); - cell(idx)->draw(pi, cx, cy); + cell(idx)->draw(pi, cx, y); drawCellLines(pi.pain, nx, y, i, idx, pi.erased_); pi.pain.setDrawingEnabled(true); } else { - cell(idx)->draw(pi, cx, cy); + cell(idx)->draw(pi, cx, y); drawCellLines(pi.pain, nx, y, i, idx, pi.erased_); } nx += tabular.columnWidth(idx); diff --git a/src/insets/InsetText.cpp b/src/insets/InsetText.cpp index d6a01cc607..ebd2f38734 100644 --- a/src/insets/InsetText.cpp +++ b/src/insets/InsetText.cpp @@ -191,9 +191,9 @@ void InsetText::draw(PainterInfo & pi, int x, int y) const int const a = border_; int const h = a + tm.height() + border_; if (pi.full_repaint) - pi.pain.fillRectangle(x, y - a, w, h, backgroundColor()); + pi.pain.fillRectangle(x, y - a - tm.ascent(), w, h, backgroundColor()); if (drawFrame_) - pi.pain.rectangle(x, y - a, w, h, frameColor()); + pi.pain.rectangle(x, y - a - tm.ascent(), w, h, frameColor()); } tm.draw(pi, x + border_, y); }