Login Page - Create Account

Support Board


Date/Time: Sun, 07 Aug 2022 16:56:36 +0000



[Programming Help] - Potential bug displaying UTF-8 text

View Count: 440

[2021-07-01 22:36:37]
autobahn - Posts: 16
I have the following code that places multiline text on the chart. UTF-8 characters print correctly sometimes but not consistently.

Here is what I would expect to be printed:

1: ␀
2: ┌
3: ⨍
4: ␀ ┌
5: ⨍ ┌
6: ␀ ⨍
7: ␀ ⨍ ┌

Here is what actually prints:
http://www.sierrachart.com/image.php?Image=1625178712716.png


I cannot understand why lines 1, 3, 6 do not display the symbol properly, yet lines 2, 4, 5, 7 are correct. The ⨍ and ␀ characters only print correctly when there is also a ┌ on the same line.

If anybody can reproduce this, or shed any light on what is happening, that would be appreciated.

If I create this as a user drawing, I can right-click and inspect the text properties and I see the correct symbols are there. They just aren't rendering properly on the chart.


// Some attributes removed for clarity

s_UseTool content;
content.AddMethod = UTAM_ADD_OR_ADJUST;
content.DrawingType = DRAWING_STATIONARY_TEXT;
content.MultiLineLabel = 1;
content.Text = "1: \xE2\x90\x80 \n" // ␀
"2: \xE2\x94\x8C \n" // ┌
"3: \xE2\xA8\x8D \n" // ⨍
"4: \xE2\x90\x80 \xE2\x94\x8C \n" // ␀ ┌
"5: \xE2\xA8\x8D \xE2\x94\x8C \n" // ⨍ ┌
"6: \xE2\x90\x80 \xE2\xA8\x8D \n" // ␀ ⨍
"7: \xE2\x90\x80 \xE2\xA8\x8D \xE2\x94\x8C \n"; // ␀ ⨍ ┌
content.FontFace = "Consolas";
sc.UseTool(content);

[2021-07-02 00:07:48]
Sierra_Chart Engineering - Posts: 2870
We will look into this.
Sierra Chart Support - Engineering Level

Your definitive source for support. Other responses are from users. Try to keep your questions brief and to the point. Be aware of support policy:
https://www.sierrachart.com/index.php?l=PostingInformation.php#GeneralInformation

For the most reliable, advanced, and zero cost futures order routing, use the Teton service:
Sierra Chart Teton Futures Order Routing
[2021-07-02 20:57:11]
Jeffrey - Posts: 1895
It looks like those symbols aren't available with that font. I was able to get it to work with FontFace = "Tahoma".

[edit]
Correction: I do see that each symbol used is available within the font, because each symbol is used on line 7. I'm not sure why the symbols only show when there is a Box Drawing glyph in the line.
Date Time Of Last Edit: 2021-07-02 22:27:19
[2021-07-02 22:18:15]
autobahn - Posts: 16
I confirm the characters are available for Consolas because they do display correctly on some of the lines. If they were missing from the font, they would not be unable to display at all.

I have just tried with Tahoma and that works. So it does seem to be font related somehow.

Currently my workaround is to print a spurious ┌ character at the start of each line and then overwrite it to 'hide' it. It is messy, but it works for now.

If you are using standard Windows calls, then I'll put it down to some weird Windows bug. Thanks for looking into this.

To post a message in this thread, you need to log in with your Sierra Chart account:

Login

Login Page - Create Account