def _calc_dimension(self, dim_val, dim_max, font_dim):
if dim_val is None:<EOL><INDENT>return -<NUM_LIT:1>   <EOL><DEDENT>elif isinstance(dim_val, int):<EOL><INDENT>return dim_val  <EOL><DEDENT>elif isinstance(dim_val, str):<EOL><INDENT>if dim_val.endswith("<STR_LIT:%>"):<EOL><INDENT>dim_val = int(dim_val[:-<NUM_LIT:1>])<EOL>dim_val = dim_val / <NUM_LIT> * dim_max<EOL><DEDENT>elif dim_val.endswith("<STR_LIT>"):<EOL><INDENT>dim_val = float(dim_val[:-<NUM_LIT:2>])<EOL>dim_val = dim_val * font_dim<EOL><DEDENT>elif dim_val.endswith("<STR_LIT>"):<EOL><INDENT>dim_val = dim_val[:-<NUM_LIT:2>]<EOL><DEDENT>elif dim_val == "<STR_LIT>" or dim_val == "<STR_LIT>":<EOL><INDENT>dim_val = -<NUM_LIT:1><EOL><DEDENT>return int(dim_val)<EOL><DEDENT>
Calculate final pos and size (auto, absolute in pixels & relativa)