protected function convert_number($input, $x = null)
{
// Sanitize double negatives
$input = str_replace('--', '', $input);
$orig = $input;
$sizes = $this->sizes();
$size = $x ? $sizes->width : $sizes->height;
// Convert percentages to absolutes
if (substr($input, -1) == '%') {
$input = floor(substr($input, 0, -1) / 100 * $size);
}
// Negatives are based off the bottom right
if ($x !== null and $input < 0) {
$input = $size + $input;
}
return $input;
}