<html>
<head>
<meta content="text/html; charset=windows-1252"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
I realized that I was passing a TrueType font file instead of a
FreeType one.<br>
So I downloaded the DejaVu fonts as recommended here:
<a class="moz-txt-link-freetext" href="http://vtkusers.public.kitware.narkive.com/5fy8hSRK/unicode-support">http://vtkusers.public.kitware.narkive.com/5fy8hSRK/unicode-support</a><br>
But it made no difference.<br>
<br>
I also looked at the TestChartUnicode and TextContextUnicode tests
to see how it's done there and I'm doing the same thing.<br>
<br>
So I don't see what's wrong. Anyone have any suggestions?<br>
<br>
Thanks.<br>
<br>
<div class="moz-cite-prefix">On 1/20/2015 12:03 PM, Serge Lalonde
wrote:<br>
</div>
<blockquote cite="mid:54BE8A45.5050702@infolytica.com" type="cite">
<meta content="text/html; charset=windows-1252"
http-equiv="Content-Type">
Hi Sean,<br>
<br>
Thanks for the tips on encoding. I knew that I probably wasn't
using the right terminology and I'll read up on those soon.<br>
<br>
In the meantime, I'm no closer to being able to display "J (A/m2)"
as the title of a vtkScalarBarActor.<br>
<br>
I tried using these APIs on the TitleTextProperty of the
vtkScalarBarActor<br>
<pre> m_VTKScalarBarActor->GetTitleTextProperty()->SetFontFamily(VTK_FONT_FILE);
m_VTKScalarBarActor->GetTitleTextProperty()->SetFontFile("C:\\Windows\\winsxs\\amd64_microsoft-windows-font-truetype-arial_31bf3856ad364e35_6.1.7601.18528_none_d0a29012c3ff391b\\arial.ttf");
</pre>
and then encoding the string to be a sequence of hex escape
sequences like the example here:<br>
<pre> <a moz-do-not-send="true" class="moz-txt-link-freetext" href="http://marc.info/?l=vtkusers&m=138868987612759&w=2">http://marc.info/?l=vtkusers&m=138868987612759&w=2</a>)</pre>
and it just spits out the string as-is, that is something like
"\x4A\x20\x28\x41\x2F\x6D\xC2\xB2\x29".<br>
<br>
Is there a tutorial or a wiki that shows how to use Unicode
strings in VTK? Ideally with the system fonts? What's the magic
formula? ;-)<br>
<br>
Thanks.<br>
<br>
<div class="moz-cite-prefix">On 1/20/2015 11:05 AM, Sean McBride
wrote:<br>
</div>
<blockquote
cite="mid:20150120160547.2004569427@mail.rogue-research.com"
type="cite">
<pre wrap="">On Tue, 20 Jan 2015 10:18:44 -0500, Serge Lalonde said:
</pre>
<blockquote type="cite">
<pre wrap="">I'm upgrading from VTK 5.10.1 to VTK 6.1. All went smoothly until I ran
into an error rendering a vtkScalarBarActor whose title was set to "J (A/m2)".
This worked fine in 5.10.1, but in 6.1, the vtkutf8::is_valid() method
called from vtkUnicodeString::from_utf8() returns false because the
value of "2" is 0xB2 (in the extended ASCII range) but the vtkutf8 code
internally stops at 0x80 (sequence_length() in core.h returns 0). That
in turn causes a debug message "vtkUnicodeString::from_utf8(): not a
valid UTF-8 string." to appear and then other problems with vtkTextActor
not being able to calculate its bounds and so on.
</pre>
</blockquote>
<pre wrap="">I think you are a bit confused about character encodings (it's a confusing thing!).
First, there are no ASCII characters above 127. ASCII is a 7 bit code. What you mean to refer to is ISO-8859-1 aka Latin1. In that encoding, the 'square' character does indeed seem to be 0xB2:
<a moz-do-not-send="true" class="moz-txt-link-rfc2396E" href="https://en.wikipedia.org/wiki/ISO/IEC_8859-1"><https://en.wikipedia.org/wiki/ISO/IEC_8859-1></a>
8859 is not part of Unicode at all and is not the same as UTF-8.
There are many online Unicode tools, ex:
<a moz-do-not-send="true" class="moz-txt-link-rfc2396E" href="http://utf8-chartable.de"><http://utf8-chartable.de></a>
Where you can see the Unicode code point for 'superscript two' is U+00B2, which encoded as UTF-8 is 'c2 b2' in hex.
You might want to read this, which is a helpful classic:
<a moz-do-not-send="true" class="moz-txt-link-rfc2396E" href="http://www.joelonsoftware.com/articles/Unicode.html"><http://www.joelonsoftware.com/articles/Unicode.html></a>
Cheers,
</pre>
</blockquote>
<br>
<div class="moz-signature">-- <br>
<meta http-equiv="content-type" content="text/html;
charset=windows-1252">
<title>Signature</title>
<a moz-do-not-send="true" href="http:://www.infolytica.com">www.infolytica.com
</a><br>
300 Leo Pariseau, Suite 2222, Montreal, QC, Canada, H2X 4B3<br>
(514) 849-8752 x236, Fax: (514) 849-4239 </div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
Powered by <a class="moz-txt-link-abbreviated" href="http://www.kitware.com">www.kitware.com</a>
Visit other Kitware open-source projects at <a class="moz-txt-link-freetext" href="http://www.kitware.com/opensource/opensource.html">http://www.kitware.com/opensource/opensource.html</a>
Please keep messages on-topic and check the VTK FAQ at: <a class="moz-txt-link-freetext" href="http://www.vtk.org/Wiki/VTK_FAQ">http://www.vtk.org/Wiki/VTK_FAQ</a>
Search the list archives at: <a class="moz-txt-link-freetext" href="http://markmail.org/search/?q=vtkusers">http://markmail.org/search/?q=vtkusers</a>
Follow this link to subscribe/unsubscribe:
<a class="moz-txt-link-freetext" href="http://public.kitware.com/mailman/listinfo/vtkusers">http://public.kitware.com/mailman/listinfo/vtkusers</a>
</pre>
</blockquote>
<br>
<div class="moz-signature">-- <br>
<meta http-equiv="content-type" content="text/html;
charset=windows-1252">
<title>Signature</title>
<a href="http:://www.infolytica.com">www.infolytica.com </a><br>
300 Leo Pariseau, Suite 2222, Montreal, QC, Canada, H2X 4B3<br>
(514) 849-8752 x236, Fax: (514) 849-4239
</div>
</body>
</html>