Skip to content

vtkTextMapper: fix rendering of empty string

Max Smolens requested to merge msmolens/vtk:16071-textmapper-empty-string into master

vtkTextMapper improperly renders empty strings. Instead of rendering nothing, as expected for an empty string, a rectangle is rendered. The rectangle is visible only when the text property's background is not completely transparent.

This commit fixes the problem at two levels: in vtkFreeTypeTools and in vtkTextMapper.

vtkFreeTypeTools now checks for an empty string when rendering to an image. Without this check, rendering an empty string results in the small rectangle.

vtkTextMapper::RenderOverlay() is updated to handle the case of an empty image. This also serves as a revised solution to #15787 (closed):

http://www.vtk.org/Bug/view.php?id=15787

Fixes #16071 (closed):

http://www.vtk.org/Bug/view.php?id=16071

Merge request reports