[vtkusers] vtkTextSource vtkfont_bits generation

David Lonie david.lonie at kitware.com
Fri Aug 19 08:53:24 EDT 2016


I'm not sure about vtkfont_bits, I've never had to use it before.

And no, vtkVectorText cannot use characters outside of ASCII codepoints 33-126.

vtkTextActor3D can use any characters desired when supplied with a
vtkTextProperty that has FontFamily=VTK_FONT_FILE and FontFile set to
a font file with the desired characters. See
Rendering/FreeType/TestFreeTypeTextMapperNoMath.cxx:

  // UTF-8 freetype handling:
  vtkNew<vtkTextMapper> mapper10;
  vtkNew<vtkActor2D> actor10;
  actor10->SetMapper(mapper10.GetPointer());
  mapper10->GetTextProperty()->SetFontFile(uncodeFontFile.c_str());
  mapper10->GetTextProperty()->SetFontFamily(VTK_FONT_FILE);
  mapper10->GetTextProperty()->SetJustificationToCentered();
  mapper10->GetTextProperty()->SetVerticalJustificationToCentered();
  mapper10->GetTextProperty()->SetFontSize(18);
  mapper10->GetTextProperty()->SetColor(0.0, 1.0, 0.7);
  mapper10->SetInput("UTF-8 FreeType:
\xce\xa8\xd2\x94\xd2\x96\xd1\x84\xd2\xbe");
  actor10->SetPosition(300, 110);

That uses a vtkTextMapper, but the underlying font rendering uses the
same backend as vtkTextActor3D, and renders the non-english characters
in the UTF-8 string set via SetInput (see attached).

Dave

On Thu, Aug 18, 2016 at 4:43 PM, Шагит Зиганшин
<ziganshinshagit at hotmail.com> wrote:
> And how to use no english characters in vtkVectorText? I'm not sure that
> vtkVectorText3D can use them.
>
>
> 18 авг. 2016 г. 23:34 пользователь "David Lonie" <david.lonie at kitware.com>
> написал:
>>
>> So, do you or someone knows how to vtkfont_bits?
>>
>>
>> 18 авг. 2016 г. 23:34 пользователь "David Lonie" <david.lonie at kitware.com>
>> написал:
>>>
>>> On Thu, Aug 18, 2016 at 4:29 PM, David Lonie <david.lonie at kitware.com>
>>> wrote:
>>> > vtkVectorText only supports a very limited set of fonts and
>>> > characters. I'm not sure how the polydata it uses was generated.
>>>
>>> To elaborate a bit: vtkVectorText does not use the vtkfont_bits, as
>>> far as I'm aware. See vtkVectorText.cxx -- it contains a large number
>>> of static arrays containing polygon descriptions of the glyphs. If you
>>> wish to extend it, you'll need to add more glyphs to this file.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: TestFreeTypeTextMapperNoMath.png
Type: image/png
Size: 3185 bytes
Desc: not available
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20160819/ac1420c6/attachment.png>


More information about the vtkusers mailing list