Drawings SDK Developer Guide > Working with .dwg Files > Working with Databases > Working with Database Containers > Working with Predefined Tables of Named Records > Working with Specific Predefined Tables of Named Records > Text Styles Table > Specific Properties of Text Styles
Specific Properties of Text Styles

A text style uses text direction, text orientation, letter side, width scale factor, height scale factor, and oblique angle to define the typeface of characters for a text object or text associated with a different object.

In the examples below, the pTextStyle variable stores a pointer to the text style record object.

Direction Typeface

The direction typeface determines whether text is drawn backward or forward. The text style defines this property as a Boolean value which is True when the text is backward or False when the text is forward. The value is False (Forward) by default.

To check the direction, use the isBackwards() method; it does not have arguments and returns the direction typeface as a Boolean value. For example:


odPrintConsoleString(L"\nText is %s", (pTextStyle->isBackwards()) ? L"backward" : L"forward");

To switch the direction, use the setIsBackwards() method; it requires one argument — the direction typeface as a Boolean value — and does not return a value. For example:


// Set the backward text
pTextStyle->setIsBackwards(true);

// Set the forward text
pTextStyle->setIsBackwards(false);

Letter Side Typeface

The letter side typeface determines whether letters are placed up or down relative to the baseline when text is drawn. The text style defines this property as a Boolean value which is True when letters are placed up relative to the baseline or False when letters are placed upside down relative to baseline. The value is False (Upside) by default.

To check the letter side, use the isUpsideDown() method; it does not have arguments and returns the letter side typeface as a Boolean value. For example:


odPrintConsoleString(L"\nText is %s", (pTextStyle->isUpsideDown()) ? L"Downside" : L"Upside");

To switch the letter side, use the setIsUpsideDown() method; it requires one argument — the letter side typeface as a Boolean value — and does not return a value. For example:


// Set the downside text
pTextStyle->setIsUpsideDown(true);

// Set the upside text
pTextStyle->setIsUpsideDown(false);

Orientation Typeface

The orientation typeface determines whether text is drawn vertically or horizontally from the start position. The text style defines this property as a Boolean value which is True if the text is vertical or False if the text is horizontal. The value is False (Horizontal) by default.

To check the orientation, use the isVertical() method; it does not have arguments and returns the orientation typeface as a Boolean value. For example:


odPrintConsoleString(L"\nText is %s", (pTextStyle->isVertical()) ? L"Vertical" : L"Horizontal");

To switch the orientation, use the setIsVertical() method; it requires one argument — the orientation typeface as a Boolean value — and does not return a value. For example:


// Set the vertical text
pTextStyle->setIsVertical(true);

// Set the horizontal text
pTextStyle->setIsVertical(false);

Oblique Angle

The oblique angle is stored in radians as a Double value in the range from –85 to +85 degrees. A positive angle leans the letters clockwise (to the right). A negative value leans the letters counterclockwise (to the left). A negative value is converted to its positive equivalent by adding the value with 2*PI. The value is zero by default.

To get the oblique angle, use the obliquingAngle() method; it does not have arguments and returns the angle as a Double value. For example:


odPrintConsoleString(L"\nOblique Angle = %f", pTextStyle->obliquingAngle());

To set the oblique angle, use the setObliquingAngle() method; it requires one argument — the angle as a Double value — and does not return a value. For example:


// Lean to the right
pTextStyle->setObliquingAngle(0.135);

// Lean to the left
pTextStyle->setObliquingAngle(-0.135);

Width Scale Factor

The property stores the width scale factor of the text boundary as a positive non-zero Double value. This factor influences the width of the text and is used for scaling letters and spaces when the height is constant. If the value is less than 1.0, the text is condensed. If the value is greater than 1.0, the text is expanded. The value equals 1.0 by default.

To get the width scale factor, use the xScale() method; it does not have arguments and returns the factor as a Double value. For example:


odPrintConsoleString(L"\nWidth Scale Factor = %f", pTextStyle->xScale());

To set the width scale factor, use the setXScale() method; it requires one argument — the factor as a positive non-zero Double value — and does not return a value. For example:


// Condense the text
pTextStyle->setXScale(0.8);

// Expand the text
pTextStyle->setXScale(2.5);

Height Scale Factor

The height scale factor of the text boundary is stored as a positive non-zero Double value. This factor influences the width and height together and is used for proportional scaling of letters, spaces, and the text boundary. When a new text entity is created, the entity gets the height scale factor of the associated text style as a default value of its own height property. If the value is less than 1.0, the text is decreased. If the value is greater than 1.0, the text is increased. The value is zero by default.

To get the height scale factor, use the textSize() method; it does not have arguments and returns the factor as a Double value. For example:


odPrintConsoleString(L"\nHeight Scale Factor = %f", pTextStyle->textSize());

To set the height scale factor, use the setTextSize() method; it requires one argument — the factor as a positive non-zero Double value — and does not return a value. For example:


// Decrease the text
pTextStyle->setTextSize(0.5);

// Increase the text
pTextStyle->setTextSize(2.0);

Last Height

The text height used for the last text entity that was created using this text style, is stored using as a positive non-zero Double value. This value is automatically updated after creating any text object that refers to this text style. This value is also used as a default value when the height scale factor is set to zero.

To get the last height, use the priorSize() method; it does not have arguments and returns the height as a Double value. For example:


odPrintConsoleString(L"\nLast Height = %f", pTextStyle->priorSize());

To set the last height, use the setPriorSize() method; it requires one argument — the height as a positive non-zero Double value — and does not return a value. For example:


pTextStyle->setPriorSize(1.0);

See Also

Working with Text Styles

Fonts of Text Styles

Example of Working with the Text Style Record Object

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