2 #include "dimension.hh"
7 parse_dimen (String dim
)
9 int i
=dim
.length_i()-1;
10 char const *s
= dim
.ch_C ();
11 while (i
> 0 && (isspace (s
[i
]) || isalpha (s
[i
])))
15 String
unit (s
+ i
+1);
16 return convert_dimen (dim
.value_f(), unit
);
21 convert_dimen (Real quant
, String unit
)
24 return quant
* CM_TO_PT
;
28 return quant
*CM_TO_PT
/10;
30 return quant
* INCH_TO_PT
;
31 error (_f ("unknown length unit: `%s\'", unit
));
37 String s
= to_str (r
, "%.3f");
38 if (s
.index_i ("NaN") != -1)