LASi: stringDimensions.h Source File

LASi

stringDimensions.h
Go to the documentation of this file.
1
23 class StringDimensions {
24
25 private:
26
27 double xadv;
28 double ymin;
29 double ymax;
30 double lineSpacingFactor;
31
32 public:
33
34 // Constructor:
35 StringDimensions(double xAdv=0.0, double yMin=0.0,double yMax=0.0,double spacingFactor=1.2){
36 xadv = xAdv;
37 ymin = yMin;
38 ymax = yMax;
39 lineSpacingFactor = spacingFactor;
40
41 }
42
43 //
44 // Set methods: Accrue mins and maxs:
45 // On the Y-axis, just take the true min and max.
46 //
47 // On the X-axis, sum up all the individual x-advances
48 // in order to get the overall bounding box:
49 //
50
54 void accrueXAdvance(const double xAdv){ xadv += xAdv; }
55
59 void setYMin(const double yMin){ if( yMin < ymin ) ymin = yMin; }
63 void setYMax(const double yMax){ if( yMax > ymax ) ymax = yMax; }
64
65 // Get methods:
66 const double getXAdvance(){ return xadv; }
67 const double getYMin(){ return ymin; }
68 const double getYMax(){ return ymax; }
69
74 const double getLineSpacing(){ return (ymax-ymin)*lineSpacingFactor; }
75
76 };
77
StringDimensions::StringDimensions
StringDimensions(double xAdv=0.0, double yMin=0.0, double yMax=0.0, double spacingFactor=1.2)
Definition: stringDimensions.h:35
StringDimensions::ymin
double ymin
Definition: stringDimensions.h:28
StringDimensions::setYMin
void setYMin(const double yMin)
Keep a running tab on the minimum y value (descent) from all glyphs:
Definition: stringDimensions.h:59
StringDimensions::accrueXAdvance
void accrueXAdvance(const double xAdv)
Sum up the individual x advances of each glyph:
Definition: stringDimensions.h:54
StringDimensions::getXAdvance
const double getXAdvance()
Definition: stringDimensions.h:66
StringDimensions::getLineSpacing
const double getLineSpacing()
Line spacing is just the maximum ascent minus the maximum descent multiplied by the line spacing fact...
Definition: stringDimensions.h:74
StringDimensions::getYMax
const double getYMax()
Definition: stringDimensions.h:68
StringDimensions::getYMin
const double getYMin()
Definition: stringDimensions.h:67
StringDimensions
Class StringDimensions maintains the relevant dimensions of a text string realized (i...
Definition: stringDimensions.h:23
StringDimensions::setYMax
void setYMax(const double yMax)
Keep a running tab on the maximum y value (ascent) from all glyphs:
Definition: stringDimensions.h:63
StringDimensions::lineSpacingFactor
double lineSpacingFactor
Definition: stringDimensions.h:30
StringDimensions::xadv
double xadv
Definition: stringDimensions.h:27
StringDimensions::ymax
double ymax
Definition: stringDimensions.h:29