<div dir="ltr"><div>I have not used vtkAnnotatedCubeActor so I might be wrong, but VTK often scales the text, so its siuze is unrelated to font size, which only defines how the text is rendered.<br><br>Have you tried to use SetFaceTextScale? This might do what you wanted.<br>
<br></div>Alex<br></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Mon, May 6, 2013 at 10:33 AM, tony zhang <span dir="ltr"><<a href="mailto:tonyzhang0985@gmail.com" target="_blank">tonyzhang0985@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><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>
<br>_______________________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the VTK FAQ at: <a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers</a><br>
<br></blockquote></div><br></div>