TODO
Glissando
*/
-
+#include <math.h>
#include <ctype.h>
#include "lookup.hh"
#include "debug.hh"
#include "dimensions.hh"
-#include "scalar.hh"
+
#include "paper-def.hh"
#include "string-convert.hh"
#include "file-path.hh"
{
if (!afm_l_)
{
- Lookup * me = (Lookup*)(this);
+ Lookup * me = (Lookup*)(this);
me->afm_l_ = all_fonts_global_p->find_afm (font_name_);
if (!me->afm_l_)
{
- warning (_f("Can't open `%s'\n", font_name_));
- warning (_f("Search path %s\n", global_path.str ().ch_C()));
- error (_f("Aborting"));
+ warning (_f ("Can't find font: `%s'", font_name_));
+ warning (_f ("(search path: `%s')", global_path.str ().ch_C()));
+ error (_ ("Aborting"));
}
}
Adobe_font_char_metric cm = afm_l_->find_char (s, warn);
{
if (j > 2)
j = 2;
+ if (type == "harmonic" || type == "cross")
+ j = 2;
return afm_find (String ("noteheads-") + to_str (j) + type);
}
/**
Magnification steps. These are powers of 1.2. The numbers are
taken from Knuth's plain.tex: */
-static Real mag_steps[] = {1, 1, 1.200, 1.440, 1.7280, 2.074, 2.488};
+
/**
TODO: THIS IS UGLY. Since the user has direct access to TeX
{
font_h = paper_l->get_var ("font_" + style);
}
-
+
+
+ Real realmag = 1.0;
if (paper_l->scope_p_->elem_b ("magnification_" + style))
{
font_mag = (int)paper_l->get_var ("magnification_" + style);
+ realmag = pow (1.2, font_mag);
}
/*
UGH.
*/
- SCM l = gh_eval_str (("(style-to-cmr \"" + style + "\")").ch_C());
+ SCM l = ly_ch_C_eval_scm (("(style-to-cmr \"" + style + "\")").ch_C());
if (l != SCM_BOOL_F)
{
style = ly_scm2string (SCM_CDR(l)) +to_str ((int)font_h);
Interval ydims (0,0);
Font_metric* afm_l = all_fonts_global_p->find_font (style);
- DOUT << "\nChars: ";
+ DEBUG_OUT << "\nChars: ";
int brace_count =0;
brace_count ++;
else if (text[i] == '}')
brace_count --;
- Character_metric *c = afm_l->get_char ((unsigned char)text[i],false);
+ Character_metric *c = (Character_metric*)afm_l->
+ get_char ((unsigned char)text[i],false);
+ // Ugh, use the width of 'x' for unknown characters
+ if (c->dimensions()[X_AXIS].length () == 0)
+ c = (Character_metric*)afm_l->get_char ((unsigned char)'x',false);
w += c->dimensions()[X_AXIS].length ();
ydims.unite (c->dimensions()[Y_AXIS]);
}
}
- if (font_mag > 1 && font_mag < 7 )
- {
- /* UGH */
- w *= mag_steps[font_mag];
- ydims *= mag_steps[font_mag];
- }
-
if(brace_count)
{
- warning (_f ("Non-matching braces in text `%s', adding braces.", text.ch_C()));
+ warning (_f ("Non-matching braces in text `%s', adding braces", text.ch_C()));
if (brace_count < 0)
{
}
}
-
- DOUT << "\n" << to_str (w) << "\n";
- m.dim_.x () = Interval (0, w);
+ ydims *= realmag;
+ m.dim_.x () = Interval (0, w*realmag);
m.dim_.y () = ydims;
Atom at (gh_list (text_scm_sym,
- gh_str02scm (text.ch_C()),
+ ly_ch_C_to_scm (text.ch_C()),
SCM_UNDEFINED));
at.font_ = ly_symbol (style);
at.magn_ = gh_int2scm (font_mag);