Drawings SDK Developer Guide > Working with .dwg Files > Working with Entities > Working with Specific Entitites > Working with Text > Working with Single-Line Text > Single-Line Text Special Codes and Unicode Symbols
Single-Line Text Special Codes and Unicode Symbols

There are two ways to insert special characters into a string: use special codes or use Unicode symbols.

Special Codes

To insert special characters which are not present on the keyboard or for overscore text or underscore text, special sequences are used. They are related to string line text (OdDbText) only and begin with two percent signs (%%). A detailed description of these sequences is given below. In the example, pText is a smart pointer to an OdDbText object.

%%o

Make the single-line text overscoring or not overscoring. For example:


pText->setTextString(L"%%oSingle-line%%o text");

%%u

Make the single-line text underscoring or not underscoring. For example:


pText->setTextString(L"%%uSingle-line%%u text");

Also, overscoring and underscoring can be used at the same time. Both turn off automatically at the end of the single-line text. For example:


pText->setTextString(L"%%o%%uSingle-line text");

%%nnn

This special code draws a character by its number nnn. In the example below, the sequence %%065 draws character 'A' at the beginning of the string:


pText->setTextString(L"%%065 Single-line text");

The %%nnn special sequence can be used for displaying special characters using PostScript fonts.

%%d

Draws a degree symbol (°). For example:


pText->setTextString(L"12.75%%d");

%%p

This special code draws a plus/minus tolerance symbol (±). For example:


pText->setTextString(L"12.75%%p.2");

%%c

This special code draws a circle diameter dimensioning symbol (Ø). For example:


pText->setTextString(L"%%c12.75");

%%%

Use this special code to draw a single percent sign (%). For example:


pText->setTextString(L"12.75%%%");

The Euro Symbol

The euro symbol can be used with SHX fonts and their TrueType equivalent fonts. If this symbol is not on a keyboard, hold down the Alt key and enter 0128 on the numeric keypad. The euro symbol will automatically appear in the current position of a single-line text's cursor. For example:


pText->setTextString(L"12.75€");

Unicode Symbols

To insert the degree symbol, plus/minus tolerance symbol, and the diameter symbol, Unicode character strings can be used. These strings are related to all strings in all objects and must be preceded by a backslash (\): \U+xxxx.

Note: In C/C++, "\" symbol is also a special character. Therefore, in C++ to insert a single string "\", use "\\" which actually represents a single "\".

The list of Unicode character strings is described below.

U+00B0

Degree symbol (°). For example:


pText->setTextString(L"12.75\\U+00B0");

U+2205

Diameter symbol (Ø). For example:


pText->setTextString(L"\\U+2205 12.75");

U+00B1

The plus/minus tolerance symbol (±). For example:


pText->setTextString(L"12.75\\U+00B1.2");

See Also

Working with Single-Line Text

Specific Single-Line Text Properties

Single-Line Text Alignment Properties

Example of Working with the Single-Line Text Object

Copyright © 2002 – 2020. Open Design Alliance. All rights reserved.