CFx SDK Documentation 2026 SP0
Loading...
Searching...
No Matches
OdGiTextStyle Class Reference

#include <GiTextStyle.h>

Public Types

enum  {
  kShape = 0x01 , kUpsideDown = 0x02 , kVertical = 0x04 , kUnderlined = 0x08 ,
  kOverlined = 0x10 , kShxFont = 0x20 , kPreLoaded = 0x40 , kBackward = 0x80 ,
  kShapeLoaded = 0x100 , kStriked = 0x200 , kUseIntercharSpacing = 0x400 , kFixedIntercharSpacing = 0x800 ,
  kNoUsePreferableFont = 0x1000
}
 

Public Member Functions

void setShapeLoaded (bool shapeLoaded) const
 
bool isShapeLoaded () const
 
 OdGiTextStyle ()
 
 ~OdGiTextStyle ()
 
void set (const OdString &fontName, const OdString &bigFontName, const double textSize, const double xScale, const double obliquingAngle, const double trackingPercent, const bool isBackward, const bool isUpsideDown, const bool isVertical, const bool isOverlined, const bool isUnderlined)
 
void loadStyleRec (OdDbBaseDatabase *pDb) const
 
OdString getFontFilePath (OdDbBaseDatabase *pDb) const
 
OdString getBigFontFilePath (OdDbBaseDatabase *pDb) const
 
void setFontFilePath (const OdString &fontFilePath)
 
void setBigFontFilePath (const OdString &bigFontFilePath)
 
void setTextSize (double textSize)
 
void setXScale (double xScale)
 
void setObliquingAngle (double obliquingAngle)
 
void setTrackingPercent (double trackingPercent)
 
void setBackward (bool isBackward)
 
void setUpsideDown (bool isUpsideDown)
 
void setVertical (bool isVertical)
 
void setUnderlined (bool isUnderlined)
 
void setOverlined (bool isOverlined)
 
void setStriked (bool isStriked)
 
void setPreLoaded (bool value) const
 
void setShxFont (bool value) const
 
void setFileName (const OdString &fontFileName)
 
void setBigFontFileName (const OdString &bigFontFileName)
 
bool isBackward () const
 
bool isUpsideDown () const
 
bool isVertical () const
 
bool isUnderlined () const
 
bool isOverlined () const
 
bool isStriked () const
 
bool isPreLoaded () const
 
bool isShxFont () const
 
bool isTtfFont () const
 
void setIsShape (bool isShape)
 
bool isShape () const
 
void setFont (const OdString &typeface, bool bold, bool italic, int charset, int pitchAndFamily)
 
void setFont (OdFont *font)
 
void setBigFont (OdFont *pBigFont)
 
void font (OdString &typeface, bool &bold, bool &italic, int &charset, int &pitchAndFamily) const
 
OdFontgetFont () const
 
OdFontgetBigFont () const
 
OdTtfDescriptorttfdescriptor ()
 
const OdTtfDescriptorttfdescriptor () const
 
const OdStringbigFontFileName () const
 
double textSize () const
 
double xScale () const
 
double obliquingAngle () const
 
double trackingPercent () const
 
OdCodePageId getCodePage () const
 
void setCodePage (OdCodePageId codePage)
 
const OdStringstyleName () const
 
void setStyleName (const OdString &name)
 
void setIsUseIntercharSpacing (bool isUseIntercharSpacing)
 
bool isUseIntercharSpacing () const
 
void setIsFixedIntercharSpacing (bool isUseIntercharSpacing)
 
bool isFixedIntercharSpacing () const
 
double getIntercharSpacing () const
 
void setIntercharSpacing (double dSpacing)
 
void setNoUsePreferableFont (bool isUsePreferableFont)
 
bool isNoUsePreferableFont () const
 

Detailed Description

This class provides an interface to the display attributes of text.

Remarks
This class is used as an argument to OdGiGeometry::text().
See also
<link tv_working_with_attributes_text_style, Work with Text Styles>

<group OdGi_Classes>

Definition at line 50 of file GiTextStyle.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
kShape 
kUpsideDown 
kVertical 
kUnderlined 
kOverlined 
kShxFont 
kPreLoaded 
kBackward 
kShapeLoaded 
kStriked 
kUseIntercharSpacing 
kFixedIntercharSpacing 
kNoUsePreferableFont 

Definition at line 79 of file GiTextStyle.h.

Constructor & Destructor Documentation

◆ OdGiTextStyle()

OdGiTextStyle::OdGiTextStyle ( )

Default constructor for the OdGiTextStyle class. Sets the following data members:

Value Description m_pFont default shx font* Default .shx font that is defined in the font table (default font is assigned only if the system registry contains a dictionary that stores a name of properly initialized font service object). m_dXScale 1.0 Scale of text by the x-axis. m_dTrackingPercent 1.0 Multiplier for the spacing between characters as defined in the font file. m_dTextSize 0.2 Fixed text size in drawing units. m_dObliquingAngle 0.0 Oblique (skew) angle for the text. m_flags 0 Various text style flags (for example, upside down characters, backward characters, etc.). m_Codepage CP_UNDEFINED Font codepage. m_dIntercharSpacing 0 Inter-character spacing.

◆ ~OdGiTextStyle()

OdGiTextStyle::~OdGiTextStyle ( )

Destructor for the OdGiTextStyle class.

Member Function Documentation

◆ bigFontFileName()

const OdString & OdGiTextStyle::bigFontFileName ( ) const
inline

Returns the BigFont filename for this TextStyle.

Definition at line 489 of file GiTextStyle.h.

◆ font()

void OdGiTextStyle::font ( OdString & typeface,
bool & bold,
bool & italic,
int & charset,
int & pitchAndFamily ) const

Returns the Windows font characteristics for this TextStyle.

Parameters
typeface[out] Typeface name of the font.
bold[out] True if and only if bold.
italic[out] True if and only if italic.
charset[out] Windows character set identifier.
pitchAndFamily[out] Windows pitch and character family identifier.

◆ getBigFont()

OdFont * OdGiTextStyle::getBigFont ( ) const
inline

Returns the OdFont associated with the BigFont for this TextStyle.

Definition at line 472 of file GiTextStyle.h.

◆ getBigFontFilePath()

OdString OdGiTextStyle::getBigFontFilePath ( OdDbBaseDatabase * pDb) const

Returns the fully qualified BigFont file path associated with this TextStyle.

Parameters
pDb[in] Pointer to the database whose OdDbHostAppServices object will be used.

◆ getCodePage()

OdCodePageId OdGiTextStyle::getCodePage ( ) const
inline

Returns the CodePage associated with this TextStyle.

Definition at line 540 of file GiTextStyle.h.

◆ getFont()

OdFont * OdGiTextStyle::getFont ( ) const
inline

Returns the OdFont associated with this TextStyle.

Definition at line 467 of file GiTextStyle.h.

◆ getFontFilePath()

OdString OdGiTextStyle::getFontFilePath ( OdDbBaseDatabase * pDb) const

Returns the fully qualified font file path associated with this TextStyle.

Parameters
pDb[in] Pointer to the database whose OdDbHostAppServices object will be used.

◆ getIntercharSpacing()

double OdGiTextStyle::getIntercharSpacing ( ) const

Returns the interchar spacing for this TextStyle.

Remarks
Interchar spacing is a factor of text size, that determine distance from start of character to start of next character for fixed interchar spacing mode or a additional distance from end of character to start of next character for common interchar spacing mode.

◆ isBackward()

bool OdGiTextStyle::isBackward ( ) const
inline

Checks whether text is drawn backwards with this TextStyle.

Returns
true if text is drawn backwards with this TextStyle, false otherwise.

Definition at line 338 of file GiTextStyle.h.

◆ isFixedIntercharSpacing()

bool OdGiTextStyle::isFixedIntercharSpacing ( ) const
inline

Checks whether interchar spacing is fixed.

Returns
true if fixed interchar spacing is fixed, false otherwise.

Definition at line 597 of file GiTextStyle.h.

◆ isNoUsePreferableFont()

bool OdGiTextStyle::isNoUsePreferableFont ( ) const
inline

Checks using preferable font during loadStyleRec.

Returns
true if no using preferable font, false otherwise.

Definition at line 626 of file GiTextStyle.h.

◆ isOverlined()

bool OdGiTextStyle::isOverlined ( ) const
inline

Checks whether text is drawn overlined with this TextStyle.

Returns
true if text is drawn overlined with this TextStyle, false otherwise.

Definition at line 366 of file GiTextStyle.h.

◆ isPreLoaded()

bool OdGiTextStyle::isPreLoaded ( ) const
inline

Checks whether this text style has a pre-loaded font. For internal use.

Returns
true if an associated font is pre-loaded, false otherwise.
Remarks
If font is pre-loaded then internally there is no need to search, load and perform other action for the font.

Definition at line 382 of file GiTextStyle.h.

◆ isShape()

bool OdGiTextStyle::isShape ( ) const
inline

Checks whether the font file for this TextStyle is treated as a shape file.

Returns
true if the font file for this TextStyle is a shape file, false otherwise.

Definition at line 410 of file GiTextStyle.h.

◆ isShapeLoaded()

bool OdGiTextStyle::isShapeLoaded ( ) const
inline

Checks whether the text font for this text style is loaded.

Returns
true if and only if the text font file for this TextStyle marked as loaded, false otherwise.

Definition at line 110 of file GiTextStyle.h.

◆ isShxFont()

bool OdGiTextStyle::isShxFont ( ) const
inline

Specifies whether the set font is shx font. For internal use.

Returns
true if an associated font is shx font, false otherwise.

Definition at line 389 of file GiTextStyle.h.

◆ isStriked()

bool OdGiTextStyle::isStriked ( ) const
inline

Checks whether text is drawn striked with this TextStyle.

Returns
true if text is drawn striked with this TextStyle, false otherwise.

Definition at line 373 of file GiTextStyle.h.

◆ isTtfFont()

bool OdGiTextStyle::isTtfFont ( ) const
inline

Specifies whether the set font is ttf font. For internal use.

Returns
true if an associated font is ttf font, false otherwise.

Definition at line 396 of file GiTextStyle.h.

◆ isUnderlined()

bool OdGiTextStyle::isUnderlined ( ) const
inline

Checks whether text is drawn underlined with this TextStyle.

Returns
true if text is drawn underlined with this TextStyle, false otherwise.

Definition at line 359 of file GiTextStyle.h.

◆ isUpsideDown()

bool OdGiTextStyle::isUpsideDown ( ) const
inline

Checks whether text is drawn upside down with this TextStyle.

Returns
true if text is drawn upside down with this TextStyle, false otherwise.

Definition at line 345 of file GiTextStyle.h.

◆ isUseIntercharSpacing()

bool OdGiTextStyle::isUseIntercharSpacing ( ) const
inline

Checks whether interchar spacing is used.

Returns
true if interchar spacing used, false otherwise.

Definition at line 583 of file GiTextStyle.h.

◆ isVertical()

bool OdGiTextStyle::isVertical ( ) const
inline

Checks whether text is drawn vertical with this TextStyle.

Returns
true if text is drawn vertical with this TextStyle, false otherwise.

Definition at line 352 of file GiTextStyle.h.

◆ loadStyleRec()

void OdGiTextStyle::loadStyleRec ( OdDbBaseDatabase * pDb) const

Loads the font file(s) associated with this TextStyle.

Parameters
pDb[in] Pointer to the database whose OdDbHostAppServices object will be used.
Remarks
This function is run after a call to setFileName() or setBigFontFileName(), and must be called after loading a True Type font (TTF).

◆ obliquingAngle()

double OdGiTextStyle::obliquingAngle ( ) const
inline

Returns the obliquing angle for this TextStyle.

Remarks
obliquingAngle has a domain of +/-1.48335 radians (+/-85 degrees). Negative angles will have Oda2PI added to them.
All angles are expressed in radians.

Definition at line 518 of file GiTextStyle.h.

◆ set()

void OdGiTextStyle::set ( const OdString & fontName,
const OdString & bigFontName,
const double textSize,
const double xScale,
const double obliquingAngle,
const double trackingPercent,
const bool isBackward,
const bool isUpsideDown,
const bool isVertical,
const bool isOverlined,
const bool isUnderlined )

Sets the parameters of this TextStyle object according to its parameters.

Parameters
fontName[in] Font filename.
bigFontName[in] BigFont filename.
textSize[in] Fixed text size.
xScale[in] X-scale (width) factor of text.
obliquingAngle[in] Obliquing angle of text.
trackingPercent[in] Tracking percent of text.
isBackward[in] Controls backwards drawing of text.
isUpsideDown[in] Controls upside down drawing of text.
isVertical[in] Controls vertical drawing of text.
isOverlined[in] Controls overlined drawing of text.
isUnderlined[in] Controls overlined drawing of text.
Remarks
obliquingAngle has a domain of +/-1.48335 radians (+/-85 degrees). Negative angles will have Oda2PI added to them.
All angles are expressed in radians.

◆ setBackward()

void OdGiTextStyle::setBackward ( bool isBackward)

Controls the backwards drawing of text with this TextStyle.

Parameters
isBackwards[in] Controls backwards drawing.

◆ setBigFont()

void OdGiTextStyle::setBigFont ( OdFont * pBigFont)
inline

Sets this TextStyle to use the specified OdFont as the BigFont.

Parameters
pBigFont[in] Pointer to the BigFont.

Definition at line 444 of file GiTextStyle.h.

◆ setBigFontFileName()

void OdGiTextStyle::setBigFontFileName ( const OdString & bigFontFileName)

Sets the name of the BigFont file associated with this TextStyle.

Parameters
bigFontFileName[in] Filename.

◆ setBigFontFilePath()

void OdGiTextStyle::setBigFontFilePath ( const OdString & bigFontFilePath)
inline

Sets the fully qualified BigFont file path associated with this TextStyle.

Parameters
bigFontFilePath[in] BigFont file path.
Remarks
loadStyleRec() should be called after calling this function.

Definition at line 211 of file GiTextStyle.h.

◆ setCodePage()

void OdGiTextStyle::setCodePage ( OdCodePageId codePage)
inline

Sets the CodePage associated with this TextStyle.

Parameters
codePage[in] CodePage.

Definition at line 549 of file GiTextStyle.h.

◆ setFileName()

void OdGiTextStyle::setFileName ( const OdString & fontFileName)

Sets the name of the font file associated with this TextStyle.

Parameters
fontFileName[in] Filename.

◆ setFont() [1/2]

void OdGiTextStyle::setFont ( const OdString & typeface,
bool bold,
bool italic,
int charset,
int pitchAndFamily )

Sets this TextStyle to use the specified Windows font characteristics.

Parameters
typeface[in] Typeface name of the font.
bold[in] Bold if and only if true.
italic[in] Italic if and only if true.
charset[in] Windows character set identifier.
pitchAndFamily[in] Windows pitch and character family identifier.
Remarks
If typeface is null, the Windows font information is removed from this text style.

◆ setFont() [2/2]

void OdGiTextStyle::setFont ( OdFont * font)
inline

Sets this TextStyle to use the specified OdFont characteristics.

Parameters
pFont[in] Pointer to the font.

Definition at line 436 of file GiTextStyle.h.

◆ setFontFilePath()

void OdGiTextStyle::setFontFilePath ( const OdString & fontFilePath)
inline

Sets the fully qualified font file path associated with this TextStyle.

Parameters
fontFilePath[in] Font file path.
Remarks
loadStyleRec() should be called after calling this function:

Definition at line 201 of file GiTextStyle.h.

◆ setIntercharSpacing()

void OdGiTextStyle::setIntercharSpacing ( double dSpacing)

Sets interchar spacing for this TextStyle.

Parameters
dSpacing[in] Interchar spacing value.

◆ setIsFixedIntercharSpacing()

void OdGiTextStyle::setIsFixedIntercharSpacing ( bool isUseIntercharSpacing)
inline

Specifies whether interchar spacing is fixed.

Parameters
isUseIntercharSpacing[in] Controls setting.

Definition at line 589 of file GiTextStyle.h.

◆ setIsShape()

void OdGiTextStyle::setIsShape ( bool isShape)
inline

Controls if the font file for this TextStyle is treated as a shape file.

Parameters
isShape[in] Controls setting.

Definition at line 402 of file GiTextStyle.h.

◆ setIsUseIntercharSpacing()

void OdGiTextStyle::setIsUseIntercharSpacing ( bool isUseIntercharSpacing)
inline

Specifies whether to use interchar spacing.

Parameters
isUseIntercharSpacing[in] Controls setting.

Definition at line 575 of file GiTextStyle.h.

◆ setNoUsePreferableFont()

void OdGiTextStyle::setNoUsePreferableFont ( bool isUsePreferableFont)
inline

Specifies no using preferable font during loadStyleRec.

Parameters
isUsePreferableFont[in] Controls setting.

Definition at line 619 of file GiTextStyle.h.

◆ setObliquingAngle()

void OdGiTextStyle::setObliquingAngle ( double obliquingAngle)

Sets the obliquing angle for this TextStyle.

Parameters
obliquingAngle[in] Obliquing angle.
Remarks
obliquingAngle has a domain of +/-1.48335 radians (+/-85 degrees). Negative angles will have Oda2PI added to them.
All angles are expressed in radians.

◆ setOverlined()

void OdGiTextStyle::setOverlined ( bool isOverlined)

Controls the overlined drawing of text with this TextStyle.

Parameters
overlined[in] Controls overlined drawing.

◆ setPreLoaded()

void OdGiTextStyle::setPreLoaded ( bool value) const

Specifies whether this text style has a pre-loaded font. For internal use.

Parameters
value[in] Flag that specifies whether an associated font is pre-loaded.
Remarks
If font is pre-loaded then internally there is no need to search, load and perform other action for the font.

◆ setShapeLoaded()

void OdGiTextStyle::setShapeLoaded ( bool shapeLoaded) const

Controls if the text font file for this TextStyle marked as loaded.

Parameters
shapeLoaded[in] Controls shape loaded.

◆ setShxFont()

void OdGiTextStyle::setShxFont ( bool value) const

Specifies whether the set font is shx font. For internal use.

Parameters
value[in] Flag that specifies whether an associated font is shx font.

◆ setStriked()

void OdGiTextStyle::setStriked ( bool isStriked)

Controls the strike drawing of text with this TextStyle.

Parameters
overlined[in] Controls strike drawing.

◆ setStyleName()

void OdGiTextStyle::setStyleName ( const OdString & name)
inline

Sets the style name for this TextStyle.

Parameters
name[in] Style name.

Definition at line 566 of file GiTextStyle.h.

◆ setTextSize()

void OdGiTextStyle::setTextSize ( double textSize)

Sets the fixed text size for this TextStyle.

Parameters
textSize[in] Fixed text size.

◆ setTrackingPercent()

void OdGiTextStyle::setTrackingPercent ( double trackingPercent)

Sets the tracking percent for this TextStyle.

Parameters
trackingPercent[in] TrackingPercent [0.75, 4.0].
Remarks
Tracking percent is a multiplier for the spacing between characters as defined in the font file.

◆ setUnderlined()

void OdGiTextStyle::setUnderlined ( bool isUnderlined)

Controls the underlined drawing of text with this TextStyle.

Parameters
underlined[in] Controls underlined drawing.

◆ setUpsideDown()

void OdGiTextStyle::setUpsideDown ( bool isUpsideDown)

Controls the upside down drawing of text with this TextStyle.

Parameters
isUpsideDown[in] Controls upside down drawing.

◆ setVertical()

void OdGiTextStyle::setVertical ( bool isVertical)

Controls the vertical drawing of text with this TextStyle.

Parameters
isVertical[in] Controls vertical drawing.

◆ setXScale()

void OdGiTextStyle::setXScale ( double xScale)

Sets the X-scale (width) factor for this TextStyle.

Parameters
xScale[in] X-scale factor.

◆ styleName()

const OdString & OdGiTextStyle::styleName ( ) const
inline

Returns the style name for this TextStyle.

Definition at line 557 of file GiTextStyle.h.

◆ textSize()

double OdGiTextStyle::textSize ( ) const
inline

Returns the fixed text size for this TextStyle.

Definition at line 496 of file GiTextStyle.h.

◆ trackingPercent()

double OdGiTextStyle::trackingPercent ( ) const
inline

Returns the tracking percent for this TextStyle.

Remarks
Tracking percent is a multiplier for the spacing between characters as defined in the font file.

trackingPercent() has a range of [0.75..4].

Definition at line 530 of file GiTextStyle.h.

◆ ttfdescriptor() [1/2]

OdTtfDescriptor & OdGiTextStyle::ttfdescriptor ( )
inline

Returns a reference to the TTF descriptor for this TextStyle.

Definition at line 477 of file GiTextStyle.h.

◆ ttfdescriptor() [2/2]

const OdTtfDescriptor & OdGiTextStyle::ttfdescriptor ( ) const
inline

Definition at line 481 of file GiTextStyle.h.

◆ xScale()

double OdGiTextStyle::xScale ( ) const
inline

Returns the X-scale (width) factor for this TextStyle.

Definition at line 504 of file GiTextStyle.h.


The documentation for this class was generated from the following file: