<div dir="ltr"><div><div><div><div>I am trying to add axes to a window and have an issue to change font size of axis test. The partial code is as following:<br><br> cube = vtkSmartPointer<vtkAnnotatedCubeActor>::New();<br>
cube->SetXPlusFaceText("R");<br> cube->SetXMinusFaceText("L");<br> cube->SetYPlusFaceText("A");<br> cube->SetYMinusFaceText("P");<br> cube->SetZPlusFaceText("I");<br>
cube->SetZMinusFaceText("S");<br> cube->SetXFaceTextRotation(180);<br> cube->SetYFaceTextRotation(180);<br> cube->SetZFaceTextRotation(-90);<br> cube->SetFaceTextScale(0.65);<br><br>
vtkSmartPointer<vtkProperty> cube_property = cube->GetCubeProperty();<br> cube_property->SetColor(0.5, 1, 1);<br><br> cube_property = cube->GetTextEdgesProperty();<br> cube_property->SetLineWidth(1);<br>
cube_property->SetDiffuse(0);<br> cube_property->SetAmbient(1);<br> cube_property->SetColor(0.18, 0.28, 0.23);<br><br> cube_property = cube->GetXPlusFaceProperty();<br> cube_property->SetColor(0,0,1);<br>
cube_property->SetInterpolationToFlat();<br><br> cube_property = cube->GetXMinusFaceProperty();<br> cube_property->SetColor(0,0,1);<br> cube_property->SetInterpolationToFlat();<br><br> cube_property = cube->GetYPlusFaceProperty();<br>
cube_property->SetColor(0,1,0);<br> cube_property->SetInterpolationToFlat();<br><br> cube_property = cube->GetYMinusFaceProperty();<br> cube_property->SetColor(0,1,0);<br> cube_property->SetInterpolationToFlat();<br>
<br> cube_property = cube->GetZPlusFaceProperty();<br> cube_property->SetColor(1,0,0);<br> cube_property->SetInterpolationToFlat();<br><br> cube_property = cube->GetZMinusFaceProperty();<br> cube_property->SetColor(1,0,0);<br>
cube_property->SetInterpolationToFlat();<br><br> axes = vtkSmartPointer<vtkAxesActor>::New();<br> axes->SetShaftTypeToCylinder();<br> axes->SetXAxisLabelText("x");<br> axes->SetYAxisLabelText("y");<br>
axes->SetZAxisLabelText("z");<br> axes->SetTotalLength(1.5, 1.5, 1.5);<br><br> vtkSmartPointer<vtkTextProperty> tprop = vtkSmartPointer<vtkTextProperty>::New();<br> tprop->ItalicOn();<br>
tprop->ShadowOn();<br> tprop->SetFontFamilyToTimes();<br> std::cout << tprop->GetFontSize();<br> tprop->SetFontSize(18);<br> axes->GetXAxisCaptionActor2D()->SetCaptionTextProperty(tprop);<br>
<br> vtkSmartPointer<vtkTextProperty> tprop2 = vtkSmartPointer<vtkTextProperty>::New();<br> tprop2->ShallowCopy(tprop);<br> axes->GetYAxisCaptionActor2D()->SetCaptionTextProperty(tprop2);<br>
<br> vtkSmartPointer<vtkTextProperty> tprop3 = vtkSmartPointer<vtkTextProperty>::New();<br> tprop3->ShallowCopy(tprop);<br> axes->GetZAxisCaptionActor2D()->SetCaptionTextProperty(tprop3);<br>
<br> assembly = vtkSmartPointer<vtkPropAssembly>::New();<br> assembly->AddPart(axes);<br> assembly->AddPart(cube);<br><br> marker = vtkSmartPointer<vtkOrientationMarkerWidget>::New();<br> marker->SetOutlineColor(0.93, 0.57, 0.13);<br>
marker->SetOrientationMarker(assembly);<br><br> iact = renWinImage->GetInteractor();<br> iact_style = vtkSmartPointer<vtkInteractorStyleTrackballCamera>::New();<br> iact->SetInteractorStyle(iact_style);<br>
<br> marker->SetInteractor(iact);<br> marker->SetEnabled(1);<br> marker->InteractiveOff();<br><br> renWinImage->Render();<br><br></div>The font of axes text X, Y and Z looks small. I tried to set up larger font size ( tprop->SetFontSize(18);) and it seems not working. The "std::cout << tprop->GetFontSize();" does not print out the size when the program is started. It shows default size "12" when I close the program. My questions are:<br>
</div>(1) is SetFontSize() the right method to change the font size?<br></div>(2) if it is the right function to use, what I should pay attention to make it effective?<br><br></div>Thanks ahead for any help.<br><div><div>
<div><div><br></div></div></div></div></div>