1 // This may look like C code, but it is really -*- C++ -*- 2 // 3 // Copyright Bob Friesenhahn, 2001 4 // Copyright Dirk Lemstra 2014-2018 5 // 6 // TypeMetric implementation 7 // 8 9 #define MAGICKCORE_IMPLEMENTATION 1 10 #define MAGICK_PLUSPLUS_IMPLEMENTATION 1 11 12 #include "Magick++/TypeMetric.h" 13 #include "Magick++/Drawable.h" 14 #include <string.h> 15 TypeMetric(void)16Magick::TypeMetric::TypeMetric(void) 17 { 18 memset(&_typeMetric,0,sizeof(_typeMetric)); 19 } 20 ~TypeMetric(void)21Magick::TypeMetric::~TypeMetric(void) 22 { 23 } 24 ascent(void) const25double Magick::TypeMetric::ascent(void) const 26 { 27 return(_typeMetric.ascent); 28 } 29 bounds(void) const30Magick::Geometry Magick::TypeMetric::bounds(void) const 31 { 32 return(Geometry((size_t) (_typeMetric.bounds.x2-_typeMetric.bounds.x1), 33 (size_t) (_typeMetric.bounds.y2-_typeMetric.bounds.y1),(ssize_t) 34 _typeMetric.bounds.x1,(ssize_t) _typeMetric.bounds.y1)); 35 } 36 descent(void) const37double Magick::TypeMetric::descent(void) const 38 { 39 return(_typeMetric.descent); 40 } 41 maxHorizontalAdvance(void) const42double Magick::TypeMetric::maxHorizontalAdvance(void) const 43 { 44 return(_typeMetric.max_advance); 45 } 46 origin(void) const47Magick::Coordinate Magick::TypeMetric::origin(void) const 48 { 49 return(Coordinate(_typeMetric.origin.x,_typeMetric.origin.y)); 50 } 51 pixelsPerEm(void) const52Magick::Coordinate Magick::TypeMetric::pixelsPerEm(void) const 53 { 54 return(Coordinate(_typeMetric.pixels_per_em.x,_typeMetric.pixels_per_em.y)); 55 } 56 textHeight(void) const57double Magick::TypeMetric::textHeight(void) const 58 { 59 return(_typeMetric.height); 60 } 61 textWidth(void) const62double Magick::TypeMetric::textWidth(void) const 63 { 64 return(_typeMetric.width); 65 } 66 underlinePosition(void) const67double Magick::TypeMetric::underlinePosition(void) const 68 { 69 return(_typeMetric.underline_position); 70 } 71 underlineThickness(void) const72double Magick::TypeMetric::underlineThickness(void) const 73 { 74 return(_typeMetric.underline_thickness); 75 } 76