+ Standard_Boolean isInit = Standard_False;
+ if (myHasFlipping)
+ {
+ // Get width and height of text
+ Font_FTFont aFont;
+ Quantity_Color aColor;
+ Standard_CString aName;
+ Standard_Real anExpFactor;
+ Standard_Real aSpace;
+
+ anAsp->Aspect()->Values (aColor, aName, anExpFactor, aSpace);
+ unsigned int aResolution = GetContext()->CurrentViewer()->DefaultRenderingParams().Resolution;
+ if (aFont.Init (aName, anAsp->Aspect()->GetTextFontAspect(), (unsigned int)anAsp->Height(), aResolution))
+ {
+ isInit = Standard_True;
+ const NCollection_String aText ((Standard_Utf16Char* )myText.ToExtString());
+ Font_Rect aBndBox = aFont.BoundingBox (aText, anAsp->HorizontalJustification(), anAsp->VerticalJustification());
+ Standard_Real aWidth = Abs (aBndBox.Width());
+ Standard_Real aHeight = Abs (aBndBox.Height());
+ gp_Pnt aCenterOfLabel = aPosition;
+
+ if (anAsp->VerticalJustification() == Graphic3d_VTA_BOTTOM)
+ {
+ aCenterOfLabel.ChangeCoord() += myOrientation3D.YDirection().XYZ() * aHeight * 0.5;
+ }
+ else if (anAsp->VerticalJustification() == Graphic3d_VTA_TOP)
+ {
+ aCenterOfLabel.ChangeCoord() -= myOrientation3D.YDirection().XYZ() * aHeight * 0.5;
+ }
+ if (anAsp->HorizontalJustification() == Graphic3d_HTA_LEFT)
+ {
+ aCenterOfLabel.ChangeCoord() += myOrientation3D.XDirection().XYZ() * aWidth * 0.5;
+ }
+ else if (anAsp->HorizontalJustification() == Graphic3d_HTA_RIGHT)
+ {
+ aCenterOfLabel.ChangeCoord() -= myOrientation3D.XDirection().XYZ() * aWidth * 0.5;
+ }
+
+ if (!anAsp->Aspect()->GetTextZoomable())
+ {
+ anAsp->Aspect()->SetTextZoomable (Standard_True);
+ SetTransformPersistence (GetTransformPersistenceMode() | Graphic3d_TMF_ZoomPers, aPosition);
+ aPosition = gp::Origin();
+ }
+
+ gp_Ax2 aFlippingAxes (aCenterOfLabel, myOrientation3D.Direction(), myOrientation3D.XDirection());
+ Prs3d_Root::CurrentGroup (thePrs)->SetFlippingOptions (Standard_True, aFlippingAxes);
+ }
+ }
+
+ gp_Ax2 anOrientation = myOrientation3D;
+ anOrientation.SetLocation (aPosition);
+ Prs3d_Text::Draw (thePrs, anAsp, myText, myOrientation3D, !myHasFlipping);
+ if (myHasFlipping && isInit)
+ {
+ Prs3d_Root::CurrentGroup (thePrs)->SetFlippingOptions (Standard_False, gp_Ax2());
+ }