aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--extensions/smttfont.cpp24
-rw-r--r--include/smttfont.hpp4
2 files changed, 14 insertions, 14 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;
}
}
}
diff --git a/include/smttfont.hpp b/include/smttfont.hpp
index 0d90179..608907c 100644
--- a/include/smttfont.hpp
+++ b/include/smttfont.hpp
@@ -33,7 +33,7 @@ public:
float h(){return (float)_h;}
void free();
bool setChar(wchar_t c,FT_Face ttface);
- void render(float x,float y,float z,DWORD col);
+ void render(float x,float y,float z,DWORD col,float scalex,float scaley);
};
class smTTFont
@@ -52,7 +52,7 @@ public:
float getWidth(){return w;}
float getHeight(){return h;}
void updateString(const wchar_t *format,...);
- void render(float x,float y,float z,DWORD col,int align);
+ void render(float x,float y,float z,DWORD col,int align,float scalex=1,float scaley=1);
DWORD getCacheSize();
void clearCache();
};