CFx SDK Documentation 2024 SP0
Loading...
Searching...
No Matches
OdFont.h
Go to the documentation of this file.
1
2// Copyright (C) 2002-2022, 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-2022 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
38// For memset below
39#include <memory.h>
40
41class OdGiCommonDraw;
43class OdGePoint2d;
44class OdGePoint3d;
45class OdStreamBuf;
46
47#include "TD_PackPush.h"
48
52typedef enum {
64 kFontTypeRsc = 5
66
73{
75 { ::memset(this, 0, sizeof(*this)); }
87 bool bAsian;
89 bool bValid;
92};
93
100{
107 enum
108 {
110 kNormalText = 0x01,
112 kVerticalText = 0x02,
114 kUnderlined = 0x04,
116 kOverlined = 0x08,
118 kLastChar = 0x10,
120 kInBigFont = 0x20,
122 kInclPenups = 0x40,
124 kZeroNormals = 0x80,
126 kBezierCurves = 0x100,
128 kStriked = 0x200,
130 kLastPosOnly = 0x400, //
132 kTriangleCache = 0x800,
134 kIsGlyph = 0x1000
135 ,kExtentsCalculation = 0x4000 //FELIX_CHANGE
136 };
139public:
140 OdTextProperties() : m_flags(0), m_trackingPercent(0.0), m_textQuality(50), m_prevChar(0) {}
141
147 bool isNormalText() const { return GETBIT(m_flags, kNormalText); }
148
154 void setNormalText(bool value) { SETBIT(m_flags, kNormalText, value); }
155
161 bool isVerticalText() const { return GETBIT(m_flags, kVerticalText); }
162
168 void setVerticalText(bool value) { SETBIT(m_flags, kVerticalText, value); }
169
175 bool isUnderlined() const { return GETBIT(m_flags, kUnderlined); }
176
182 void setUnderlined(bool value) { SETBIT(m_flags, kUnderlined, value); }
183
189 bool isOverlined() const { return GETBIT(m_flags, kOverlined); }
190
196 void setOverlined(bool value) { SETBIT(m_flags, kOverlined, value); }
197
203 bool isStriked() const { return GETBIT(m_flags, kStriked); }
204
210 void setStriked(bool value) { SETBIT(m_flags, kStriked, value); }
211
217 bool isLastChar() const { return GETBIT(m_flags, kLastChar); }
218
224 void setLastChar(bool value) { SETBIT(m_flags, kLastChar, value); }
225
231 bool isInBigFont() const { return GETBIT(m_flags, kInBigFont); }
232
238 void setInBigFont(bool value) { SETBIT(m_flags, kInBigFont, value); }
239
245 bool isIncludePenups() const { return GETBIT(m_flags, kInclPenups); }
246
252 void setIncludePenups(bool value) { SETBIT(m_flags, kInclPenups, value); }
253
259 bool isZeroNormals() const { return GETBIT(m_flags, kZeroNormals); }
260
266 void setZeroNormals(bool value) { SETBIT(m_flags, kZeroNormals, value); }
267
273 bool ttfPolyDraw() const { return GETBIT(m_flags, kBezierCurves); }
274
280 void setTtfPolyDraw(bool bFlag) { SETBIT(m_flags, kBezierCurves, bFlag); }
281
287 double trackingPercent() const {return m_trackingPercent; }
288
294 void setTrackingPercent(double trackingPercent) { m_trackingPercent = trackingPercent; }
295
304 OdUInt32 textQuality() const { return m_textQuality; }
305
314 void setTextQuality(OdUInt32 val) { m_textQuality = (OdUInt16)val; }
315
321 bool isTriangleCache() const { return GETBIT(m_flags, kTriangleCache); }
322
328 void setSetTriangleCache(bool value) { SETBIT(m_flags, kTriangleCache, value); }
329
330 // For internal use only
336 bool isLastPosOnly() const { return GETBIT(m_flags, kLastPosOnly); }
337
343 void setLastPosOnly(bool value) { SETBIT(m_flags, kLastPosOnly, value); }
344
350 bool isGlyph() const { return GETBIT(m_flags, kIsGlyph); }
351
357 void setGlyph(bool value) { SETBIT(m_flags, kIsGlyph, value); }
358};
359
361
362class OdGePoint2d;
364class OdTtfDescriptor;
365
371{
372 OdUInt32 m_Flags;
373
374public:
376
377 OdFont() : m_Flags(0) {}
378
379 enum
380 {
381 kBigFont10 = 0x0001,
382 kUniFont10 = 0x0002,
383 kFont10 = 0x0004,
384 kFont11 = 0x0008,
385 kFont10A = 0x0010,
386 kTrueType = 0x0020,
387 kFontGdt = 0x0040,
388 kFontSimplex6 = 0x0080,
389 kShapes11 = 0x0100,
390 kFontRsc = 0x0200 // MicroStation resource file.
391 };
392
414 OdUInt32 getFlags() const { return m_Flags; }
415
437 OdUInt32 flags() { return m_Flags; }
438
460 void setFlags(OdUInt32 fontFlags) { m_Flags = fontFlags; }
461
483 void addFlag(OdUInt32 fontFlags) { m_Flags |= fontFlags; }
484
491 virtual OdResult initialize(OdStreamBuf* pStreamBuf) = 0;
492
503 virtual OdResult drawCharacter(OdChar character, OdGePoint2d& advance, OdGiCommonDraw* pWd,
504 OdTextProperties& textProperties) = 0;
505
516 virtual OdResult drawCharacter(OdChar character, OdGePoint2d& advance,
517 OdGiConveyorGeometry* pGeometry,
518 OdTextProperties& textProperties) = 0;
524 virtual double getAbove() const = 0;
525
531 virtual double getBelow() const = 0;
532
539 virtual OdUInt32 getAvailableChars(OdCharArray& characters) = 0;
540
547 virtual bool hasCharacter(OdChar character) = 0;
548
554 virtual double getHeight() const // MKU 20.02.2003
555 {
556 return getAbove() + getBelow();
557 }
558
566 virtual double getInternalLeading() const
567 {
568 return 0;
569 }
570
571
572 // removed here from GiContextForDbDatabase.cpp // MKU 04.03.2003
573
581 double fontAbove() const
582 {
583 double above = getAbove();
584 if(OdZero(above))
585 {
586 above = 1.0;
587 }
588 return above;
589 }
590
599 virtual double getUnderlinePos(double textSize) const
600 {
601 return -0.2 * textSize;
602
603 }
612 virtual double getOverlinePos(double textSize) const
613 {
614 return 1.2 * textSize;
615 }
616
624 virtual bool isShxFont()
625 {
626 return true;
627 }
628
636 virtual double getAverageWidth()
637 {
638 return 0.0;
639 }
640
666 virtual void getScore( OdChar character,
667 OdGePoint2d& advance,
668 OdGePoint3d* pointsOver,
669 OdGePoint3d* pointsUnder,
670 const OdTextProperties& textFlags);
671
685 virtual OdUInt32 getFontData(
686 OdUInt32 dwTable, // Metric table to query
687 OdUInt32 dwOffset, // Offset into table being queried
688 void * pBuffer, // Pointer to buffer for returned data
689 OdUInt32 cbData ) const;
690
697 virtual bool supportsVerticalMode()
698 {
699 return false;
700 }
701
709 virtual OdString getFileName() const
710 {
711 return OdString();
712 }
713
719 virtual void getDescriptor(OdTtfDescriptor& descr) const
720 {
721 }
722
733 virtual OdInt32 getLogFont(void* lpLogFont) const
734 {
735 return -1;
736 }
737};
738
739inline void OdFont::getScore( OdChar /*character*/,
740 OdGePoint2d& /*advance*/,
741 OdGePoint3d* /*pointsOver*/,
742 OdGePoint3d* /*pointsUnder*/,
743 const OdTextProperties& /*flags*/ )
744 {}
745
747 OdUInt32 /*dwTable*/, // Metric table to query
748 OdUInt32 /*dwOffset*/, // Offset into table being queried
749 void * /*lpvBuffer*/, // Pointer to buffer for returned data
750 OdUInt32 /*cbData*/ ) const
751 {
752 return OdUInt32(-1);
753 }
754
755
760
767{
768public:
769 virtual OdChar nextChar() = 0;
775 virtual const OdCharacterProperties& currProperties() const = 0;
776
782 virtual const OdChar* currPos() const = 0;
783};
784
789
790#include "TD_PackPop.h"
791
792#endif // !defined(AFX_ODFONT_H__0B76813A_DCFA_450E_8591_B6C6F1ED76EC__INCLUDED_)
793
OdFontType
Definition: OdFont.h:52
@ kFontTypeShape
Definition: OdFont.h:60
@ kFontTypeShx
Definition: OdFont.h:56
@ kFontTypeTrueType
Definition: OdFont.h:58
@ kFontTypeUnknown
Definition: OdFont.h:54
@ kFontTypeRsc
Definition: OdFont.h:64
@ kFontTypeBig
Definition: OdFont.h:62
OdUInt32 OdFontSubType
Definition: OdFont.h:360
OdSmartPtr< OdFont > OdFontPtr
Definition: OdFont.h:759
OdSmartPtr< OdBaseTextIterator > OdBaseTextIteratorPtr
Definition: OdFont.h:788
unsigned int OdUInt32
unsigned short OdUInt16
int OdInt32
wchar_t OdChar
OdResult
Definition: OdResult.h:29
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
virtual OdChar nextChar()=0
virtual const OdCharacterProperties & currProperties() const =0
virtual const OdChar * currPos() const =0
Definition: OdFont.h:371
virtual void getDescriptor(OdTtfDescriptor &descr) const
Definition: OdFont.h:719
virtual OdUInt32 getAvailableChars(OdCharArray &characters)=0
virtual bool supportsVerticalMode()
Definition: OdFont.h:697
virtual OdUInt32 getFontData(OdUInt32 dwTable, OdUInt32 dwOffset, void *pBuffer, OdUInt32 cbData) const
Definition: OdFont.h:746
virtual OdString getFileName() const
Definition: OdFont.h:709
virtual double getOverlinePos(double textSize) const
Definition: OdFont.h:612
void addFlag(OdUInt32 fontFlags)
Definition: OdFont.h:483
double fontAbove() const
Definition: OdFont.h:581
virtual double getAbove() const =0
virtual OdResult initialize(OdStreamBuf *pStreamBuf)=0
virtual OdResult drawCharacter(OdChar character, OdGePoint2d &advance, OdGiCommonDraw *pWd, OdTextProperties &textProperties)=0
virtual OdInt32 getLogFont(void *lpLogFont) const
Definition: OdFont.h:733
virtual bool hasCharacter(OdChar character)=0
virtual void getScore(OdChar character, OdGePoint2d &advance, OdGePoint3d *pointsOver, OdGePoint3d *pointsUnder, const OdTextProperties &textFlags)
Definition: OdFont.h:739
ODRX_DECLARE_MEMBERS(OdFont)
virtual double getHeight() const
Definition: OdFont.h:554
OdUInt32 flags()
Definition: OdFont.h:437
OdUInt32 getFlags() const
Definition: OdFont.h:414
OdFont()
Definition: OdFont.h:377
void setFlags(OdUInt32 fontFlags)
Definition: OdFont.h:460
virtual double getUnderlinePos(double textSize) const
Definition: OdFont.h:599
virtual OdResult drawCharacter(OdChar character, OdGePoint2d &advance, OdGiConveyorGeometry *pGeometry, OdTextProperties &textProperties)=0
virtual double getAverageWidth()
Definition: OdFont.h:636
virtual double getInternalLeading() const
Definition: OdFont.h:566
virtual double getBelow() const =0
virtual bool isShxFont()
Definition: OdFont.h:624
GLsizei const GLfloat * value
Definition: gles2_ext.h:302
bool isGlyph() const
Definition: OdFont.h:350
void setTrackingPercent(double trackingPercent)
Definition: OdFont.h:294
void setInBigFont(bool value)
Definition: OdFont.h:238
OdChar m_prevChar
Definition: OdFont.h:138
void setTtfPolyDraw(bool bFlag)
Definition: OdFont.h:280
void setOverlined(bool value)
Definition: OdFont.h:196
bool isStriked() const
Definition: OdFont.h:203
bool isNormalText() const
Definition: OdFont.h:147
void setNormalText(bool value)
Definition: OdFont.h:154
void setTextQuality(OdUInt32 val)
Definition: OdFont.h:314
bool isLastPosOnly() const
Definition: OdFont.h:336
OdUInt16 m_flags
Definition: OdFont.h:104
void setLastChar(bool value)
Definition: OdFont.h:224
bool isVerticalText() const
Definition: OdFont.h:161
void setVerticalText(bool value)
Definition: OdFont.h:168
double m_trackingPercent
Definition: OdFont.h:102
bool isTriangleCache() const
Definition: OdFont.h:321
bool isZeroNormals() const
Definition: OdFont.h:259
bool isLastChar() const
Definition: OdFont.h:217
void setUnderlined(bool value)
Definition: OdFont.h:182
void setIncludePenups(bool value)
Definition: OdFont.h:252
void setZeroNormals(bool value)
Definition: OdFont.h:266
void setGlyph(bool value)
Definition: OdFont.h:357
bool isIncludePenups() const
Definition: OdFont.h:245
OdUInt16 m_textQuality
Definition: OdFont.h:106
bool isUnderlined() const
Definition: OdFont.h:175
bool ttfPolyDraw() const
Definition: OdFont.h:273
double trackingPercent() const
Definition: OdFont.h:287
bool isInBigFont() const
Definition: OdFont.h:231
void setLastPosOnly(bool value)
Definition: OdFont.h:343
OdUInt32 textQuality() const
Definition: OdFont.h:304
void setStriked(bool value)
Definition: OdFont.h:210
void setSetTriangleCache(bool value)
Definition: OdFont.h:328
bool isOverlined() const
Definition: OdFont.h:189