0024166: Unable to create file with "Save" menu of voxeldemo Qt sample
[occt.git] / src / Aspect / Aspect_FontMapEntry.cxx
CommitLineData
b311480e 1// Created on: 1993-09-14
2// Created by: GG
3// Copyright (c) 1993-1999 Matra Datavision
4// Copyright (c) 1999-2012 OPEN CASCADE SAS
5//
6// The content of this file is subject to the Open CASCADE Technology Public
7// License Version 6.5 (the "License"). You may not use the content of this file
8// except in compliance with the License. Please obtain a copy of the License
9// at http://www.opencascade.org and read it completely before using this file.
10//
11// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
12// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
13//
14// The Original Code and all software distributed under the License is
15// distributed on an "AS IS" basis, without warranty of any kind, and the
16// Initial Developer hereby disclaims all such warranties, including without
17// limitation, any warranties of merchantability, fitness for a particular
18// purpose or non-infringement. Please see the License for the specific terms
19// and conditions governing the rights and limitations under the License.
20
7fd59977 21
7fd59977 22
7fd59977 23
24//-Version
25
26//-Design Declaration des variables specifiques aux Entries de
27// Fontures de texts
28
29//-Warning Une entry est definie par un index associee a une Font style
30
31//-References
32
33//-Language C++ 2.0
34
35//-Declarations
36
37// for the class
38#include <Aspect_FontMapEntry.ixx>
39#include <Aspect_Units.hxx>
40
41//-Aliases
42
43//-Global data definitions
44
45// MyType : FontStyle from Aspect
46// MyIndex : Integer from Standard
47// MyTypeIsDef : Boolean from Standard
48// MyIndexIsDef : Boolean from Standard
49
50//-Constructors
51
52//-Destructors
53
54//-Methods, in order
55
56Aspect_FontMapEntry::Aspect_FontMapEntry() {
57
58 MyTypeIsDef = Standard_True;
59 MyIndexIsDef = Standard_True;
60 MyIndex = 0;
61 MyType.SetValues (Aspect_TOF_DEFAULT,3.0 MILLIMETER);
62
63}
64
65Aspect_FontMapEntry::Aspect_FontMapEntry (const Standard_Integer index, const Aspect_FontStyle &style) {
66
67 MyTypeIsDef = Standard_True;
68 MyIndexIsDef = Standard_True;
69 MyIndex = index;
70 MyType = style;
71
72}
73
74Aspect_FontMapEntry::Aspect_FontMapEntry (const Aspect_FontMapEntry& entry) {
75
76 if ( !entry.MyTypeIsDef || !entry.MyIndexIsDef ) {
77 Aspect_BadAccess::Raise("Unallocated FontMapEntry") ;
78 }
79 else {
80 MyTypeIsDef = Standard_True;
81 MyIndexIsDef = Standard_True;
82 MyIndex = entry.MyIndex;
83 MyType = entry.MyType;
84 }
85}
86
87void Aspect_FontMapEntry::SetValue (const Standard_Integer index, const Aspect_FontStyle &style) {
88
89 MyTypeIsDef = Standard_True;
90 MyIndexIsDef = Standard_True;
91 MyIndex = index;
92 MyType = style;
93
94}
95
96void Aspect_FontMapEntry::SetValue (const Aspect_FontMapEntry& entry) {
97
98 if ( !entry.MyTypeIsDef || !entry.MyIndexIsDef ) {
99 Aspect_BadAccess::Raise("Unallocated FontMapEntry") ;
100 }
101 else {
102 MyTypeIsDef = Standard_True;
103 MyIndexIsDef = Standard_True;
104 MyIndex = entry.MyIndex;
105 MyType = entry.MyType;
106 }
107
108}
109
110void Aspect_FontMapEntry::SetType (const Aspect_FontStyle &style) {
111
112 MyTypeIsDef = Standard_True;
113 MyType = style;
114
115}
116
117const Aspect_FontStyle& Aspect_FontMapEntry::Type () const {
118
119 if ( !MyTypeIsDef || !MyIndexIsDef )
120 Aspect_BadAccess::Raise("Unallocated FontMapEntry") ;
121
122 return MyType;
123
124}
125
126void Aspect_FontMapEntry::SetIndex (const Standard_Integer index) {
127
128 MyTypeIsDef = Standard_True;
129 MyIndex = index;
130
131}
132
133Standard_Integer Aspect_FontMapEntry::Index () const {
134
135 if ( !MyTypeIsDef || !MyIndexIsDef )
136 Aspect_BadAccess::Raise("Unallocated FontMapEntry");
137
138 return MyIndex;
139
140}
141
142Standard_Boolean Aspect_FontMapEntry::IsAllocated () const {
143
144 return ( MyTypeIsDef && MyIndexIsDef ) ;
145
146}
147
148void Aspect_FontMapEntry::Free () {
149
150 MyTypeIsDef = Standard_False;
151 MyIndexIsDef = Standard_False;
152
153}
154
155void Aspect_FontMapEntry::Dump () const
156{
157 Aspect_TypeOfFont style = MyType.Style();
158 Standard_CString string = MyType.Value();
159 Standard_Real size = MyType.Size();
160 Standard_Real slant = MyType.Slant();
161 Standard_Integer length = MyType.Length();
162 Standard_Boolean capsheight = MyType.CapsHeight();
163
164 cout << " Aspect_FontMapEntry::Dump ()\n";
165 cout << " MyTypeIsDef : " << (MyTypeIsDef ? "True\n" : "False\n");
166 cout << " MyIndexIsDef : " << (MyIndexIsDef ? "True\n" : "False\n");
167 cout << " FontStyle : " << (Standard_Integer) style << " Size : " << size
168 << " Slant : " << slant << endl;
169 cout << " CapsHeight : " << (capsheight ? "True\n" : "False\n");
170 cout << " FontStyle length : " << length << "\n";
171 if( length ) cout << " FontString : " << string << "\n";
172 MyType.Dump ();
173 cout << " ------------------------------" << endl << flush;
174}