- qp_->setLayoutDirection(Qt::LeftToRight);
- qp_->drawText(x, y, str);
+ setLayoutDirection(Qt::LeftToRight);
+ if (isDrawingEnabled()) {
+ LYXERR(Debug::PAINTING) << "draw " << std::string(str.toUtf8())
+ << " at " << x << "," << y << std::endl;
+ // Qt4 does not display a glyph whose codepoint is the
+ // same as that of a soft-hyphen (0x00ad), unless it
+ // occurs at a line-break. As a kludge, we force Qt to
+ // render this glyph using a one-column line.
+ if (s.size() == 1 && str[0].unicode() == 0x00ad) {
+ QTextLayout adsymbol(str);
+ adsymbol.setFont(fi.font);
+ adsymbol.beginLayout();
+ QTextLine line = adsymbol.createLine();
+ line.setNumColumns(1);
+ line.setPosition(QPointF(0, -line.ascent()));
+ adsymbol.endLayout();
+ line.draw(this, QPointF(x, y));
+ } else
+ drawText(x, y, str);
+ }
+ // Here we use the font width cache instead of
+ // textwidth = fontMetrics().width(str);
+ // because the above is awfully expensive on MacOSX
+ textwidth = fi.metrics->width(str);