mothra: fix bogus strtolength

This commit is contained in:
cinap_lenrek 2012-04-17 00:06:25 +02:00
parent 95d7fa1c0e
commit 1f0ea6cd96

View file

@ -72,19 +72,17 @@ enum{
HORIZ, HORIZ,
VERT, VERT,
}; };
int strtolength(Hglob *g, int dir, char *str)
{ int strtolength(Hglob *g, int dir, char *str){
double f; double f;
Point p;
f = atof(str); f = atof(str);
if(cistrstr(str, "px"))
return floor(f);
if(cistrstr(str, "%")) if(cistrstr(str, "%"))
return floor(f*((dir==HORIZ) ? Dx(g->dst->text->r) : Dy(g->dst->text->r))/100); return 0;
if(cistrstr(str, "em")){ if(cistrstr(str, "em")){
Point z; p=stringsize(pl_whichfont(g->state->font, g->state->size)->font, "M");
z = stringsize(g->dst->text->font, "M"); return floor(f*((dir==HORIZ) ? p.x : p.y));
return floor(f*((dir==HORIZ) ? z.x : z.y));
} }
return floor(f); return floor(f);
} }