]> OCCT Git - occt-copy.git/commitdiff
0030537: Visualization - wrapping text in font text formatter
authornds <nds@opencascade.com>
Tue, 5 Mar 2019 15:51:12 +0000 (18:51 +0300)
committernds <nds@opencascade.com>
Tue, 5 Mar 2019 15:52:54 +0000 (18:52 +0300)
#corners should be arranged around (0,0) point, example of the first point if rect width is 100, symbol has an empty width:
# - left alignment: (-50, 0)
# - center alignment: (0, 0)
# - right alignment: (50, 0)

(cherry picked from commit 3ae32a0a4e0fea48e00947c1761f60a0e123e45e)

src/Font/Font_TextFormatter.cxx

index 108b93fc7e4f735da33c023405b90743e9a04d04..350517aae1ef3a7a405db83c9f3a2a9c9ac4bd08 100644 (file)
@@ -193,8 +193,8 @@ void Font_TextFormatter::newLine (const Standard_Integer theLastRect,
   {
     default:
     case Graphic3d_HTA_LEFT:   myMoveVec.x() = -aXMin; break;
-    case Graphic3d_HTA_RIGHT:  myMoveVec.x() = -aXMin +        (theMaxLineWidth - (aXMax - aXMin)); break;
-    case Graphic3d_HTA_CENTER: myMoveVec.x() = -aXMin + 0.5f * (theMaxLineWidth - (aXMax - aXMin)); break;
+    case Graphic3d_HTA_RIGHT:  myMoveVec.x() = -aXMin +        (theMaxLineWidth - (aXMax - aXMin)) - theMaxLineWidth; break;
+    case Graphic3d_HTA_CENTER: myMoveVec.x() = -aXMin + 0.5f * (theMaxLineWidth - (aXMax - aXMin)) - 0.5 * theMaxLineWidth; break;
   }
 
   move (myCorners, myMoveVec, myRectLineStart, theLastRect);