summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--hgeft.cpp10
-rw-r--r--hgeft.h2
2 files changed, 6 insertions, 6 deletions
diff --git a/hgeft.cpp b/hgeft.cpp
index 05e6053..e424756 100644
--- a/hgeft.cpp
+++ b/hgeft.cpp
@@ -11,7 +11,7 @@ bool hgeTTChar::SetChar(wchar_t ch,FT_Face ttfface)
err=FT_Render_Glyph(ttfface->glyph,FT_RENDER_MODE_NORMAL);
if(err){hge->System_Log("%s: Glyph render failed!",HGEFT_SRC_FN);return false;}
_w=slot->advance.x>>6;_h=slot->bitmap.rows;//we are one line only.
- rw=slot->bitmap.width;rh=slot->bitmap.rows;
+ rw=slot->bitmap.width;rh=slot->bitmap.rows;yofst=slot->bitmap.rows-slot->bitmap_top;
quad.tex=hge->Texture_Create(
slot->bitmap.width?slot->bitmap.width:1,
slot->bitmap.rows?slot->bitmap.rows:1);
@@ -40,10 +40,10 @@ bool hgeTTChar::SetChar(wchar_t ch,FT_Face ttfface)
void hgeTTChar::Render(double x,double y,DWORD col)
{
for(int i=0;i<4;++i)quad.v[i].col=col;
- quad.v[0].x=x;quad.v[0].y=y-rh;
- quad.v[1].x=x+rw;quad.v[1].y=y-rh;
- quad.v[2].x=x+rw;quad.v[2].y=y;
- quad.v[3].x=x;quad.v[3].y=y;
+ quad.v[0].x=x;quad.v[0].y=y-rh+yofst;
+ quad.v[1].x=x+rw;quad.v[1].y=y-rh+yofst;
+ quad.v[2].x=x+rw;quad.v[2].y=y+yofst;
+ quad.v[3].x=x;quad.v[3].y=y+yofst;
hge->Gfx_RenderQuad(&quad);
}
bool hgeTTFont::Init(const char *ttf,int size)
diff --git a/hgeft.h b/hgeft.h
index 914fb13..1badc74 100644
--- a/hgeft.h
+++ b/hgeft.h
@@ -49,7 +49,7 @@ class hgeTTChar
{
private:
hgeQuad quad;
- int rw,rh,_w,_h;
+ int rw,rh,_w,_h,yofst;
public:
double w(){return _w;}
double h(){return _h;}