OSSIM - Open Source Software Image Map  Version 1.9.0 (20180803)
ossimFont.h
Go to the documentation of this file.
1 //*******************************************************************
2 //
3 // License: See top level LICENSE.txt file.
4 //
5 // Author: Garrett Potts (gpotts@imagelinks.com)
6 // Description:
7 //
8 //********************************************************************
9 // $Id: ossimFont.h 17106 2010-04-15 19:12:59Z dburken $
10 #ifndef ossimFont_HEADER
11 #define ossimFont_HEADER
12 #include <ossim/base/ossimIpt.h>
13 #include <ossim/base/ossimIrect.h>
14 #include <ossim/base/ossimString.h>
17 #include <ossim/matrix/newmat.h>
18 #include <ossim/base/ossimObject.h>
21 
22 #define OSSIM_FONT_DEFAULT_SIZE_X 12
23 #define OSSIM_FONT_DEFAULT_SIZE_Y 12
24 
26 {
27 public:
30  theFamilyName(""),
31  theStyleName(""),
32  theRotation(0),
33  theHorizontalShear(0.0),
34  theVerticalShear(0.0),
35  theHorizontalScale(1.0),
36  theVerticalScale(1.0),
42  {
43  theAffineTransform << 1.0 << 0.0
44  << 0.0 << 1.0;
45  }
46 
47  ossimFont(const ossimString& familyName,
48  const ossimString& styleName,
49  int horizontalPixelSize,
50  int verticalPixelSize,
51  int horizontalDeviceUnits=72,// 72 dpi is default,
52  int verticalDeviceUnits=72)// 72 dpi is default
54  theFamilyName(familyName),
55  theStyleName(styleName),
56  theRotation(0),
57  theHorizontalShear(0.0),
58  theVerticalShear(0.0),
59  theHorizontalScale(1.0),
60  theVerticalScale(1.0),
61  theHorizontalPixelSize(horizontalPixelSize),
62  theVerticalPixelSize(verticalPixelSize),
63  theHorizontalDeviceUnits(horizontalDeviceUnits),
64  theVerticalDeviceUnits(verticalDeviceUnits),
66  {
67  theAffineTransform << 1.0 << 0.0
68  << 0.0 << 1.0;
69  }
70 
71  ossimFont(const ossimFont& rhs)
72  {
88  }
89  virtual ossimObject* dup()const=0;
90 
94  virtual bool isFixed()const=0;
95 
100  virtual void getFixedSizes(vector<ossimIpt>& sizes)const=0;
101 
105  virtual const ossim_uint8* getBuf()const=0;
106 
111  virtual const ossim_uint8* rasterize()=0;
112 
113  virtual const ossim_uint8* rasterize(const ossimString& s)
114  {
115  setString(s);
116  return rasterize();
117  }
118 
119  virtual void setString(const ossimString& s)
120  {
122  }
123 
128  virtual void getBoundingBox(ossimIrect& box)=0;
129 
133  virtual ossimString getFamilyName()const
134  {
135  return theFamilyName;
136  }
137 
141  virtual ossimString getStyleName()const
142  {
143  return theStyleName;
144  }
145 
149  virtual void setRotation(double rotationInDegrees);
150 
151  virtual double getRotation()const
152  {
153  return theRotation;
154  }
155 
156  virtual void getRotation(double& rotation)const
157  {
158  rotation = theRotation;
159  }
160 
161  virtual void setHorizontalVerticalShear(double horizontalShear,
162  double verticalShear)
163  {
164  theVerticalShear = verticalShear;
165  theHorizontalShear = horizontalShear;
166  computeMatrix();
167  }
168  virtual void setVerticalShear(double verticalShear)
169  {
171  verticalShear);
172  }
173 
174  virtual void setHorizontalShear(double horizontalShear)
175  {
176  setHorizontalVerticalShear(horizontalShear,
178  }
179 
180  virtual double getVerticalShear()const
181  {
182  return theVerticalShear;
183  }
184 
185  virtual double getHorizontalShear()const
186  {
187  return theHorizontalShear;
188  }
189 
195  virtual void setScale(double horizontal,
196  double vertical);
197 
198  virtual void getScale(double& horizontal,
199  double& vertical)
200  {
201  horizontal = theHorizontalScale;
202  vertical = theVerticalScale;
203  }
204 
205  virtual void setPixelSize(int horizontalPixelSize,
206  int verticalPixelSize)
207  {
208  theHorizontalPixelSize = horizontalPixelSize;
209  theVerticalPixelSize = verticalPixelSize;
210  }
211 
212  virtual void setPixelSize(int pixelSize)
213  {
214  setPixelSize(pixelSize, pixelSize);
215  }
216 
217  virtual void getPixelSize(int& horizontal,
218  int& vertical)
219  {
220  horizontal = theHorizontalPixelSize;
221  vertical = theVerticalPixelSize;
222  }
223 
224  virtual long getHorizontalPixelSize()const
225  {
226  return theHorizontalPixelSize;
227  }
228  virtual ossimIpt getPixelSize()const
229  {
232  }
233  virtual long getVerticalPixelSize()const
234  {
235  return theVerticalPixelSize;
236  }
237 
238  virtual void setDeviceDpi(int horizontalDeviceUnits,
239  int verticalDeviceUnits)
240  {
241  theHorizontalDeviceUnits = horizontalDeviceUnits;
242  theVerticalDeviceUnits = verticalDeviceUnits;
243  }
244 
252  virtual void getBufferRect(ossimIrect& bufRect)
253  {
254  getBoundingClipBox(bufRect);
255  }
256 
258  {
259  return getBoundingClipBox();
260  }
261 
262  virtual void getBoundingClipBox(ossimIrect& clippedBox);
263 
264  virtual ossimIrect getBoundingClipBox();
265 
266  virtual void setClippingBox(const ossimIrect& clipBox=ossimIrect(0,0,0,0))
267  {
268  theClippingBox = clipBox;
269  }
270 
271  virtual ossimIrect getClippingBox()const
272  {
273  return theClippingBox;
274  }
275 
277  {
278  return ( (theAffineTransform[0][0] == 1.0) && (theAffineTransform[1][0] == 0.0)&&
279  (theAffineTransform[0][1] == 0.0) && (theAffineTransform[1][1] == 1.0));
280  }
281  virtual void getFontInformation(vector<ossimFontInformation>& fontInformationList)const
282  {
283  fontInformationList.push_back(ossimFontInformation(getFamilyName(),
284  getStyleName(),
285  getPixelSize(),
286  isFixed()));
287  }
288 
289 protected:
290  virtual ~ossimFont()
291  {}
295  double theRotation;
313 
314  NEWMAT::Matrix theAffineTransform;
315 
316 
317  void computeMatrix();
318 
319 TYPE_DATA
320 };
321 
322 #endif
ossimString theStringToRasterize
Definition: ossimFont.h:292
virtual double getHorizontalShear() const
Definition: ossimFont.h:185
virtual void getBufferRect(ossimIrect &bufRect)
Definition: ossimFont.h:252
virtual void setHorizontalShear(double horizontalShear)
Definition: ossimFont.h:174
virtual ~ossimFont()
Definition: ossimFont.h:290
double theHorizontalShear
Definition: ossimFont.h:296
double theRotation
Definition: ossimFont.h:295
bool isIdentityTransform() const
Definition: ossimFont.h:276
ossimString theStyleName
Definition: ossimFont.h:294
virtual ossimIrect getBoundingClipBox()
Definition: ossimFont.cpp:63
NEWMAT::Matrix theAffineTransform
Definition: ossimFont.h:314
virtual const ossim_uint8 * rasterize(const ossimString &s)
Definition: ossimFont.h:113
double theVerticalShear
Definition: ossimFont.h:297
virtual void getFontInformation(vector< ossimFontInformation > &fontInformationList) const
Definition: ossimFont.h:281
void computeMatrix()
Definition: ossimFont.cpp:35
ossimIrect theClippingBox
Definition: ossimFont.h:304
virtual void getRotation(double &rotation) const
Definition: ossimFont.h:156
virtual long getVerticalPixelSize() const
Definition: ossimFont.h:233
virtual void setVerticalShear(double verticalShear)
Definition: ossimFont.h:168
ossimFont()
Definition: ossimFont.h:28
int theHorizontalDeviceUnits
Definition: ossimFont.h:302
double theVerticalScale
Definition: ossimFont.h:299
virtual ossimIrect getClippingBox() const
Definition: ossimFont.h:271
virtual const ossim_uint8 * rasterize()=0
virtual ossimIrect getBufferRect()
Definition: ossimFont.h:257
virtual bool isFixed() const =0
ossimFont(const ossimFont &rhs)
Definition: ossimFont.h:71
virtual ossimString getFamilyName() const
Definition: ossimFont.h:133
#define TYPE_DATA
Definition: ossimRtti.h:339
virtual void setPixelSize(int pixelSize)
Definition: ossimFont.h:212
virtual void getBoundingBox(ossimIrect &box)=0
ossimIpt theLocalOrigin
Definition: ossimFont.h:312
virtual ossimObject * dup() const =0
virtual ossimString getStyleName() const
Definition: ossimFont.h:141
virtual void setHorizontalVerticalShear(double horizontalShear, double verticalShear)
Definition: ossimFont.h:161
virtual void setDeviceDpi(int horizontalDeviceUnits, int verticalDeviceUnits)
Definition: ossimFont.h:238
virtual void setString(const ossimString &s)
Definition: ossimFont.h:119
virtual void setClippingBox(const ossimIrect &clipBox=ossimIrect(0, 0, 0, 0))
Definition: ossimFont.h:266
virtual void setScale(double horizontal, double vertical)
Definition: ossimFont.cpp:26
virtual void getFixedSizes(vector< ossimIpt > &sizes) const =0
virtual void setPixelSize(int horizontalPixelSize, int verticalPixelSize)
Definition: ossimFont.h:205
virtual void getScale(double &horizontal, double &vertical)
Definition: ossimFont.h:198
virtual ossimIpt getPixelSize() const
Definition: ossimFont.h:228
virtual void getPixelSize(int &horizontal, int &vertical)
Definition: ossimFont.h:217
virtual long getHorizontalPixelSize() const
Definition: ossimFont.h:224
ossimFont(const ossimString &familyName, const ossimString &styleName, int horizontalPixelSize, int verticalPixelSize, int horizontalDeviceUnits=72, int verticalDeviceUnits=72)
Definition: ossimFont.h:47
virtual double getVerticalShear() const
Definition: ossimFont.h:180
virtual void setRotation(double rotationInDegrees)
Definition: ossimFont.cpp:19
ossimString theFamilyName
Definition: ossimFont.h:293
int theHorizontalPixelSize
Definition: ossimFont.h:300
virtual double getRotation() const
Definition: ossimFont.h:151
virtual const ossim_uint8 * getBuf() const =0
unsigned char ossim_uint8
int theVerticalDeviceUnits
Definition: ossimFont.h:303
int theVerticalPixelSize
Definition: ossimFont.h:301
double theHorizontalScale
Definition: ossimFont.h:298