void Font::Draw(std::string str, float x, float y) { for(int i=0; i<str.length(); i++) { FontChar *c = GetChar(str.at(i)); if (!c) continue; c->Draw(x,y,sx,sy); x+=(c->AdvanceX() >> 6) * sx; y+=(c->AdvanceY() >> 6) * sy; } }
void Font::Estimate(std::string str, float *out_width, float *out_height) { float x,y; x = y = 0; for(int i=0; i<str.length(); i++) { FontChar *c = GetChar(str.at(i)); if (!c) continue; x+=(c->AdvanceX() >> 6) * sx; y+=(c->AdvanceY() >> 6) * sy; } *out_width = x; *out_height = y; }
void BitmapFont::Draw(std::string str, float x, float y) { for(int i=0; i<str.length(); i++) { FontChar *c = GetChar(str.at(i)); if (!c) { continue; } //printf("%c at %f,%f\n",str.at(i),x,y); c->Draw(x,y,sx,sy); x+=c->AdvanceX() * sx; //y+=c->AdvanceY(); } }