[vtk-developers] vtkVectorText -- to deprecate or not?

David Lonie david.lonie at kitware.com
Tue Oct 16 13:09:29 EDT 2012


Hi list,

I'm writing an (optional) extension to VTK that will override
vtkTextActor with a "smart" math text actor that will switch between
FreeType rendering for plain text and MathText equation rendering for
strings containing MathText markup. The plan is to enable this in
ParaView, so that any visible text field in a RenderView will
automatically have the ability to display equations.

To this end, I've added a vtkSmartMathTextActor and
vtkSmartMathTextActor3D, designed to be drop-in replacements for
vtkTextActor and vtkTextActor3D. Unfortunately, most of the 3D text
rendering in VTK/ParaView is done using vtkVectorText, which is quite
different from the other classes.

While vtkTextActor3D is a stand-alone actor that uses FreeType to
generate a texture which is rendered to the device, vtkVectorText
derives from PolyDataAlgorithm and simply assembles hardcoded
polydata, character by character.

I propose a long-term deprecation period for vtkVectorText, favoring
vtkTextActor3D, for the following reasons:

* Limited supported character set:
    Only ascii codes 33-126 + '\n' are available
* Limited font support:
    Only a single hardcoded sans-serif font is available,
    while FreeType has at least serif, sans-serif, and monospace,
    as well as (optional) font config support for access to
    system fonts.
* No font properties:
    In addition to only a single font family, there is only one
    version of it. vtkVectorText doesn't know anything about
    vtkTextProperty, so bold, italics, justification, linespacing,
    etc, etc are fixed.
* Inflexible for providing custom implementations:
    Polydata output is quite unusual for a text layout engine,
    and producing such is difficult to re-implement.

In short, there just doesn't seem to be much reason for keeping this
class around when there is a much more powerful, easier-to-use
alternative.

While I think there is a strong argument for using vtkTextActor3D
instead of vtkVectorText, perhaps deprecating the class would be
overkill. In that case, I suggest encouraging new code to use the
vtkTextActor3D class, and to start refactoring existing classes (e.g.
vtkAxisActor, etc) to use vtkTextActor3D internally.

Thoughts? Suggestions? Agreement? Disagreement?

Dave



More information about the vtk-developers mailing list