00001 00023 class StringDimensions { 00024 00025 private: 00026 00027 double xadv; 00028 double ymin; 00029 double ymax; 00030 double lineSpacingFactor; 00031 00032 public: 00033 00034 // Constructor: 00035 StringDimensions(double xAdv=0.0, double yMin=0.0,double yMax=0.0,double spacingFactor=1.2){ 00036 xadv = xAdv; 00037 ymin = yMin; 00038 ymax = yMax; 00039 lineSpacingFactor = spacingFactor; 00040 00041 } 00042 00043 // 00044 // Set methods: Accrue mins and maxs: 00045 // On the Y-axis, just take the true min and max. 00046 // 00047 // On the X-axis, sum up all the individual x-advances 00048 // in order to get the overall bounding box: 00049 // 00050 00054 void accrueXAdvance(const double xAdv){ xadv += xAdv; } 00055 00059 void setYMin(const double yMin){ if( yMin < ymin ) ymin = yMin; } 00063 void setYMax(const double yMax){ if( yMax > ymax ) ymax = yMax; } 00064 00065 // Get methods: 00066 const double getXAdvance(){ return xadv; } 00067 const double getYMin(){ return ymin; } 00068 const double getYMax(){ return ymax; } 00069 00074 const double getLineSpacing(){ return (ymax-ymin)*lineSpacingFactor; } 00075 00076 }; 00077