CFx SDK Documentation  2023 SP0
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 
@ kShape
OdCodePageId
Definition: OdCodePage.h:31
unsigned short OdUInt16
#define SETBIT(flags, bit, value)
Definition: OdaDefs.h:499
#define GETBIT(flags, bit)
Definition: OdaDefs.h:500
#define FIRSTDLL_EXPORT
Definition: RootExport.h:39
Definition: OdFont.h:235
bool isTtfFont() const
Definition: GiTextStyle.h:347
bool isBackward() const
Definition: GiTextStyle.h:313
void setBigFont(OdFont *pBigFont)
Definition: GiTextStyle.h:395
bool isUpsideDown() const
Definition: GiTextStyle.h:318
OdString getBigFontFilePath(OdDbBaseDatabase *pDb) const
void setBackward(bool isBackward)
OdCodePageId getCodePage() const
Definition: GiTextStyle.h:491
bool isShape() const
Definition: GiTextStyle.h:361
void setFont(OdFont *font)
Definition: GiTextStyle.h:387
OdFont * getFont() const
Definition: GiTextStyle.h:418
const OdString & styleName() const
Definition: GiTextStyle.h:505
void setShapeLoaded(bool shapeLoaded) const
void loadStyleRec(OdDbBaseDatabase *pDb) const
OdFont * getBigFont() const
Definition: GiTextStyle.h:423
void setStyleName(const OdString &name)
Definition: GiTextStyle.h:510
void setUpsideDown(bool isUpsideDown)
void font(OdString &typeface, bool &bold, bool &italic, int &charset, int &pitchAndFamily) const
bool isUnderlined() const
Definition: GiTextStyle.h:328
void setIntercharSpacing(double dSpacing)
void setPreLoaded(bool value) const
double obliquingAngle() const
Definition: GiTextStyle.h:469
void setTextSize(double textSize)
void setIsUseIntercharSpacing(bool isUseIntercharSpacing)
Definition: GiTextStyle.h:520
double xScale() const
Definition: GiTextStyle.h:455
double textSize() const
Definition: GiTextStyle.h:447
OdString getFontFilePath(OdDbBaseDatabase *pDb) const
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)
const OdString & bigFontFileName() const
Definition: GiTextStyle.h:440
void setFileName(const OdString &fontFileName)
void setXScale(double xScale)
void setOverlined(bool isOverlined)
void setIsShape(bool isShape)
Definition: GiTextStyle.h:354
double getIntercharSpacing() const
OdTtfDescriptor & ttfdescriptor()
Definition: GiTextStyle.h:428
void setObliquingAngle(double obliquingAngle)
bool isShxFont() const
Definition: GiTextStyle.h:344
void setIsFixedIntercharSpacing(bool isUseIntercharSpacing)
Definition: GiTextStyle.h:534
void setBigFontFileName(const OdString &bigFontFileName)
bool isOverlined() const
Definition: GiTextStyle.h:333
void setFontFilePath(const OdString &fontFilePath)
Definition: GiTextStyle.h:185
void setCodePage(OdCodePageId codePage)
Definition: GiTextStyle.h:500
bool isStriked() const
Definition: GiTextStyle.h:338
bool isVertical() const
Definition: GiTextStyle.h:323
void setVertical(bool isVertical)
void setStriked(bool isStriked)
void setBigFontFilePath(const OdString &bigFontFilePath)
Definition: GiTextStyle.h:196
double trackingPercent() const
Definition: GiTextStyle.h:481
bool isShapeLoaded() const
Definition: GiTextStyle.h:108
bool isPreLoaded() const
Definition: GiTextStyle.h:341
void setUnderlined(bool isUnderlined)
const OdTtfDescriptor & ttfdescriptor() const
Definition: GiTextStyle.h:432
void setTrackingPercent(double trackingPercent)
bool isFixedIntercharSpacing() const
Definition: GiTextStyle.h:541
void setFont(const OdString &typeface, bool bold, bool italic, int charset, int pitchAndFamily)
bool isUseIntercharSpacing() const
Definition: GiTextStyle.h:527
void setShxFont(bool value) const
GLuint const GLchar * name
Definition: gles2_ext.h:265
GLsizei const GLfloat * value
Definition: gles2_ext.h:302
@ kUnderlined
The border is inset.