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
#ifndef __FTBBox__
#define __FTBBox__
#include <ft2build.h>
#include FT_FREETYPE_H
#include FT_GLYPH_H
#include "FTGL.h"
/**
* FTBBox is a convenience class for handling bounding boxes.
*/
class FTGL_EXPORT FTBBox
{
public:
/**
* Default constructor. Bounding box is set to zero.
*/
FTBBox()
: lowerX(0),
lowerY(0),
lowerZ(0),
upperX(0),
upperY(0),
upperZ(0)
{}
/**
* Constructor. Extracts a bounding box from a freetype glyph. Uses
* the control box for the glyph. <code>FT_Glyph_Get_CBox()</code>
*
* @param glyph A freetype glyph
*/
FTBBox( FT_Glyph glyph)
{
FT_BBox bbox;
FT_Glyph_Get_CBox( glyph, ft_glyph_bbox_subpixels, &bbox );
lowerX = bbox.xMin >> 6;
lowerY = bbox.yMin >> 6;
lowerZ = 0;
upperX = bbox.xMax >> 6;
upperY = bbox.yMax >> 6;
upperZ = 0;
}
/**
* Destructor
*/
~FTBBox()
{}
/**
* The bounds of the box
*/
// Make these ftPoints & private
float lowerX, lowerY, lowerZ, upperX, upperY, upperZ;
protected:
private:
};
#endif // __FTBBox__