Discussion:
[vtkusers] Unicode support
Michael Xanadu
2013-11-20 17:52:54 UTC
Permalink
Dear Friends,

What is the current state concerning the support of unicode in VTK? E.g. is
it possible to display unicode charcters via vtkCaptionActor2D or
vtkCornerAnnotation? If yes, which requirements do I have to meet (version
etc.)?
I have not found any clear information about the topic via google so far.


Thanks in advance,
Michale
David Lonie
2013-11-20 18:11:01 UTC
Permalink
Hi Michael,

Support for unicode character sets was exposed in VTK master a couple of
months ago. The tricky bit is that you must provide a specific font file,
as the fonts currently embedded in VTK only support ASCII characters (this
will likely change in the future). The current way of enabling unicode
fonts is to configure vtkTextProperty with the desired font file, for
instance:

vtkTextProperty *tprop = ...;
tprop->SetFontFamily(VTK_FONT_FILE);
tprop->SetFontFile("/path/to/some/font/file.ttf");

Do this for the actors that you want unicode for, and the proper glyphs
will be pulled from the supplied font file. This should work everywhere
except for vtkVectorText, which uses an entirely different method of
rendering text.

See TestChartUnicode and TextContextUnicode in the Charts/Core module for
examples.

BTW, I recommend grabbing the DejaVu true type fonts -- they are rather
openly licensed, and they are what we use internally for testing.

Hope this helps,

Dave


On Wed, Nov 20, 2013 at 12:52 PM, Michael Xanadu <
Post by Michael Xanadu
Dear Friends,
What is the current state concerning the support of unicode in VTK? E.g.
is it possible to display unicode charcters via vtkCaptionActor2D or
vtkCornerAnnotation? If yes, which requirements do I have to meet (version
etc.)?
I have not found any clear information about the topic via google so far.
Thanks in advance,
Michale
_______________________________________________
Powered by www.kitware.com
Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html
http://www.vtk.org/Wiki/VTK_FAQ
http://www.vtk.org/mailman/listinfo/vtkusers
Michael Xanadu
2013-11-20 18:56:04 UTC
Permalink
Dear David,

thank you very much for your response. It helps a lot! :)
I'm not really sure, what is "VTK master"? The current 6.0 release? Does
VTK 5.8 or 5.10 also support Unicode?

Michael
Post by David Lonie
Hi Michael,
Support for unicode character sets was exposed in VTK master a couple of
months ago. The tricky bit is that you must provide a specific font file,
as the fonts currently embedded in VTK only support ASCII characters (this
will likely change in the future). The current way of enabling unicode
fonts is to configure vtkTextProperty with the desired font file, for
vtkTextProperty *tprop = ...;
tprop->SetFontFamily(VTK_FONT_FILE);
tprop->SetFontFile("/path/to/some/font/file.ttf");
Do this for the actors that you want unicode for, and the proper glyphs
will be pulled from the supplied font file. This should work everywhere
except for vtkVectorText, which uses an entirely different method of
rendering text.
See TestChartUnicode and TextContextUnicode in the Charts/Core module for
examples.
BTW, I recommend grabbing the DejaVu true type fonts -- they are rather
openly licensed, and they are what we use internally for testing.
Hope this helps,
Dave
On Wed, Nov 20, 2013 at 12:52 PM, Michael Xanadu <
Post by Michael Xanadu
Dear Friends,
What is the current state concerning the support of unicode in VTK? E.g.
is it possible to display unicode charcters via vtkCaptionActor2D or
vtkCornerAnnotation? If yes, which requirements do I have to meet (version
etc.)?
I have not found any clear information about the topic via google so far.
Thanks in advance,
Michale
_______________________________________________
Powered by www.kitware.com
Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html
http://www.vtk.org/Wiki/VTK_FAQ
http://www.vtk.org/mailman/listinfo/vtkusers
David Lonie
2013-11-20 18:58:34 UTC
Permalink
Hi Michael,

On Wed, Nov 20, 2013 at 1:56 PM, Michael Xanadu <
Post by Michael Xanadu
Dear David,
thank you very much for your response. It helps a lot! :)
I'm not really sure, what is "VTK master"? The current 6.0 release? Does
VTK 5.8 or 5.10 also support Unicode?
VTK master refers to the development branch of VTK. You can obtain this
code using the instructions at

http://www.vtk.org/Wiki/VTK/Git

The unicode support was added after 6.0 was released, but it should be
available in the next release.

Dave
Sean McBride
2013-11-20 19:09:54 UTC
Permalink
Post by David Lonie
Support for unicode character sets was exposed in VTK master a couple of
months ago.
Yay! I'll have to give this a try!

Does this all work with vtkTextActor? What character encoding does vtkTextActor->SetInput() require? UTF8? OS dependent?

Cheers,
--
____________________________________________________________
Sean McBride, B. Eng ***@rogue-research.com
Rogue Research www.rogue-research.com
Mac Software Developer Montréal, Québec, Canada
David Lonie
2013-11-20 19:14:03 UTC
Permalink
Post by Sean McBride
Post by David Lonie
Support for unicode character sets was exposed in VTK master a couple of
months ago.
Yay! I'll have to give this a try!
Does this all work with vtkTextActor? What character encoding does
vtkTextActor->SetInput() require? UTF8? OS dependent?
8 bit character strings are treated as UTF8 (and converted internally to
UTF16 during rendering).

Dave

Loading...