mothra: fix bogus strtolength
This commit is contained in:
parent
95d7fa1c0e
commit
1f0ea6cd96
1 changed files with 8 additions and 10 deletions
|
@ -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);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue