<div class="gmail_quote">On Thu, May 13, 2010 at 8:15 AM, Oliver Kania <span dir="ltr"><<a href="mailto:kania.oliver@googlemail.com">kania.oliver@googlemail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Hello,<br><br>I frequently use vtkTextActor within a graphics library I wrote.<br>Is it somehow possible to replace these occurences with a vtkLabelRenderStrategy, maybe within a vtkContextDevice ?<br>The reason I want to do this is simply to enable rendering of unicode characters, more precisely certain characters<br>
that are not within the 7-Bit ascii set which text actor allows.<br><br>The following sample code does not show any text :<br><br>--------------------------------------------------------------------------------<br>vtkRenderWindow *renWin = vtkRenderWindow::New();<br>
renWin->AddRenderer( ren1 );<br> renWin->SetSize( 300, 300 );<br> vtkStdString l_vtkStdStr("Hallo"); <br>float f_coords[] = {50.0f,50.0f};<br><br>l_vtkDevice->Begin(ren1);<br>l_vtkDevice->DrawString(f_coords,l_vtkProp,l_vtkStdStr);<br>
l_vtkDevice->End();<br><br> renWin->GetInteractor()->Render();<br>--------------------------------------------------------------------------------<br><br>I also tried using vtkLabelRenderStrategy directly etc.<br>
</blockquote><div><br></div><div>If you take a look at the vtkLabelRenderStrategy Doxygen documentation,</div><div><br></div><div><a href="http://www.vtk.org/doc/nightly/html/classvtkLabelRenderStrategy.html">http://www.vtk.org/doc/nightly/html/classvtkLabelRenderStrategy.html</a></div>
<div><br></div><div>It has functions such as,</div><div><br></div><div>virtual void RenderLabel (int x[2], vtkTextProperty *tprop, vtkUnicodeString label)</div><div><br></div><div>You will need to use vtkUnicodeString to store unicode characters, but this should work (I haven't had chance to test it out yet). The vtkQtLabelRenderStrategy is likely to work well as Qt handles Unicode rendering really well, and I have used this in the past. I will be adding extra overloads to the vtkContext2D class to take unicode strings in addition to the standard string.</div>
<div><br></div><div>Thanks,</div><div><br></div><div>Marcus</div>--<br clear="all">Marcus D. Hanwell, Ph.D.<br>R&D Engineer, Kitware Inc.<br>(518) 881-4937</div>