How to use a customized font to vtkVectorText

Hello, I want to set some text to vtkVectorText but with Arrial Black font. Can someone tell me how to do this?
I try with vtkTextActor but I can’t use the text as a polydata because I want to use customized text in a boolean operation with another polydata. Thanks in advance.


Unfortunately that class doesn’t use glyphs to generate text geometry like most other text-dealing VTK classes do. Instead, it uses a set of hardcoded polygons to lay out a text-shaped vtkPolyData. In other words, you can’t set a custom font when using vtkVectorText.

You can try a three-fold procedure by, first, using a vtkTextRenderer’s StringToPath() method genereate the text outlines (called a path) with the custom font seetings you want. Then, take the resulting vtkPath and process each of its constituent vtkCells to get the vertexes to make the outline geometry of a vtkPoltData. Finally, you can use a filter like vtkContourTriangulator (which takes a vtkPolyData) to fill the outlines with triangle faces. You have to study the classes’ APIs to engineer a code to convert a vtkPath to a vtkPolyData as I don’t know an existing filter or algorithm that does this.