/usr/include/ossim/font/ossimFont.h is in libossim-dev 1.8.16-3+b1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 | //*******************************************************************
//
// License: See top level LICENSE.txt file.
//
// Author: Garrett Potts (gpotts@imagelinks.com)
// Description:
//
//********************************************************************
// $Id: ossimFont.h 17106 2010-04-15 19:12:59Z dburken $
#ifndef ossimFont_HEADER
#define ossimFont_HEADER
#include <ossim/base/ossimIpt.h>
#include <ossim/base/ossimIrect.h>
#include <ossim/base/ossimString.h>
#include <ossim/imaging/ossimRgbImage.h>
#include <ossim/base/ossimConstants.h>
#include <ossim/matrix/newmat.h>
#include <ossim/base/ossimObject.h>
#include <ossim/base/ossimErrorStatusInterface.h>
#include <ossim/base/ossimFontInformation.h>
#define OSSIM_FONT_DEFAULT_SIZE_X 12
#define OSSIM_FONT_DEFAULT_SIZE_Y 12
class ossimFont : public ossimObject, public ossimErrorStatusInterface
{
public:
ossimFont()
:theStringToRasterize(""),
theFamilyName(""),
theStyleName(""),
theRotation(0),
theHorizontalShear(0.0),
theVerticalShear(0.0),
theHorizontalScale(1.0),
theVerticalScale(1.0),
theHorizontalPixelSize(8),
theVerticalPixelSize(8),
theHorizontalDeviceUnits(72),
theVerticalDeviceUnits(72),
theAffineTransform(2,2)
{
theAffineTransform << 1.0 << 0.0
<< 0.0 << 1.0;
}
ossimFont(const ossimString& familyName,
const ossimString& styleName,
int horizontalPixelSize,
int verticalPixelSize,
int horizontalDeviceUnits=72,// 72 dpi is default,
int verticalDeviceUnits=72)// 72 dpi is default
:theStringToRasterize(""),
theFamilyName(familyName),
theStyleName(styleName),
theRotation(0),
theHorizontalShear(0.0),
theVerticalShear(0.0),
theHorizontalScale(1.0),
theVerticalScale(1.0),
theHorizontalPixelSize(horizontalPixelSize),
theVerticalPixelSize(verticalPixelSize),
theHorizontalDeviceUnits(horizontalDeviceUnits),
theVerticalDeviceUnits(verticalDeviceUnits),
theAffineTransform(2,2)
{
theAffineTransform << 1.0 << 0.0
<< 0.0 << 1.0;
}
ossimFont(const ossimFont& rhs)
{
theStringToRasterize = rhs.theStringToRasterize;
theFamilyName = rhs.theFamilyName;
theStyleName = rhs.theStyleName;
theRotation = rhs.theRotation;
theHorizontalShear = rhs.theHorizontalShear;
theVerticalShear = rhs.theVerticalShear;
theHorizontalScale = rhs.theHorizontalScale;
theVerticalScale = rhs.theVerticalScale;
theHorizontalPixelSize = rhs.theHorizontalPixelSize;
theHorizontalDeviceUnits = rhs.theHorizontalDeviceUnits;
theVerticalDeviceUnits = rhs.theVerticalDeviceUnits;
theAffineTransform = rhs.theAffineTransform;
theClippingBox = rhs.theClippingBox;
theLocalOrigin = rhs.theLocalOrigin;
theAffineTransform = rhs.theAffineTransform;
}
virtual ossimObject* dup()const=0;
/*!
* Returns true if this font is a fixed size font
*/
virtual bool isFixed()const=0;
/*!
* You can get a list of fixed sizes supported by
* this font.
*/
virtual void getFixedSizes(vector<ossimIpt>& sizes)const=0;
/*!
* Will return the previously rasterized buffer.
*/
virtual const ossim_uint8* getBuf()const=0;
/*!
* Will return an internal buffer for rasterizing and will
* also set the width, and height arguments of the returned buffer.
*/
virtual const ossim_uint8* rasterize()=0;
virtual const ossim_uint8* rasterize(const ossimString& s)
{
setString(s);
return rasterize();
}
virtual void setString(const ossimString& s)
{
theStringToRasterize = s;
}
/*!
* Will return the bounding box of the last string that was set
* to be rasterized in pixel space
*/
virtual void getBoundingBox(ossimIrect& box)=0;
/*!
* Specifies if its helvetica, times new roman ... etc.
*/
virtual ossimString getFamilyName()const
{
return theFamilyName;
}
/*!
* Specifies if its bold or italic .. etc
*/
virtual ossimString getStyleName()const
{
return theStyleName;
}
/*!
* Allow us to rotate a font.
*/
virtual void setRotation(double rotationInDegrees);
virtual double getRotation()const
{
return theRotation;
}
virtual void getRotation(double& rotation)const
{
rotation = theRotation;
}
virtual void setHorizontalVerticalShear(double horizontalShear,
double verticalShear)
{
theVerticalShear = verticalShear;
theHorizontalShear = horizontalShear;
computeMatrix();
}
virtual void setVerticalShear(double verticalShear)
{
setHorizontalVerticalShear(theHorizontalShear,
verticalShear);
}
virtual void setHorizontalShear(double horizontalShear)
{
setHorizontalVerticalShear(horizontalShear,
theVerticalShear);
}
virtual double getVerticalShear()const
{
return theVerticalShear;
}
virtual double getHorizontalShear()const
{
return theHorizontalShear;
}
/*!
* Sets the scale of the font. I'll have code in place to perform
* reflections. This can be specified with a - scale along the direction
* you wish to reflect.
*/
virtual void setScale(double horizontal,
double vertical);
virtual void getScale(double& horizontal,
double& vertical)
{
horizontal = theHorizontalScale;
vertical = theVerticalScale;
}
virtual void setPixelSize(int horizontalPixelSize,
int verticalPixelSize)
{
theHorizontalPixelSize = horizontalPixelSize;
theVerticalPixelSize = verticalPixelSize;
}
virtual void setPixelSize(int pixelSize)
{
setPixelSize(pixelSize, pixelSize);
}
virtual void getPixelSize(int& horizontal,
int& vertical)
{
horizontal = theHorizontalPixelSize;
vertical = theVerticalPixelSize;
}
virtual long getHorizontalPixelSize()const
{
return theHorizontalPixelSize;
}
virtual ossimIpt getPixelSize()const
{
return ossimIpt(theHorizontalPixelSize,
theVerticalPixelSize);
}
virtual long getVerticalPixelSize()const
{
return theVerticalPixelSize;
}
virtual void setDeviceDpi(int horizontalDeviceUnits,
int verticalDeviceUnits)
{
theHorizontalDeviceUnits = horizontalDeviceUnits;
theVerticalDeviceUnits = verticalDeviceUnits;
}
/*!
* Will clip the clipping box with the bounding box of the string and this
* is the viewable information.
*
* If the clipping box is set then this should be used to get the dimensions
* of the buffer.
*/
virtual void getBufferRect(ossimIrect& bufRect)
{
getBoundingClipBox(bufRect);
}
virtual ossimIrect getBufferRect()
{
return getBoundingClipBox();
}
virtual void getBoundingClipBox(ossimIrect& clippedBox);
virtual ossimIrect getBoundingClipBox();
virtual void setClippingBox(const ossimIrect& clipBox=ossimIrect(0,0,0,0))
{
theClippingBox = clipBox;
}
virtual ossimIrect getClippingBox()const
{
return theClippingBox;
}
bool isIdentityTransform()const
{
return ( (theAffineTransform[0][0] == 1.0) && (theAffineTransform[1][0] == 0.0)&&
(theAffineTransform[0][1] == 0.0) && (theAffineTransform[1][1] == 1.0));
}
virtual void getFontInformation(vector<ossimFontInformation>& fontInformationList)const
{
fontInformationList.push_back(ossimFontInformation(getFamilyName(),
getStyleName(),
getPixelSize(),
isFixed()));
}
protected:
virtual ~ossimFont()
{}
ossimString theStringToRasterize;
ossimString theFamilyName;
ossimString theStyleName;
double theRotation;
double theHorizontalShear;
double theVerticalShear;
double theHorizontalScale;
double theVerticalScale;
int theHorizontalPixelSize;
int theVerticalPixelSize;
int theHorizontalDeviceUnits;
int theVerticalDeviceUnits;
ossimIrect theClippingBox;
/*!
* During the compution of the global bounding rect we will
* Make sure that we save off the upper left since its not really 0,0.
* We will make sure that the bounding rect is shifted to 0,0 but the
* shift will be saved. That way we can render the shape correctly
* later.
*/
mutable ossimIpt theLocalOrigin;
NEWMAT::Matrix theAffineTransform;
void computeMatrix();
TYPE_DATA
};
#endif
|