pen.setColor(col);
switch (ls) {
- case line_solid: pen.setStyle(Qt::SolidLine); break;
- case line_onoffdash: pen.setStyle(Qt::DotLine); break;
+ case line_solid:
+ case line_solid_aliased:
+ pen.setStyle(Qt::SolidLine); break;
+ case line_onoffdash:
+ pen.setStyle(Qt::DotLine); break;
}
pen.setWidth(lw);
setQPainterPen(computeColor(col), ls, lw);
bool const do_antialiasing = renderHints() & TextAntialiasing
- && x1 != x2 && y1 != y2;
+ && x1 != x2 && y1 != y2 && ls != line_solid_aliased;
setRenderHint(Antialiasing, do_antialiasing);
drawLine(x1, y1, x2, y2);
setRenderHint(Antialiasing, false);
if (np > points.size())
points.resize(2 * np);
+ // Note: the proper way to not get blurry vertical and horizontal lines is
+ // to add 0.5 to all coordinates.
bool antialias = false;
for (int i = 0; i < np; ++i) {
points[i].setX(xp[i]);
QColor const color = computeColor(col);
setQPainterPen(color, ls, lw);
bool const text_is_antialiased = renderHints() & TextAntialiasing;
- setRenderHint(Antialiasing, antialias && text_is_antialiased);
+ setRenderHint(Antialiasing,
+ antialias && text_is_antialiased && ls != line_solid_aliased);
if (fs == fill_none) {
drawPolyline(points.data(), np);
} else {
QColor const color = computeColor(col);
setQPainterPen(color, ls, lw);
bool const text_is_antialiased = renderHints() & TextAntialiasing;
- setRenderHint(Antialiasing, text_is_antialiased);
+ setRenderHint(Antialiasing, text_is_antialiased && ls != line_solid_aliased);
drawPath(bpath);
if (fs != fill_none)
fillPath(bpath, QBrush(color));
int textwidth = 0;
if (tw == 0.0)
// Note that we have to take in account space stretching (word spacing)
- textwidth = fm.width(s) + count(s.begin(), s.end(), ' ') * wordspacing;
+ textwidth = fm.width(s) +
+ static_cast<int>(fm.countExpanders(s) * wordspacing);
else
textwidth = static_cast<int>(tw);
return;
}
- // don't use the pixmap cache,
- do_drawText(x, y, str, dir, f, ff);
+ // don't use the pixmap cache
+ setQPainterPen(computeColor(f.realColor()));
+ if (dir != Auto) {
+ QTextLayout const * ptl = fm.getTextLayout(s, dir == RtL, wordspacing);
+ ptl->draw(this, QPointF(x, y - fm.maxAscent()));
+ }
+ else {
+ if (font() != ff)
+ setFont(ff);
+ drawText(x, y, str);
+ }
//LYXERR(Debug::PAINTING, "draw " << string(str.toUtf8())
// << " at " << x << "," << y);
}