KevinM
KevinM

Reputation: 29

Using superscripts in C++Builder

C++Builder 10.4.2

Putting text into a label with Tahoma font, I use "lbf/in" + AnsiString((wchar_t)178) to add a '2' superscript, according to Tahoma char tables.

"inch of H" + AnsiString((wchar_t)8322) + "O" should give a superscript 2, but it just gives a normal 2.

In Word, if I type ALT+ 8+3+2+2, I get a superscript 2, as expected.

Am I missing something in C++Builder?

Upvotes: 0

Views: 114

Answers (1)

Roger Cigol
Roger Cigol

Reputation: 183

By converting your wchar_t to an AnsiString, you get an ANSI (8 bit) value, and hence lose all your Unicode information.

You need to just use the String type instead, which maps to UnicodeString:

String Text = _D("lbf/in") + String((wchar_t)178);

Upvotes: 3

Related Questions