Ejemplo n.º 1
0
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;
    }
}
Ejemplo n.º 2
0
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;
}