diff options
Diffstat (limited to 'extensions')
-rw-r--r-- | extensions/smttfont.cpp | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/extensions/smttfont.cpp b/extensions/smttfont.cpp index cf3ba68..c38440c 100644 --- a/extensions/smttfont.cpp +++ b/extensions/smttfont.cpp @@ -43,13 +43,13 @@ bool smTTChar::setChar(wchar_t c,FT_Face ttface) quad.v[2].tx=1;quad.v[2].ty=1;quad.v[3].tx=0;quad.v[3].ty=1; return true; } -void smTTChar::render(float x,float y,float z,DWORD col) +void smTTChar::render(float x,float y,float z,DWORD col,float scalex,float scaley) { for(int i=0;i<4;++i)quad.v[i].col=col,quad.v[i].z=z; - quad.v[0].x=x+xofs;quad.v[0].y=y-rh+yofs; - quad.v[1].x=x+rw+xofs;quad.v[1].y=y-rh+yofs; - quad.v[2].x=x+rw+xofs;quad.v[2].y=y+yofs; - quad.v[3].x=x+xofs;quad.v[3].y=y+yofs; + quad.v[0].x=x+xofs*scalex;quad.v[0].y=y+(yofs-rh)*scaley; + quad.v[1].x=x+(rw+xofs)*scalex;quad.v[1].y=y+(yofs-rh)*scaley; + quad.v[2].x=x+(rw+xofs)*scalex;quad.v[2].y=y+yofs*scaley; + quad.v[3].x=x+xofs*scalex;quad.v[3].y=y+yofs*scaley; sm->smRenderQuad(&quad); } @@ -97,7 +97,7 @@ void smTTFont::updateString(const wchar_t *format,...) } h+=lh; } -void smTTFont::render(float x,float y,float z,DWORD col,int align) +void smTTFont::render(float x,float y,float z,DWORD col,int align,float scalex,float scaley) { float curx,cury,lh; if(align==ALIGN_LEFT) @@ -109,12 +109,12 @@ void smTTFont::render(float x,float y,float z,DWORD col,int align) { if(chars.find(buf[i])!=chars.end()) { - chars[buf[i]].render(curx,cury,z,col); - curx+=chars[buf[i]].w(); + chars[buf[i]].render(curx,cury,z,col,scalex,scaley); + curx+=chars[buf[i]].w()*scalex; lh=chars[buf[i]].h()>lh?chars[buf[i]].h():lh; } } - else cury+=lh,lh=0,curx=x; + else cury+=lh*scaley,lh=0,curx=x; } } if(align==ALIGN_RIGHT) @@ -126,12 +126,12 @@ void smTTFont::render(float x,float y,float z,DWORD col,int align) { if(chars.find(buf[i])!=chars.end()) { - chars[buf[i]].render(curx,cury,z,col); - curx-=chars[buf[i]].w(); + chars[buf[i]].render(curx,cury,z,col,scalex,scaley); + curx-=chars[buf[i]].w()*scalex; lh=chars[buf[i]].h()>lh?chars[buf[i]].h():lh; } } - else cury-=lh,lh=0,curx=x; + else cury-=lh*scaley,lh=0,curx=x; } } } |