CFx SDK Documentation  2020SP3
GiTextStyle.h
Go to the documentation of this file.
1 // Copyright (C) 2002-2017, Open Design Alliance (the "Alliance").
3 // All rights reserved.
4 //
5 // This software and its documentation and related materials are owned by
6 // the Alliance. The software may only be incorporated into application
7 // programs owned by members of the Alliance, subject to a signed
8 // Membership Agreement and Supplemental Software License Agreement with the
9 // Alliance. The structure and organization of this software are the valuable
10 // trade secrets of the Alliance and its suppliers. The software is also
11 // protected by copyright law and international treaty provisions. Application
12 // programs incorporating this software must include the following statement
13 // with their copyright notices:
14 //
15 // This application incorporates Teigha(R) software pursuant to a license
16 // agreement with Open Design Alliance.
17 // Teigha(R) Copyright (C) 2002-2017 by Open Design Alliance.
18 // All rights reserved.
19 //
20 // By use of this software, its documentation or related materials, you
21 // acknowledge and accept the above terms.
23 
24 #ifndef __ODGITEXTSTYLE_H__
25 #define __ODGITEXTSTYLE_H__
26 
27 #include "TD_PackPush.h"
28 
29 #include "OdCodePage.h"
30 #include "OdFont.h"
31 #include "Gi/TtfDescriptor.h"
32 #include "DbBaseDatabase.h"
33 
34 class OdGiWorldDraw;
35 class OdGiTextStyleImpl;
36 class OdString;
37 class OdGePoint2d;
38 
39 
52 {
53  // Members
54  //
55 
56  // : public OdTtfDescriptor // MKU 14.02.2003
57 
58  OdTtfDescriptor m_ttfDescriptor;
59 
60  mutable OdFontPtr m_pFont;
61  mutable OdFontPtr m_pBigFont;
62 
63  mutable OdString m_sFontPath;
64  mutable OdString m_sBigFontPath;
65 
66  OdString m_sBigfontFile;
67  double m_dTextSize;
68  double m_dXScale;
69  double m_dObliquingAngle;
70  double m_dTrackingPercent;
71  mutable OdUInt16 m_flags;
72  mutable OdCodePageId m_Codepage;
73 
74  OdString m_StyleName;
75 
76  double m_dIntercharSpacing;
77 
78 public:
79  enum
80  {
81  kShape = 0x01,
82  kUpsideDown = 0x02,
83  kVertical = 0x04,
84  kUnderlined = 0x08,
85  kOverlined = 0x10,
86  kShxFont = 0x20,
87  kPreLoaded = 0x40,
88  kBackward = 0x80,
89  kShapeLoaded = 0x100,
90  kStriked = 0x200,
91  kUseIntercharSpacing = 0x400,
92  kFixedIntercharSpacing = 0x800
93  };
94 
102  bool shapeLoaded) const;
103 
108  bool isShapeLoaded() const { return GETBIT(m_flags, kShapeLoaded); }
109 
112 
134  void set(
135  const OdString& fontName,
136  const OdString& bigFontName,
137  const double textSize,
138  const double xScale,
139  const double obliquingAngle,
140  const double trackingPercent,
141  const bool isBackward,
142  const bool isUpsideDown,
143  const bool isVertical,
144  const bool isOverlined,
145  const bool isUnderlined);
146 
157  OdDbBaseDatabase* pDb) const;
158 
166  OdDbBaseDatabase* pDb) const;
167 
175  OdDbBaseDatabase* pDb) const;
176 
186  const OdString& fontFilePath){m_sFontPath = fontFilePath;}
187 
197  const OdString& bigFontFilePath){m_sBigFontPath = bigFontFilePath;}
198 
205  double textSize);
206 
212  void setXScale(
213  double xScale);
214 
226  void setObliquingAngle(double obliquingAngle);
227 
238  double trackingPercent);
239 
246  bool isBackward);
247 
254  bool isUpsideDown);
255 
262  bool isVertical);
263 
270  bool isUnderlined);
271 
278  bool isOverlined);
279 
286  bool isStriked);
287 
289  void setPreLoaded(bool value) const;
290 
292  void setShxFont(bool value) const;
293 
300  const OdString& fontFileName);
301 
308  const OdString& bigFontFileName);
309 
313  bool isBackward() const { return GETBIT(m_flags, kBackward); }
314 
318  bool isUpsideDown() const { return GETBIT(m_flags, kUpsideDown);}
319 
323  bool isVertical() const { return GETBIT(m_flags, kVertical); }
324 
328  bool isUnderlined() const { return GETBIT(m_flags, kUnderlined);}
329 
333  bool isOverlined() const { return GETBIT(m_flags, kOverlined); }
334 
338  bool isStriked() const { return GETBIT(m_flags, kStriked); }
339 
341  bool isPreLoaded() const { return GETBIT(m_flags, kPreLoaded); }
342 
344  bool isShxFont() const { return GETBIT(m_flags, kShxFont); }
345 
347  bool isTtfFont() const { return !isShxFont(); }
348 
355  bool isShape) { SETBIT(m_flags, kShape, isShape); }
356 
361  bool isShape() const { return GETBIT(m_flags, kShape); }
362 
363 
376  void setFont(
377  const OdString& typeface,
378  bool bold, bool italic,
379  int charset,
380  int pitchAndFamily);
381 
387  void setFont(
388  OdFont* font){m_pFont = font;}
389 
396  OdFont* pBigFont){m_pBigFont = pBigFont;}
397 
398 
408  void font(
409  OdString& typeface,
410  bool& bold,
411  bool& italic,
412  int& charset,
413  int& pitchAndFamily) const;
414 
418  OdFont* getFont() const { return m_pFont; }
419 
423  OdFont* getBigFont() const { return m_pBigFont; }
424 
429  {
430  return m_ttfDescriptor;
431  }
433  {
434  return m_ttfDescriptor;
435  }
436 
440  const OdString &bigFontFileName() const
441  {
442  return m_sBigfontFile;
443  }
447  double textSize() const
448  {
449  return m_dTextSize;
450  }
451 
455  double xScale() const
456  {
457  return m_dXScale;
458  }
459 
469  double obliquingAngle() const
470  {
471  return m_dObliquingAngle;
472  }
481  double trackingPercent() const
482  {
483  return m_dTrackingPercent;
484  }
485 
486 // void odExtentsBox(const OdChar* pStr, int nStrLen, OdUInt32 flags, OdDbDatabase* pDb, OdGePoint3d& min, OdGePoint3d& max, OdGePoint3d* pEndPos = 0); // MKU 02.06.2003
487 
492  {
493  return m_Codepage;
494  }
495 
500  void setCodePage(OdCodePageId codePage)
501  {
502  m_Codepage = codePage;
503  }
504 
505  const OdString& styleName() const
506  {
507  return m_StyleName;
508  }
509 
511  {
512  m_StyleName = name;
513  }
514 
521  bool isUseIntercharSpacing) { SETBIT(m_flags, kUseIntercharSpacing, isUseIntercharSpacing); }
522 
527  bool isUseIntercharSpacing() const { return GETBIT(m_flags, kUseIntercharSpacing); }
528 
535  bool isUseIntercharSpacing) { SETBIT(m_flags, kFixedIntercharSpacing, isUseIntercharSpacing); }
536 
541  bool isFixedIntercharSpacing() const { return GETBIT(m_flags, kFixedIntercharSpacing); }
542 
551  double getIntercharSpacing() const;
552 
556  void setIntercharSpacing( double dSpacing );
557 };
558 
559 #include "TD_PackPop.h"
560 
561 #endif // __ODGITEXTSTYLE_H__
562 
GETBIT
#define GETBIT(flags, bit)
Definition: OdaDefs.h:498
FIRSTDLL_EXPORT
#define FIRSTDLL_EXPORT
Definition: RootExport.h:39
OdGiTextStyle::isUpsideDown
bool isUpsideDown() const
Definition: GiTextStyle.h:318
OdString
Definition: OdString.h:95
OdGiTextStyle::setIsShape
void setIsShape(bool isShape)
Definition: GiTextStyle.h:354
OdGiTextStyle::font
void font(OdString &typeface, bool &bold, bool &italic, int &charset, int &pitchAndFamily) const
OdGiTextStyle::xScale
double xScale() const
Definition: GiTextStyle.h:455
OdGiTextStyle::setBackward
void setBackward(bool isBackward)
name
GLuint const GLchar * name
Definition: gles2_ext.h:265
OdGiTextStyle::isTtfFont
bool isTtfFont() const
Definition: GiTextStyle.h:347
OdGiTextStyle::isUseIntercharSpacing
bool isUseIntercharSpacing() const
Definition: GiTextStyle.h:527
OdGiTextStyle::setShxFont
void setShxFont(bool value) const
OdGiTextStyle::~OdGiTextStyle
~OdGiTextStyle()
OdGiTextStyle::setIsFixedIntercharSpacing
void setIsFixedIntercharSpacing(bool isUseIntercharSpacing)
Definition: GiTextStyle.h:534
OdRxObject
Definition: RxObject.h:564
TtfDescriptor.h
OdGiTextStyle::setBigFontFilePath
void setBigFontFilePath(const OdString &bigFontFilePath)
Definition: GiTextStyle.h:196
SETBIT
#define SETBIT(flags, bit, value)
Definition: OdaDefs.h:497
OdGiTextStyle::isOverlined
bool isOverlined() const
Definition: GiTextStyle.h:333
OdGiTextStyle::setIntercharSpacing
void setIntercharSpacing(double dSpacing)
OdGiTextStyle::getBigFontFilePath
OdString getBigFontFilePath(OdDbBaseDatabase *pDb) const
OdGiTextStyle::setTrackingPercent
void setTrackingPercent(double trackingPercent)
OdCodePageId
OdCodePageId
Definition: OdCodePage.h:31
OdCodePage.h
TD_PackPop.h
OdGiTextStyle::isShape
bool isShape() const
Definition: GiTextStyle.h:361
OdUInt16
unsigned short OdUInt16
Definition: OdPlatformSettings.h:760
OdGiTextStyle::setUnderlined
void setUnderlined(bool isUnderlined)
OdGiTextStyle::setFont
void setFont(const OdString &typeface, bool bold, bool italic, int charset, int pitchAndFamily)
OdGiTextStyle::setXScale
void setXScale(double xScale)
OdGiTextStyle::isBackward
bool isBackward() const
Definition: GiTextStyle.h:313
OdGiTextStyle::setPreLoaded
void setPreLoaded(bool value) const
kShape
@ kShape
Definition: GiGeomEntTypes2.h:41
OdPdfPublish::Border::kUnderlined
@ kUnderlined
The border is inset.
Definition: PdfPublishCommon.h:271
OdGiTextStyle::isVertical
bool isVertical() const
Definition: GiTextStyle.h:323
OdGiTextStyle::setFileName
void setFileName(const OdString &fontFileName)
OdGiTextStyle::setObliquingAngle
void setObliquingAngle(double obliquingAngle)
OdGiTextStyle::getIntercharSpacing
double getIntercharSpacing() const
OdGiTextStyle::setShapeLoaded
void setShapeLoaded(bool shapeLoaded) const
OdGiTextStyle
Definition: GiTextStyle.h:52
OdGiTextStyle::ttfdescriptor
OdTtfDescriptor & ttfdescriptor()
Definition: GiTextStyle.h:428
OdSmartPtr< OdFont >
OdGiTextStyle::getBigFont
OdFont * getBigFont() const
Definition: GiTextStyle.h:423
OdGiTextStyle::setBigFont
void setBigFont(OdFont *pBigFont)
Definition: GiTextStyle.h:395
OdGiTextStyle::setOverlined
void setOverlined(bool isOverlined)
OdGiTextStyle::OdGiTextStyle
OdGiTextStyle()
DbBaseDatabase.h
OdGiTextStyle::loadStyleRec
void loadStyleRec(OdDbBaseDatabase *pDb) const
OdGiTextStyle::setVertical
void setVertical(bool isVertical)
OdGiTextStyle::setTextSize
void setTextSize(double textSize)
OdGiTextStyle::getFont
OdFont * getFont() const
Definition: GiTextStyle.h:418
OdGiTextStyle::setStriked
void setStriked(bool isStriked)
OdGiTextStyle::isFixedIntercharSpacing
bool isFixedIntercharSpacing() const
Definition: GiTextStyle.h:541
OdGiTextStyle::ttfdescriptor
const OdTtfDescriptor & ttfdescriptor() const
Definition: GiTextStyle.h:432
TD_PackPush.h
OdGiTextStyle::setBigFontFileName
void setBigFontFileName(const OdString &bigFontFileName)
OdGiTextStyle::set
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)
OdIfc::kVertical
@ kVertical
Definition: IfcAttributesEnum.h:1315
OdGiTextStyle::textSize
double textSize() const
Definition: GiTextStyle.h:447
OdGiTextStyle::getCodePage
OdCodePageId getCodePage() const
Definition: GiTextStyle.h:491
OdGiWorldDraw
Definition: GiWorldDraw.h:44
OdGiTextStyle::styleName
const OdString & styleName() const
Definition: GiTextStyle.h:505
OdGiTextStyle::bigFontFileName
const OdString & bigFontFileName() const
Definition: GiTextStyle.h:440
OdGiTextStyle::isUnderlined
bool isUnderlined() const
Definition: GiTextStyle.h:328
OdGiTextStyle::getFontFilePath
OdString getFontFilePath(OdDbBaseDatabase *pDb) const
OdGiTextStyle::isStriked
bool isStriked() const
Definition: GiTextStyle.h:338
value
GLsizei const GLfloat * value
Definition: gles2_ext.h:302
OdGiTextStyle::setUpsideDown
void setUpsideDown(bool isUpsideDown)
OdGiTextStyle::obliquingAngle
double obliquingAngle() const
Definition: GiTextStyle.h:469
OdGiTextStyle::setFont
void setFont(OdFont *font)
Definition: GiTextStyle.h:387
OdGiTextStyle::isShapeLoaded
bool isShapeLoaded() const
Definition: GiTextStyle.h:108
OdFont
Definition: OdFont.h:235
OdGiTextStyle::setCodePage
void setCodePage(OdCodePageId codePage)
Definition: GiTextStyle.h:500
OdGiTextStyle::isPreLoaded
bool isPreLoaded() const
Definition: GiTextStyle.h:341
OdGiTextStyle::setStyleName
void setStyleName(const OdString &name)
Definition: GiTextStyle.h:510
OdGiTextStyle::setFontFilePath
void setFontFilePath(const OdString &fontFilePath)
Definition: GiTextStyle.h:185
OdTtfDescriptor
Definition: TtfDescriptor.h:46
OdFont.h
OdGiTextStyle::isShxFont
bool isShxFont() const
Definition: GiTextStyle.h:344
OdGiTextStyle::trackingPercent
double trackingPercent() const
Definition: GiTextStyle.h:481
OdGiTextStyle::setIsUseIntercharSpacing
void setIsUseIntercharSpacing(bool isUseIntercharSpacing)
Definition: GiTextStyle.h:520
OdGePoint2d
Definition: GePoint2d.h:60