#include "real.hh"
#include "string.hh"
+const Real INCH_TO_PT=72.0;
+const Real CM_TO_PT=INCH_TO_PT/2.54;
+const Real MM_TO_PT=CM_TO_PT/10;
+const Real PT_TO_PT =1.0;
+
+#define PT *PT_TO_PT
+#define MM *MM_TO_PT
+#define CM *CM_TO_PT
+#define INCH *INCH_TO_PT
+
Real parse_dimen(String);
-Real convert_dimen(Real, String);
String print_dimen(Real);
-
+Real convert_dimen(Real, String);
#endif
args.push(widx);
bs.tex = substitute_args(bs.tex,args);
int w = 2 << widx;
- Real width = convert_dimen(w,"pt");
+ Real width = w PT;
bs.dim.x = Interval(0,width);
bs.dim.y = Interval(0,width*slope);
return bs;
slope_index(Real &s)
{
if (abs(s) > 0.5) {
- WARN << "beam steeper than 0.5\n";
+ WARN << "beam steeper than 0.5 (" << s << ")\n";
s = sign(s) * 0.5;
}
{
int sidx = slope_index(slope);
if (!slope)
- return rule_symbol(convert_dimen(2,"pt"), width);
- if (width < convert_dimen(2,"pt")) {
- WARN<<"Beam too narrow.\n";
- width = convert_dimen(2,"pt");
+ return rule_symbol(2 PT, width);
+ if (width < 2 PT) {
+ WARN<<"Beam too narrow. (" << print_dimen(width) <<")\n";
+ width = 2 PT;
}
- Real elemwidth = convert_dimen(64,"pt");
+ Real elemwidth = 64 PT;
int widx = 5;
Molecule m;