Skip to content

Commit

Permalink
fix FS#831: unicode characters displayed on top of others
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrew Mustun committed Jun 18, 2013
1 parent bda0029 commit 51ae0e8
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/core/RPainterPathEngine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@ bool RPainterPathEngine::end() {
void RPainterPathEngine::updateState(const QPaintEngineState &state) {
QPaintEngine::DirtyFlags flags = state.state();

// required for Qt >= 4.8.0 for texts with unicode characters:
if (flags & DirtyTransform) {
transform = state.transform();
}

/*
QPaintEngine::DirtyFlags flags = state.state();
if (flags & DirtyPen) updatePen(state.pen());
Expand Down Expand Up @@ -72,6 +77,8 @@ void RPainterPathEngine::drawPath(const QPainterPath& qpath) {
if (state->brush().color().isValid()) {
path.setFixedBrushColor(true);
}
// required for Qt >= 4.8.0 for texts with unicode characters:
path.transform(transform);
paths.append(path);
}

Expand Down
1 change: 1 addition & 0 deletions src/core/RPainterPathEngine.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ class QCADCORE_EXPORT RPainterPathEngine : public QPaintEngine {

private:
QList<RPainterPath> paths;
QTransform transform;
};

#endif
14 changes: 14 additions & 0 deletions src/entity/RTextData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -596,6 +596,20 @@ QString RTextData::toEscapedText(const QTextDocument& textDocument, const RColor
text.replace(RTextRenderer::chPlusMinus, RTextRenderer::escPlusMinus);
// diameter:
text.replace(RTextRenderer::chDiameter, RTextRenderer::escDiameter);
/*
// unicode:
QString t;
for (int k=0; k<text.length(); k++) {
unsigned short c = text[k].unicode();
if (c>255) {
t.append(QString("\\U+%1").arg(c, 4, 16, QChar('0')));
}
else {
t += text[k];
}
}
text = t;
*/
ret += text;
}
}
Expand Down

0 comments on commit 51ae0e8

Please sign in to comment.