#include <ctype.h>
#include "lookup.hh"
-#include "debug.hh"
+#include "warn.hh"
#include "dimensions.hh"
#include "bezier.hh"
#include "paper-def.hh"
#include "scope.hh"
#include "molecule.hh"
-#include "lily-guile.hh"
+
+#include "ly-smobs.icc"
Lookup::Lookup ()
Lookup::Lookup (Lookup const& s)
{
font_name_ = s.font_name_;
- afm_l_ = 0;
+ afm_l_ = 0;
}
+SCM
+Lookup::mark_smob (SCM s)
+{
+ return s;
+}
+int
+Lookup::print_smob (SCM s, SCM p, scm_print_state*)
+{
+ scm_puts ("#<Lookup >#", p);
+ return 1;
+}
+
+
+IMPLEMENT_UNSMOB(Lookup, lookup);
+IMPLEMENT_SIMPLE_SMOBS(Lookup);
+IMPLEMENT_DEFAULT_EQUAL_P(Lookup);
+
+SCM
+Lookup::make_lookup ()
+{
+ Lookup * l = new Lookup;
+ return l->smobbed_self();
+}
Molecule
me->afm_l_ = all_fonts_global_p->find_afm (font_name_);
if (!me->afm_l_)
{
- warning (_f ("Can't find font: `%s'", font_name_));
- warning (_f ("(search path `%s')", global_path.str ().ch_C()));
+ warning (_f ("can't find font: `%s'", font_name_));
+ warning (_f ("(search path: `%s')", global_path.str ().ch_C()));
error (_ ("Aborting"));
}
}
gh_int2scm (cm->code),
SCM_UNDEFINED));
+
at= fontify_atom (afm_l_,at);
return Molecule ( afm_bbox_to_box (cm->charBBox), at);
}
Lookup::dashed_slur (Bezier b, Real thick, Real dash)
{
SCM l = SCM_EOL;
- // this is silly, we have array_to_scm
+
for (int i= 4; i -- ;)
{
- l = gh_cons (to_scm (b.control_[i]), l);
+ l = gh_cons (ly_offset2scm (b.control_[i]), l);
}
SCM at = (gh_list (ly_symbol2scm ("dashed-slur"),
Molecule
Lookup::blank (Box b)
{
- Molecule m;
- m.dim_ = b;
- return m;
+ return Molecule (b, SCM_EOL);
}
}
/**
-
+TODO: move into Text_item. UGH: paper_l argument shoudl be junked.
*/
Molecule
Lookup::text (String style, String text, Paper_def *paper_l)
font_mag = (int)paper_l->get_var ("magnification_" + style);
}
- /*
- UGH.
- */
- SCM l = ly_eval_str (("(style-to-cmr \"" + style + "\")").ch_C());
+ SCM l = scm_assoc (ly_str02scm (style.ch_C()),
+ scm_eval (ly_symbol2scm ("cmr-alist")));
+
if (l != SCM_BOOL_F)
{
style = ly_scm2string (gh_cdr(l)) +to_str ((int)font_h);
}
-
-
Font_metric* metric_l = 0;
if (font_mag)
lines[i] = str;
}
+ if (!lines.size())
+ return Molecule();
SCM first = gh_list (ly_symbol2scm ("text"),
ly_str02scm (lines[0].ch_C()),
back.control_[2] += curvethick * complex_exp (Offset (0, alpha + M_PI/2));
SCM scontrols[8];
- // this is silly, we have array_to_scm
+
for (int i=4; i--;)
- scontrols[ i ] = to_scm (back.control_[i]);
+ scontrols[ i ] = ly_offset2scm(back.control_[i]);
for (int i=4 ; i--;)
- scontrols[i+4] = to_scm (curve.control_[i]);
+ scontrols[i+4] = ly_offset2scm (curve.control_[i]);
/*
Need the weird order b.o. the way PS want its arguments
if (sym == "Discant")
{
- Molecule r = afm_find("scripts-accDiscant");
+ Molecule r = afm_find("accordion-accDiscant");
m.add_molecule(r);
if (reg.left_str(1) == "F")
{
- Molecule d = afm_find("scripts-accDot");
+ Molecule d = afm_find("accordion-accDot");
d.translate_axis(staff_space * 2.5 PT, Y_AXIS);
m.add_molecule(d);
reg = reg.right_str(reg.length_i()-1);
}
if (eflag & 0x02)
{
- Molecule d = afm_find("scripts-accDot");
+ Molecule d = afm_find("accordion-accDot");
d.translate_axis(staff_space * 1.5 PT, Y_AXIS);
m.add_molecule(d);
}
if (eflag & 0x04)
{
- Molecule d = afm_find("scripts-accDot");
+ Molecule d = afm_find("accordion-accDot");
d.translate_axis(staff_space * 1.5 PT, Y_AXIS);
d.translate_axis(0.8 * staff_space PT, X_AXIS);
m.add_molecule(d);
}
if (eflag & 0x01)
{
- Molecule d = afm_find("scripts-accDot");
+ Molecule d = afm_find("accordion-accDot");
d.translate_axis(staff_space * 1.5 PT, Y_AXIS);
d.translate_axis(-0.8 * staff_space PT, X_AXIS);
m.add_molecule(d);
}
if (reg.left_str(2) == "SS")
{
- Molecule d = afm_find("scripts-accDot");
+ Molecule d = afm_find("accordion-accDot");
d.translate_axis(0.5 * staff_space PT, Y_AXIS);
d.translate_axis(0.4 * staff_space PT, X_AXIS);
m.add_molecule(d);
}
if (reg.left_str(1) == "S")
{
- Molecule d = afm_find("scripts-accDot");
+ Molecule d = afm_find("accordion-accDot");
d.translate_axis(0.5 * staff_space PT, Y_AXIS);
m.add_molecule(d);
reg = reg.right_str(reg.length_i()-1);
}
else if (sym == "Freebase")
{
- Molecule r = afm_find("scripts-accFreebase");
+ Molecule r = afm_find("accordion-accFreebase");
m.add_molecule(r);
if (reg.left_str(1) == "F")
{
- Molecule d = afm_find("scripts-accDot");
+ Molecule d = afm_find("accordion-accDot");
d.translate_axis(staff_space * 1.5 PT, Y_AXIS);
m.add_molecule(d);
reg = reg.right_str(reg.length_i()-1);
}
if (reg == "E")
{
- Molecule d = afm_find("scripts-accDot");
+ Molecule d = afm_find("accordion-accDot");
d.translate_axis(staff_space * 0.5 PT, Y_AXIS);
m.add_molecule(d);
}
}
else if (sym == "Bayanbase")
{
- Molecule r = afm_find("scripts-accBayanbase");
+ Molecule r = afm_find("accordion-accBayanbase");
m.add_molecule(r);
if (reg.left_str(1) == "T")
{
- Molecule d = afm_find("scripts-accDot");
+ Molecule d = afm_find("accordion-accDot");
d.translate_axis(staff_space * 2.5 PT, Y_AXIS);
m.add_molecule(d);
reg = reg.right_str(reg.length_i()-1);
/* include 4' reed just for completeness. You don't want to use this. */
if (reg.left_str(1) == "F")
{
- Molecule d = afm_find("scripts-accDot");
+ Molecule d = afm_find("accordion-accDot");
d.translate_axis(staff_space * 1.5 PT, Y_AXIS);
m.add_molecule(d);
reg = reg.right_str(reg.length_i()-1);
}
if (reg.left_str(2) == "EE")
{
- Molecule d = afm_find("scripts-accDot");
+ Molecule d = afm_find("accordion-accDot");
d.translate_axis(staff_space * 0.5 PT, Y_AXIS);
d.translate_axis(0.4 * staff_space PT, X_AXIS);
m.add_molecule(d);
}
if (reg.left_str(1) == "E")
{
- Molecule d = afm_find("scripts-accDot");
+ Molecule d = afm_find("accordion-accDot");
d.translate_axis(staff_space * 0.5 PT, Y_AXIS);
m.add_molecule(d);
reg = reg.right_str(reg.length_i()-1);
}
else if (sym == "Stdbase")
{
- Molecule r = afm_find("scripts-accStdbase");
+ Molecule r = afm_find("accordion-accStdbase");
m.add_molecule(r);
if (reg.left_str(1) == "T")
{
- Molecule d = afm_find("scripts-accDot");
+ Molecule d = afm_find("accordion-accDot");
d.translate_axis(staff_space * 3.5 PT, Y_AXIS);
m.add_molecule(d);
reg = reg.right_str(reg.length_i()-1);
}
if (reg.left_str(1) == "F")
{
- Molecule d = afm_find("scripts-accDot");
+ Molecule d = afm_find("accordion-accDot");
d.translate_axis(staff_space * 2.5 PT, Y_AXIS);
m.add_molecule(d);
reg = reg.right_str(reg.length_i()-1);
}
if (reg.left_str(1) == "M")
{
- Molecule d = afm_find("scripts-accDot");
+ Molecule d = afm_find("accordion-accDot");
d.translate_axis(staff_space * 2 PT, Y_AXIS);
d.translate_axis(staff_space PT, X_AXIS);
m.add_molecule(d);
}
if (reg.left_str(1) == "E")
{
- Molecule d = afm_find("scripts-accDot");
+ Molecule d = afm_find("accordion-accDot");
d.translate_axis(staff_space * 1.5 PT, Y_AXIS);
m.add_molecule(d);
reg = reg.right_str(reg.length_i()-1);
}
if (reg.left_str(1) == "S")
{
- Molecule d = afm_find("scripts-accDot");
+ Molecule d = afm_find("accordion-accDot");
d.translate_axis(staff_space * 0.5 PT, Y_AXIS);
m.add_molecule(d);
reg = reg.right_str(reg.length_i()-1);
for the rectangle */
else if (sym == "SB")
{
- Molecule r = afm_find("scripts-accSB");
+ Molecule r = afm_find("accordion-accSB");
m.add_molecule(r);
}
else if (sym == "BB")
{
- Molecule r = afm_find("scripts-accBB");
+ Molecule r = afm_find("accordion-accBB");
m.add_molecule(r);
}
else if (sym == "OldEE")
{
- Molecule r = afm_find("scripts-accOldEE");
+ Molecule r = afm_find("accordion-accOldEE");
m.add_molecule(r);
}
else if (sym == "OldEES")
{
- Molecule r = afm_find("scripts-accOldEES");
+ Molecule r = afm_find("accordion-accOldEES");
m.add_molecule(r);
}
return m;