diff --git a/src/Mod/TechDraw/App/DrawViewDimension.cpp b/src/Mod/TechDraw/App/DrawViewDimension.cpp index 869f8e62f..4779e38f1 100644 --- a/src/Mod/TechDraw/App/DrawViewDimension.cpp +++ b/src/Mod/TechDraw/App/DrawViewDimension.cpp @@ -198,7 +198,7 @@ App::DocumentObjectExecReturn *DrawViewDimension::execute(void) std::string DrawViewDimension::getFormatedValue() const { - QString str = QString::fromUtf8(FormatSpec.getStrValue().c_str()); + QString str = QString::fromUtf8(FormatSpec.getStrValue().data(),FormatSpec.getStrValue().size()); double val = std::abs(getDimValue()); Base::Quantity qVal; @@ -210,7 +210,7 @@ std::string DrawViewDimension::getFormatedValue() const } QString userStr = qVal.getUserString(); - QRegExp rx(QString::fromAscii("%(\\w+)%")); //any word bracketed by % + QRegExp rx(QString::fromUtf8("%(\\w+)%")); //any word bracketed by % QStringList list; int pos = 0; @@ -220,12 +220,12 @@ std::string DrawViewDimension::getFormatedValue() const } for(QStringList::const_iterator it = list.begin(); it != list.end(); ++it) { - if(*it == QString::fromAscii("%value%")){ + if(*it == QString::fromUtf8("%value%")){ str.replace(*it,userStr); // } else { //insert additional placeholder replacement logic here } } - return str.toStdString(); + return str.toUtf8().constData(); } double DrawViewDimension::getDimValue() const diff --git a/src/Mod/TechDraw/Gui/CommandCreateDims.cpp b/src/Mod/TechDraw/Gui/CommandCreateDims.cpp index 6e5af062f..966dee3a1 100644 --- a/src/Mod/TechDraw/Gui/CommandCreateDims.cpp +++ b/src/Mod/TechDraw/Gui/CommandCreateDims.cpp @@ -237,7 +237,7 @@ void CmdTechDrawNewDimension::activated(int iMsg) std::string contentStr; if (dimType == "Radius") { - contentStr = "r%value%"; + contentStr = "R%value%"; } doCommand(Doc,"App.activeDocument().%s.FormatSpec = '%s'",FeatName.c_str() ,contentStr.c_str()); @@ -332,7 +332,7 @@ void CmdTechDrawNewRadiusDimension::activated(int iMsg) doCommand(Doc,"App.activeDocument().%s.CentreLines = False", FeatName.c_str()); } - doCommand(Doc, "App.activeDocument().%s.FormatSpec = 'r%%value%%'", FeatName.c_str()); + doCommand(Doc, "App.activeDocument().%s.FormatSpec = 'R%%value%%'", FeatName.c_str()); dim = dynamic_cast(getDocument()->getObject(FeatName.c_str())); dim->References2D.setValues(objs, subs); @@ -425,7 +425,7 @@ void CmdTechDrawNewDiameterDimension::activated(int iMsg) doCommand(Doc,"App.activeDocument().%s.CentreLines = False", FeatName.c_str()); } - doCommand(Doc, "App.activeDocument().%s.FormatSpec = '\u00d8%%value%%'", FeatName.c_str()); // \u00d8 is Capital O with stroke + doCommand(Doc, "App.activeDocument().%s.FormatSpec = '\u2300%%value%%'", FeatName.c_str()); dim = dynamic_cast(getDocument()->getObject(FeatName.c_str())); dim->References2D.setValues(objs, subs); diff --git a/src/Mod/TechDraw/Gui/QGIViewDimension.cpp b/src/Mod/TechDraw/Gui/QGIViewDimension.cpp index d3e52824e..4cfd663b5 100644 --- a/src/Mod/TechDraw/Gui/QGIViewDimension.cpp +++ b/src/Mod/TechDraw/Gui/QGIViewDimension.cpp @@ -240,11 +240,10 @@ void QGIViewDimension::updateDim() return; const TechDraw::DrawViewDimension *dim = dynamic_cast(getViewObject()); - QString labelText = QString::fromStdString(dim->getFormatedValue()); - + QString labelText = QString::fromUtf8(dim->getFormatedValue().data(),dim->getFormatedValue().size()); QFont font = datumLabel->font(); font.setPointSizeF(dim->Fontsize.getValue()); //scene units (mm), not points - font.setFamily(QString::fromAscii(dim->Font.getValue())); + font.setFamily(QString::fromUtf8(dim->Font.getValue())); datumLabel->setPlainText(labelText); datumLabel->setFont(font); @@ -411,7 +410,10 @@ void QGIViewDimension::draw() // Get magnitude of angle between dir and horizontal float angle = atan2f(dir.y,dir.x); - if (angle > M_PI_2+M_PI/12) { + //Vertical text should be legible from the right + if (std::abs(angle + M_PI/2.0) < FLT_EPSILON) { + //noop + } else if (angle > M_PI_2+M_PI/12) { //keeps some diagonal dims from turning upside down? angle -= (float)M_PI; } else if (angle <= -M_PI_2+M_PI/12) { angle += (float)M_PI;