[vtkusers] Does vtkCaptionActor2D support chinese characters?

Liu_tj tjlp at netease.com
Mon Sep 12 20:58:04 EDT 2016


Hi, Dave,

I am using Activiz .NET. In C#, the string is UTF16 and I convert it to UTF8. And I follow your step. It doesn't work. If I convert to UTF8, the characters are not displayed. If I don't convert, the characters are displayed as ??.

As you said, we need unicode font file. How can I identify the font file is unicode font file.

Thanks




在2016-09-12,"David Lonie" <david.lonie at kitware.com> 写道: -----原始邮件-----
发件人:"David Lonie" <david.lonie at kitware.com>
发送时间:2016年09月12日 星期一
收件人:"Liu_tj" <tjlp at netease.com>
抄送:"vtkusers" <vtkusers at vtk.org>
主题:Re: [vtkusers] Does vtkCaptionActor2D support chinese characters?


On Sun, Sep 11, 2016 at 12:18 PM, Liu_tj <tjlp at netease.com> wrote:

I want to give Chinese text annotation on 3D model.Does vtkCaptionActor2D support chinese characters? If no, what class should I use?



vtkCaptionActor2D will work.


You'll need to provide a unicode font file (the embedded fonts in VTK only support ASCII) via the caption actor's GetCaptionTextProperty:


captionActor->GetCaptionTextProperty()->SetFontFamily(VTK_FONT_FILE);
captionActor->GetCaptionTextProperty()->SetFontFile("/path/to/some/unicode/font/file");


and then encode the caption text as UTF-8.


Hope this helps,
Dave


 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20160913/911f349c/attachment.html>


More information about the vtkusers mailing list