// This may look like C code, but it is really -*- C++ -*-
//
// Copyright Bob Friesenhahn, 2001, 2002
-// Copyright Dirk Lemstra 2014
+// Copyright Dirk Lemstra 2014-2018
//
// TypeMetric Definition
//
#define Magick_TypeMetric_header
#include "Magick++/Include.h"
+#include "Magick++/Drawable.h"
namespace Magick
{
// Destructor
~TypeMetric(void);
- // Ascent, the distance in pixels from the text baseline to the
- // highest/upper grid coordinate used to place an outline point.
+ // The distance in pixels from the text baseline to the highest/upper
+ // grid coordinate used to place an outline point.
double ascent(void) const;
- // Descent, the distance in pixels from the baseline to the lowest
- // grid coordinate used to place an outline point. Always a
- // negative value.
+ // The bounds of the type metric.
+ Geometry bounds(void) const;
+
+ // The distance in pixels from the baseline to the lowest grid coordinate
+ // used to place an outline point. Always a negative value.
double descent(void) const;
// Maximum horizontal advance in pixels.
double maxHorizontalAdvance(void) const;
+ // The origin.
+ Coordinate origin(void) const;
+
+ // The number of pixels per em.
+ Coordinate pixelsPerEm(void) const;
+
// Text height in pixels.
double textHeight(void) const;
// This may look like C code, but it is really -*- C++ -*-
//
// Copyright Bob Friesenhahn, 2001
-// Copyright Dirk Lemstra 2014
+// Copyright Dirk Lemstra 2014-2018
//
// TypeMetric implementation
//
#define MAGICK_PLUSPLUS_IMPLEMENTATION 1
#include "Magick++/TypeMetric.h"
+#include "Magick++/Drawable.h"
#include <string.h>
Magick::TypeMetric::TypeMetric(void)
return(_typeMetric.ascent);
}
+Magick::Geometry Magick::TypeMetric::bounds(void) const
+{
+ return(Geometry((size_t) _typeMetric.bounds.x2-_typeMetric.bounds.x1,
+ (size_t) _typeMetric.bounds.y2-_typeMetric.bounds.y1,(ssize_t)
+ _typeMetric.bounds.x1,(ssize_t) _typeMetric.bounds.y1));
+}
+
double Magick::TypeMetric::descent(void) const
{
return(_typeMetric.descent);
return(_typeMetric.max_advance);
}
+Magick::Coordinate Magick::TypeMetric::origin(void) const
+{
+ return(Coordinate(_typeMetric.origin.x,_typeMetric.origin.y));
+}
+
+Magick::Coordinate Magick::TypeMetric::pixelsPerEm(void) const
+{
+ return(Coordinate(_typeMetric.pixels_per_em.x,_typeMetric.pixels_per_em.y));
+}
+
double Magick::TypeMetric::textHeight(void) const
{
return(_typeMetric.height);