1
votes

I have an application that requires the display of unicode strings using a specific lookup-table-esque font.

This font has actual symbols for characters U+0000 to U+0020.

I have no problems building my string from a set of chars. The problem is when I try to set this string to the textbox.

Regardless of the font I choose for the textbox (the special font, or otherwise), when I do "TextBox1.Text = mycrazystring", then check the Text property of TextBox1 (which I just set), I get "", nothing.

Is this because unicode characters U+0000 to U+0020 are unsupported? Do they access functions like newline, tab, or backspace, like I suspect they do when they get placed in the text box?

If I build a string containing characters 0000 through 0023 I expect to see at least an exclamation mark in the TextBox1.Text property after the string is assigned to it, but no dice.

Do I need to make a custom font that shifts my current font by 0020?

1
Have you tried the same string in a richtextbox? - curtisk
For normal Windows text boxes, U+0000 signifies the end of the string. Try replacing it with something else, e.g. U+2400 (␀). - Philipp
Is that what the null character is for? Well that certainly explains things. Thanks! - Gorchestopher H

1 Answers

2
votes

Mapping Unicode characters to unrelated glyphs shouldn't be done. You can end up with lots of problems with text-layout algorithms doing inappropriate things. Mapping the control characters to custom glyphs is crazy; it will certainly confuse UI widgets and many other tools.

Do I need to make a custom font that shifts my current font by 0020?

No, you need to shift it by +E000 or more, into the Private Use Area.