float FontAsset::GetTextWidth (const string& text) { float width = 0; float x = 0; float y = 0; for (uint i = 0; i < text.size(); i++) { BBox verts; BBox texCoords; GetGlyphData(text[i], &x, &y, &verts, &texCoords); width = verts.max.x; } return width; }
float TTFFontAsset::GetTextWidth(const std::string &text) { float width = 0; float x,y; for (int i = 0; i < text.size(); i++) { Rect verts; Rect texCoords; GetGlyphData(text[i], &x, &y, verts, texCoords); width = verts.bottomRight.x; } return width; }
float TTFFontAsset::GetTextHeight(const std::string &text) { float height = 0; for (int i = 0; i < text.size(); i++) { float x=0, y=0; Rect verts; Rect texCoords; GetGlyphData(text[i], &x, &y, verts, texCoords); height = MAX(height, verts.bottomRight.y - verts.topLeft.y); } return height; }
float FontAsset::GetTextHeight (const string& text) { float top = 0; float bottom = 0; for (uint i = 0; i < text.size(); i++) { float x = 0; float y = 0; BBox verts; BBox texCoords; GetGlyphData(text[i], &x, &y, &verts, &texCoords); top = MIN(verts.min.y, top); bottom = MAX(verts.max.y, bottom); } return bottom - top; }
float TTFFontAsset::GetTextHeight(const std::string &text) { //float height = 0; float top = 0, bottom = 0; for (int i = 0; i < text.size(); i++) { float x=0, y=0; Rect verts; Rect texCoords; GetGlyphData(text[i], &x, &y, verts, texCoords); //height = MAX(height, verts.bottomRight.y - verts.topLeft.y); top = MIN(verts.topLeft.y, top); bottom = MAX(verts.bottomRight.y, bottom); } //return height; return bottom - top; }