CFx SDK Documentation 2026 SP0
Loading...
Searching...
No Matches
OdFont.h
Go to the documentation of this file.
1
2// Copyright (C) 2002-2024, 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 Open Design Alliance software pursuant to a license
16// agreement with Open Design Alliance.
17// Open Design Alliance Copyright (C) 2002-2024 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
25
26
27// OdFont.h: interface for the OdFont class.
28//
30
31#if !defined(AFX_ODFONT_H__0B76813A_DCFA_450E_8591_B6C6F1ED76EC__INCLUDED_)
32#define AFX_ODFONT_H__0B76813A_DCFA_450E_8591_B6C6F1ED76EC__INCLUDED_
33
34#include "RxObject.h"
35#include "OdArray.h"
36#include "OdCharMapper.h"
37#include "Tr/TrVisRawTexture.h"
38
39// For memset below
40#include <memory.h>
41
42class OdGiCommonDraw;
44class OdGePoint2d;
45class OdGePoint3d;
46class OdStreamBuf;
47
48#include "TD_PackPush.h"
49
67
74{
76 { ::memset(this, 0, sizeof(*this)); }
77
88 bool bAsian;
90 bool bValid;
93};
94
101{
104 double m_scale; // FELIX_CHANGE_DESKTOP-336049
109 enum
110 {
120 kLastChar = 0x10,
130 kStriked = 0x200,
132 kLastPosOnly = 0x400, //
136 kIsGlyph = 0x1000,
139 ,kExtentsCalculation = 0x4000 //FELIX_CHANGE
140 };
143public:
145
151 bool isNormalText() const { return GETBIT(m_flags, kNormalText); }
152
159
165 bool isVerticalText() const { return GETBIT(m_flags, kVerticalText); }
166
173
179 bool isUnderlined() const { return GETBIT(m_flags, kUnderlined); }
180
187
193 bool isOverlined() const { return GETBIT(m_flags, kOverlined); }
194
201
207 bool isStriked() const { return GETBIT(m_flags, kStriked); }
208
215
221 bool isLastChar() const { return GETBIT(m_flags, kLastChar); }
222
229
235 bool isInBigFont() const { return GETBIT(m_flags, kInBigFont); }
236
243
249 bool isIncludePenups() const { return GETBIT(m_flags, kInclPenups); }
250
257
263 bool isZeroNormals() const { return GETBIT(m_flags, kZeroNormals); }
264
271
277 bool ttfPolyDraw() const { return GETBIT(m_flags, kBezierCurves); }
278
284 void setTtfPolyDraw(bool bFlag) { SETBIT(m_flags, kBezierCurves, bFlag); }
285
291 double trackingPercent() const {return m_trackingPercent; }
292
299
309
319
325 bool isTriangleCache() const { return GETBIT(m_flags, kTriangleCache); }
326
333
334 // For internal use only
340 bool isLastPosOnly() const { return GETBIT(m_flags, kLastPosOnly); }
341
348
354 bool isGlyph() const { return GETBIT(m_flags, kIsGlyph); }
355
362
365};
366
368
369class OdGePoint2d;
371class OdTtfDescriptor;
372
377class FIRSTDLL_EXPORT OdFont : public OdRxObject
378{
379 OdUInt32 m_Flags;
380
381public:
383
384 OdFont() : m_Flags(0) {}
385
386 enum
387 {
388 kBigFont10 = 0x0001,
389 kUniFont10 = 0x0002,
390 kFont10 = 0x0004,
391 kFont11 = 0x0008,
392 kFont10A = 0x0010,
393 kTrueType = 0x0020,
394 kFontGdt = 0x0040,
396 kShapes11 = 0x0100,
397 kFontRsc = 0x0200 // MicroStation resource file.
398 };
399
421 OdUInt32 getFlags() const { return m_Flags; }
422
444 OdUInt32 flags() { return m_Flags; }
445
467 void setFlags(OdUInt32 fontFlags) { m_Flags = fontFlags; }
468
490 void addFlag(OdUInt32 fontFlags) { m_Flags |= fontFlags; }
491
498 virtual OdResult initialize(OdStreamBuf* pStreamBuf) = 0;
499
510 virtual OdResult drawCharacter(OdChar character, OdGePoint2d& advance, OdGiCommonDraw* pWd,
511 OdTextProperties& textProperties) = 0;
512
523 virtual OdResult drawCharacter(OdChar character, OdGePoint2d& advance,
524 OdGiConveyorGeometry* pGeometry,
525 OdTextProperties& textProperties) = 0;
526
536 virtual OdTrVisRawTexturePtr createCharacterTexture(OdChar /*character*/, OdUInt32 /*height*/, OdUInt32 /*additionalThickness*/, OdTextProperties& /*textProperties*/)
537 {
538 return OdTrVisRawTexturePtr();
539 }
540
546 virtual double getAbove() const = 0;
547
553 virtual double getBelow() const = 0;
554
561 virtual OdUInt32 getAvailableChars(OdCharArray& characters) = 0;
562
569 virtual bool hasCharacter(OdChar character) = 0;
570
576 virtual double getHeight() const // MKU 20.02.2003
577 {
578 return getAbove() + getBelow();
579 }
580
588 virtual double getInternalLeading() const
589 {
590 return 0;
591 }
592
593
594 // removed here from GiContextForDbDatabase.cpp // MKU 04.03.2003
595
603 double fontAbove() const
604 {
605 double above = getAbove();
606 if(OdZero(above))
607 {
608 above = 1.0;
609 }
610 return above;
611 }
612
621 virtual double getUnderlinePos(double textSize) const
622 {
623 return -0.2 * textSize;
624
625 }
626
634 virtual double getOverlinePos(double textSize) const
635 {
636 return 1.2 * textSize;
637 }
638
646 virtual bool isShxFont()
647 {
648 return true;
649 }
650
658 virtual double getAverageWidth()
659 {
660 return 0.0;
661 }
662
688 virtual void getScore( OdChar character,
689 OdGePoint2d& advance,
690 OdGePoint3d* pointsOver,
691 OdGePoint3d* pointsUnder,
692 const OdTextProperties& textFlags);
693
707 virtual OdUInt32 getFontData(
708 OdUInt32 dwTable, // Metric table to query
709 OdUInt32 dwOffset, // Offset into table being queried
710 void * pBuffer, // Pointer to buffer for returned data
711 OdUInt32 cbData ) const;
712
719 virtual bool supportsVerticalMode()
720 {
721 return false;
722 }
723
731 virtual OdString getFileName() const
732 {
733 return OdString();
734 }
735
741 virtual void getDescriptor(OdTtfDescriptor&) const
742 {
743 }
744
755 virtual OdInt32 getLogFont(void* /*lpLogFont*/) const
756 {
757 return -1;
758 }
759};
760
761inline void OdFont::getScore( OdChar /*character*/,
762 OdGePoint2d& /*advance*/,
763 OdGePoint3d* /*pointsOver*/,
764 OdGePoint3d* /*pointsUnder*/,
765 const OdTextProperties& /*flags*/ )
766 {}
767
769 OdUInt32 /*dwTable*/, // Metric table to query
770 OdUInt32 /*dwOffset*/, // Offset into table being queried
771 void * /*lpvBuffer*/, // Pointer to buffer for returned data
772 OdUInt32 /*cbData*/ ) const
773 {
774 return OdUInt32(-1);
775 }
776
777
782
788class FIRSTDLL_EXPORT OdBaseTextIterator : public OdRxObject
789{
790public:
791 virtual OdChar nextChar() = 0;
797 virtual const OdCharacterProperties& currProperties() const = 0;
798
804 virtual const OdChar* currPos() const = 0;
805};
806
811
812#include "TD_PackPop.h"
813
814#endif // !defined(AFX_ODFONT_H__0B76813A_DCFA_450E_8591_B6C6F1ED76EC__INCLUDED_)
815
OdArray< OdChar, OdMemoryAllocator< OdChar > > OdCharArray
OdUInt32 OdFontSubType
Definition OdFont.h:367
OdTagFontType
Definition OdFont.h:53
@ kFontTypeShape
Definition OdFont.h:61
@ kFontTypeShx
Definition OdFont.h:57
@ kFontTypeTrueType
Definition OdFont.h:59
@ kFontTypeUnknown
Definition OdFont.h:55
@ kFontTypeRsc
Definition OdFont.h:65
@ kFontTypeBig
Definition OdFont.h:63
OdSmartPtr< OdFont > OdFontPtr
Definition OdFont.h:781
enum OdTagFontType OdFontType
OdSmartPtr< OdBaseTextIterator > OdBaseTextIteratorPtr
Definition OdFont.h:810
unsigned int OdUInt32
unsigned short OdUInt16
int OdInt32
wchar_t OdChar
OdResult
Definition OdResult.h:29
OdString OdString
Definition OdString.h:1258
bool OdZero(double x, double tol=1.e-10)
Definition OdaDefs.h:532
#define SETBIT(flags, bit, value)
Definition OdaDefs.h:516
#define GETBIT(flags, bit)
Definition OdaDefs.h:517
#define FIRSTDLL_EXPORT
Definition RootExport.h:39
std::shared_ptr< OdTrVisRawTexture > OdTrVisRawTexturePtr
virtual OdChar nextChar()=0
virtual const OdCharacterProperties & currProperties() const =0
virtual const OdChar * currPos() const =0
@ kFontSimplex6
Definition OdFont.h:395
@ kUniFont10
Definition OdFont.h:389
@ kFontGdt
Definition OdFont.h:394
@ kFontRsc
Definition OdFont.h:397
@ kTrueType
Definition OdFont.h:393
@ kFont10A
Definition OdFont.h:392
@ kFont10
Definition OdFont.h:390
@ kShapes11
Definition OdFont.h:396
@ kBigFont10
Definition OdFont.h:388
@ kFont11
Definition OdFont.h:391
virtual OdTrVisRawTexturePtr createCharacterTexture(OdChar, OdUInt32, OdUInt32, OdTextProperties &)
Definition OdFont.h:536
virtual OdUInt32 getAvailableChars(OdCharArray &characters)=0
virtual bool supportsVerticalMode()
Definition OdFont.h:719
virtual OdUInt32 getFontData(OdUInt32 dwTable, OdUInt32 dwOffset, void *pBuffer, OdUInt32 cbData) const
Definition OdFont.h:768
virtual OdString getFileName() const
Definition OdFont.h:731
virtual double getOverlinePos(double textSize) const
Definition OdFont.h:634
void addFlag(OdUInt32 fontFlags)
Definition OdFont.h:490
double fontAbove() const
Definition OdFont.h:603
virtual double getAbove() const =0
virtual OdResult initialize(OdStreamBuf *pStreamBuf)=0
virtual OdResult drawCharacter(OdChar character, OdGePoint2d &advance, OdGiCommonDraw *pWd, OdTextProperties &textProperties)=0
virtual void getDescriptor(OdTtfDescriptor &) const
Definition OdFont.h:741
virtual bool hasCharacter(OdChar character)=0
virtual void getScore(OdChar character, OdGePoint2d &advance, OdGePoint3d *pointsOver, OdGePoint3d *pointsUnder, const OdTextProperties &textFlags)
Definition OdFont.h:761
ODRX_DECLARE_MEMBERS(OdFont)
virtual OdInt32 getLogFont(void *) const
Definition OdFont.h:755
virtual double getHeight() const
Definition OdFont.h:576
OdUInt32 flags()
Definition OdFont.h:444
OdUInt32 getFlags() const
Definition OdFont.h:421
OdFont()
Definition OdFont.h:384
void setFlags(OdUInt32 fontFlags)
Definition OdFont.h:467
virtual double getUnderlinePos(double textSize) const
Definition OdFont.h:621
virtual OdResult drawCharacter(OdChar character, OdGePoint2d &advance, OdGiConveyorGeometry *pGeometry, OdTextProperties &textProperties)=0
virtual double getAverageWidth()
Definition OdFont.h:658
virtual double getInternalLeading() const
Definition OdFont.h:588
virtual double getBelow() const =0
virtual bool isShxFont()
Definition OdFont.h:646
GLsizei const GLfloat * value
Definition gles2_ext.h:302
bool isGlyph() const
Definition OdFont.h:354
void setTrackingPercent(double trackingPercent)
Definition OdFont.h:298
void setInBigFont(bool value)
Definition OdFont.h:242
OdChar m_prevChar
Definition OdFont.h:142
void setTtfPolyDraw(bool bFlag)
Definition OdFont.h:284
void setOverlined(bool value)
Definition OdFont.h:200
double m_scale
Definition OdFont.h:104
bool isStriked() const
Definition OdFont.h:207
bool isNormalText() const
Definition OdFont.h:151
void setNormalText(bool value)
Definition OdFont.h:158
void setTextQuality(OdUInt32 val)
Definition OdFont.h:318
bool isLastPosOnly() const
Definition OdFont.h:340
OdUInt16 m_flags
Definition OdFont.h:106
void setLastChar(bool value)
Definition OdFont.h:228
bool isVerticalText() const
Definition OdFont.h:165
void setVerticalText(bool value)
Definition OdFont.h:172
double m_trackingPercent
Definition OdFont.h:103
void setForMTextExtents(bool value)
Definition OdFont.h:364
bool isTriangleCache() const
Definition OdFont.h:325
bool isForMTextExtents() const
Definition OdFont.h:363
bool isZeroNormals() const
Definition OdFont.h:263
bool isLastChar() const
Definition OdFont.h:221
void setUnderlined(bool value)
Definition OdFont.h:186
void setIncludePenups(bool value)
Definition OdFont.h:256
void setZeroNormals(bool value)
Definition OdFont.h:270
void setGlyph(bool value)
Definition OdFont.h:361
bool isIncludePenups() const
Definition OdFont.h:249
OdUInt16 m_textQuality
Definition OdFont.h:108
bool isUnderlined() const
Definition OdFont.h:179
bool ttfPolyDraw() const
Definition OdFont.h:277
double trackingPercent() const
Definition OdFont.h:291
bool isInBigFont() const
Definition OdFont.h:235
void setLastPosOnly(bool value)
Definition OdFont.h:347
OdUInt32 textQuality() const
Definition OdFont.h:308
void setStriked(bool value)
Definition OdFont.h:214
void setSetTriangleCache(bool value)
Definition OdFont.h:332
bool isOverlined() const
Definition OdFont.h:193