[vtkusers] Bug in vtkTextActor for accentuated characters?
pof
jd379252 at gmail.com
Wed Sep 8 07:18:35 EDT 2010
Hi Roger,
I applied your patch to vtk5.6.0, and this fully solve the shadow
problem, great!
Still I 've got this problem with accuentuated characters (which of
course was your patch was aiming to solve). If I understand well your
reponse, this is already solved in the dev branch, am I correct?
Pof
Le 06/09/2010 08:52, Roger Bramon Feixas a écrit :
> Hi Pof,
>
> Since VTK 5.2.0, vtkTextActor is rendered using glyphs instead of
> OpenGL. I also had that problem but it was solved in that commit
> http://vtk.org/gitweb?p=VTK.git;a=commit;h=331a44656276882766248c1f8e338434b40226ef
> when UTF8 text rendering was enabled. It's after VTK 5.6 was released.
>
> On the other hand, I suppose you still have problems rendering text
> with shadow, as you reported in that issue:
> http://vtk.org/Bug/view.php?id=9618. I tried to solve it and I
> attached a patch in that issue waiting for feedback. It would be
> wonder if you could test it and let me know if it works well.
>
> Thanks,
>
> Roger
>
>
> On Fri, Sep 3, 2010 at 2:12 PM, Pof <jd379252 at gmail.com
> <mailto:jd379252 at gmail.com>> wrote:
>
> Hi all,
>
> I am having trouble displaying accentuated characters in
> vtkTextActor with vtk5.6.0 under MS-VC++2005.
> Here below is an exemple that reproduces the problem, by printing
> the same string than contains accents "é,è,à".
> When I run this small prog, as a result I obtain that accentuated
> characters (é,è...) are :
> - correctly displayed when used in a vtkScalarBarActor title,
> - not displayed when incorporated in vtkTextActor.
>
> Any idea where does this come from and how to solve it?
>
> As an additional comment, this used to work correctly under
> vtk5.0.x, it is only broken from vtk5.2.x up to vtk5.6.0.
>
> Thanks
> JD
>
>
> //////////////////////////////////////////////////////
> ////////////////// vtkTextActor bug //////////////////
> //////////////////////////////////////////////////////
> #include "vtkActor.h"
> #include "vtkRenderer.h"
> #include "vtkRenderWindow.h"
> #include "vtkRenderWindowInteractor.h"
> #include "vtkCamera.h"
> #include "vtkTextProperty.h"
> #include "vtkTextActor.h"
> #include "vtkActor2D.h"
> #include "vtkLookupTable.h"
> #include "vtkScalarBarActor.h"
>
> int main()
> {
> // Tested string
> char text[] = "Test: é, è, à";
>
> // Create an example text actor
> vtkTextActor *textActor = vtkTextActor::New();
> textActor->SetInput(text);
>
> textActor->GetPositionCoordinate()->SetCoordinateSystemToNormalizedViewport();
> textActor->SetPosition(0.50,0.50);
> textActor->GetTextProperty()->SetFontSize(30);
> textActor->GetTextProperty()->SetJustificationToCentered();
> textActor->GetTextProperty()->SetColor(1, 0, 0);
>
> // Create a Lut
> vtkLookupTable *Lut = vtkLookupTable::New();
> Lut->SetHueRange (160.0/240.0, 0.0);
> Lut->SetSaturationRange (1.0, 1.0);
> Lut->SetValueRange (1.0, 1.0);
> Lut->SetTableRange (0,100);
> Lut->Build();
>
> // Create a ScalarBarActor
> vtkScalarBarActor *scalarBar = vtkScalarBarActor::New();
> scalarBar->SetTitle(text);
> scalarBar->SetLookupTable(Lut);
> scalarBar->SetHeight(0.5);
> scalarBar->SetWidth(0.1);
> scalarBar->SetPosition(0.10,0.01);
> scalarBar->SetPosition2(0.80,0.1);
> scalarBar->SetOrientationToHorizontal();
>
> // Create the graphics structure
> vtkRenderer *ren = vtkRenderer::New();
> vtkRenderWindow *renWin = vtkRenderWindow::New();
> renWin->AddRenderer(ren);
> renWin->SetSize(600, 600);
> vtkRenderWindowInteractor *iren =
> vtkRenderWindowInteractor::New();
> iren->SetRenderWindow(renWin);
>
> // Add the actors to the renderer, set the background and size
> ren->AddActor(textActor);
> ren->AddActor(scalarBar);
> ren->SetBackground(0.1, 0.2, 0.4);
> ren->ResetCamera();
> ren->GetActiveCamera()->Zoom(1.0);
> renWin->Render();
>
> // Starts the event loop
> iren->Start();
>
> // Do some cleaning
> textActor->Delete();
> Lut->Delete();
> scalarBar->Delete();
> ren->Delete();
> renWin->Delete();
> iren->Delete();
>
> return 0;
> }
>
> _______________________________________________
> Powered by www.kitware.com <http://www.kitware.com>
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20100908/c0d82f6f/attachment.htm>
More information about the vtkusers
mailing list