]> git.donarmstrong.com Git - lilypond.git/commitdiff
lilypond-0.0.30
authorfred <fred>
Sun, 24 Mar 2002 19:29:32 +0000 (19:29 +0000)
committerfred <fred>
Sun, 24 Mar 2002 19:29:32 +0000 (19:29 +0000)
hdr/dimen.hh
src/texbeam.cc

index 4ee17ea140a3ed52b209eaf577d2ea2812fb3ec3..a3f4e8876b65498635004344a3b93a8adaec51a6 100644 (file)
@@ -4,9 +4,18 @@
 #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
 
index a3b38dde9ea1c96a19c95be52e809a52e0d98c5e..c9f3c954812171495e0b53087f68f7a62b90a731 100644 (file)
@@ -23,7 +23,7 @@ Lookup::beam_element(int sidx, int widx, Real slope)
     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;
@@ -34,7 +34,7 @@ static int
 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;
     }
 
@@ -65,12 +65,12 @@ Lookup::beam(Real &slope, Real width)
 {        
     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;