[vtkusers] Displaying the degree symbol "\u00B0" in vtkCornerAnnotation

David Lonie david.lonie at kitware.com
Wed Oct 22 11:36:28 EDT 2014

Hi Alok,

As for the differences between vtkCornerAnnotation and vtkTextActor,
vtkCornerAnnotation uses the vtkTextMapper under the covers, which hasn't
seen as much attention lately as the other classes.

I don't have time at the moment to track down why the "\u00b0" literal is
getting garbled, but I did notice that using "\xb0" instead seems to be
work fine. It seems to be something screwy in the utf8 --> utf16 conversion
before rendering...

Try using "\xb0" instead and let me know if that works for you.

Hope this helps,

On Tue, Oct 21, 2014 at 5:04 PM, Alok <alok.theanomaly at gmail.com> wrote:

> I cloned the git repo some time time back and built from source
> The vtkTextActor/vtkTextWidget seem to be working fine with unicode but I
> see some other problems which make them unusable for me.
> Any recommendations on how to check the difference between
> vtkCornerAnnotation and the vtkTextActor will be great. Seems like an easy
> fix
> Thanks
> On Tue, Oct 21, 2014 at 4:49 PM, Sean McBride <sean at rogue-research.com>
> wrote:
>> On Tue, 21 Oct 2014 12:46:15 -0400, Alok said:
>> >I have been trying for a while to display a degree symbol in
>> >vtkCornerAnnotation.
>> >
>> >The way I am trying to do it is like this:
>> >std;:string angle = computeAngle()+"\u00B0";
>> >cornerAnnotation->SetText(3,angle.c_str()); //where cornerAnnotation if
>> of
>> >type vtkCornerAnnotation.
>> >
>> >This displays something like 50° rather than 50°
>> >When I display the string on a terminal it works as expected.
>> In the past, VTK hasn't had very good Unicode support.  I'm not sure
>> where it stands today actually.  What version of VTK are you using?  You'll
>> have the best results with the newest version I expect.
>> Cheers,
>> --
>> ____________________________________________________________
>> Sean McBride, B. Eng                 sean at rogue-research.com
>> Rogue Research                        www.rogue-research.com
>> Mac Software Developer              Montréal, Québec, Canada
> --
> I live a simple life...  in 0s and 1s !
> _______________________________________________
> Powered by www.kitware.com
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
> Please keep messages on-topic and check the VTK FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/vtkusers
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20141022/53d77cfa/attachment.html>

More information about the vtkusers mailing list