[vtkusers] vtkCaptionActor2D text appears chopped

Roberto Garrido rgarrido at emedica.es
Thu Feb 7 10:46:18 EST 2013


Thanks Dave,

 

We are using Vtk 5.10.0.

Is there any way to solve it without switching to development branch?

 

My best,

Robert.

 

 

De: David Lonie [mailto:david.lonie at kitware.com] 
Enviado el: jueves, 07 de febrero de 2013 16:33
Para: Roberto Garrido
CC: vtkusers at vtk.org
Asunto: Re: [vtkusers] vtkCaptionActor2D text appears chopped

 

Hi Roberto,

 

We've recently fixed a number of bugs in the text rendering code in the
development branch. I'm adding your test case to our regression tests to
check if we still see this with the new rendering backend.

 

Which version of VTK are you seeing this in?

 

Dave

 

On Thu, Feb 7, 2013 at 9:37 AM, Roberto Garrido <rgarrido at emedica.es> wrote:

Hi,

 

We have added a vtkCaptionActor2D to our scene, but the text appears
chopped, and we don't know why.

A simple and compilable example that shows the output text chopped is sent
attached.  Also, an screenshot at the bottom.

Could anyone try to reproduce the error?

 

 

Thanks in advance.

My best,

Robert.

 

#include <vtkPolyDataMapper.h>

#include <vtkActor.h>

#include <vtkRenderWindow.h>

#include <vtkRenderer.h>

#include <vtkRenderWindowInteractor.h>

#include <vtkPolyData.h>

#include <vtkSmartPointer.h>

#include <vtkSphereSource.h>

#include <vtkCaptionWidget.h>

#include <vtkCaptionRepresentation.h>

#include <vtkCaptionActor2D.h>

#include <vtkTextActor.h>

#include <vtkTextProperty.h>

 

#include <sstream>

 

int main(int, char *[])

{

  // A renderer and render window

  vtkSmartPointer<vtkRenderer> renderer = 

    vtkSmartPointer<vtkRenderer>::New();

  vtkSmartPointer<vtkRenderWindow> renderWindow = 

    vtkSmartPointer<vtkRenderWindow>::New();

  renderWindow->AddRenderer(renderer);

  // An interactor

  vtkSmartPointer<vtkRenderWindowInteractor> renderWindowInteractor = 

    vtkSmartPointer<vtkRenderWindowInteractor>::New();

  renderWindowInteractor->SetRenderWindow(renderWindow);

  // Draw text with diameter measure

  std::stringstream stream;

  int id = 2;

  stream << "(" << id << ") "  << std::fixed << std::setprecision(2) <<
2.2666;

 

  vtkSmartPointer<vtkCaptionActor2D> sectionTextActor =
vtkCaptionActor2D::New();

  sectionTextActor->SetAttachmentPoint( 0, 0, 0 );

  sectionTextActor->SetCaption( stream.str().c_str() );

  sectionTextActor->BorderOff();

  sectionTextActor->LeaderOff();

 sectionTextActor->SetPadding(0);

  sectionTextActor->GetCaptionTextProperty()->SetJustificationToLeft();

  sectionTextActor->GetCaptionTextProperty()->ShadowOff();

  sectionTextActor->GetCaptionTextProperty()->ItalicOff();  

  sectionTextActor->GetCaptionTextProperty()->SetFontFamilyToCourier();

  sectionTextActor->GetCaptionTextProperty()->SetFontSize( 24 );

  sectionTextActor->GetTextActor()->SetTextScaleModeToNone();

 

  renderer->AddActor2D( sectionTextActor );

  renderer->SetBackground(1,0,0);

  renderWindow->Render();

  // Begin mouse interaction

  renderWindowInteractor->Start();

  return EXIT_SUCCESS;

}

 

 




_______________________________________________
Powered by 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/20130207/4568552b/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: image/png
Size: 10822 bytes
Desc: not available
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20130207/4568552b/attachment.png>


More information about the vtkusers mailing list