0022627: Change OCCT memory management defaults
[occt.git] / src / Aspect / Aspect_FontMapEntry.cxx
CommitLineData
7fd59977 1
2// File Aspect_FontMapEntry.cxx
3// Created Septembre 1993
4// Author GG
5
6//-Copyright MatraDatavision 1991,1992
7
8//-Version
9
10//-Design Declaration des variables specifiques aux Entries de
11// Fontures de texts
12
13//-Warning Une entry est definie par un index associee a une Font style
14
15//-References
16
17//-Language C++ 2.0
18
19//-Declarations
20
21// for the class
22#include <Aspect_FontMapEntry.ixx>
23#include <Aspect_Units.hxx>
24
25//-Aliases
26
27//-Global data definitions
28
29// MyType : FontStyle from Aspect
30// MyIndex : Integer from Standard
31// MyTypeIsDef : Boolean from Standard
32// MyIndexIsDef : Boolean from Standard
33
34//-Constructors
35
36//-Destructors
37
38//-Methods, in order
39
40Aspect_FontMapEntry::Aspect_FontMapEntry() {
41
42 MyTypeIsDef = Standard_True;
43 MyIndexIsDef = Standard_True;
44 MyIndex = 0;
45 MyType.SetValues (Aspect_TOF_DEFAULT,3.0 MILLIMETER);
46
47}
48
49Aspect_FontMapEntry::Aspect_FontMapEntry (const Standard_Integer index, const Aspect_FontStyle &style) {
50
51 MyTypeIsDef = Standard_True;
52 MyIndexIsDef = Standard_True;
53 MyIndex = index;
54 MyType = style;
55
56}
57
58Aspect_FontMapEntry::Aspect_FontMapEntry (const Aspect_FontMapEntry& entry) {
59
60 if ( !entry.MyTypeIsDef || !entry.MyIndexIsDef ) {
61 Aspect_BadAccess::Raise("Unallocated FontMapEntry") ;
62 }
63 else {
64 MyTypeIsDef = Standard_True;
65 MyIndexIsDef = Standard_True;
66 MyIndex = entry.MyIndex;
67 MyType = entry.MyType;
68 }
69}
70
71void Aspect_FontMapEntry::SetValue (const Standard_Integer index, const Aspect_FontStyle &style) {
72
73 MyTypeIsDef = Standard_True;
74 MyIndexIsDef = Standard_True;
75 MyIndex = index;
76 MyType = style;
77
78}
79
80void Aspect_FontMapEntry::SetValue (const Aspect_FontMapEntry& entry) {
81
82 if ( !entry.MyTypeIsDef || !entry.MyIndexIsDef ) {
83 Aspect_BadAccess::Raise("Unallocated FontMapEntry") ;
84 }
85 else {
86 MyTypeIsDef = Standard_True;
87 MyIndexIsDef = Standard_True;
88 MyIndex = entry.MyIndex;
89 MyType = entry.MyType;
90 }
91
92}
93
94void Aspect_FontMapEntry::SetType (const Aspect_FontStyle &style) {
95
96 MyTypeIsDef = Standard_True;
97 MyType = style;
98
99}
100
101const Aspect_FontStyle& Aspect_FontMapEntry::Type () const {
102
103 if ( !MyTypeIsDef || !MyIndexIsDef )
104 Aspect_BadAccess::Raise("Unallocated FontMapEntry") ;
105
106 return MyType;
107
108}
109
110void Aspect_FontMapEntry::SetIndex (const Standard_Integer index) {
111
112 MyTypeIsDef = Standard_True;
113 MyIndex = index;
114
115}
116
117Standard_Integer Aspect_FontMapEntry::Index () const {
118
119 if ( !MyTypeIsDef || !MyIndexIsDef )
120 Aspect_BadAccess::Raise("Unallocated FontMapEntry");
121
122 return MyIndex;
123
124}
125
126Standard_Boolean Aspect_FontMapEntry::IsAllocated () const {
127
128 return ( MyTypeIsDef && MyIndexIsDef ) ;
129
130}
131
132void Aspect_FontMapEntry::Free () {
133
134 MyTypeIsDef = Standard_False;
135 MyIndexIsDef = Standard_False;
136
137}
138
139void Aspect_FontMapEntry::Dump () const
140{
141 Aspect_TypeOfFont style = MyType.Style();
142 Standard_CString string = MyType.Value();
143 Standard_Real size = MyType.Size();
144 Standard_Real slant = MyType.Slant();
145 Standard_Integer length = MyType.Length();
146 Standard_Boolean capsheight = MyType.CapsHeight();
147
148 cout << " Aspect_FontMapEntry::Dump ()\n";
149 cout << " MyTypeIsDef : " << (MyTypeIsDef ? "True\n" : "False\n");
150 cout << " MyIndexIsDef : " << (MyIndexIsDef ? "True\n" : "False\n");
151 cout << " FontStyle : " << (Standard_Integer) style << " Size : " << size
152 << " Slant : " << slant << endl;
153 cout << " CapsHeight : " << (capsheight ? "True\n" : "False\n");
154 cout << " FontStyle length : " << length << "\n";
155 if( length ) cout << " FontString : " << string << "\n";
156 MyType.Dump ();
157 cout << " ------------------------------" << endl << flush;
158}