X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=lily%2Fscaled-font-metric.cc;h=cf3bb64db01d467cf31b1503600116905de90bdf;hb=635827994d372f4bd0e9c719238380337bae9477;hp=3327b2d8b639e157017a0dd6af8163cc35e1a4cf;hpb=c5402461ab1d1cdbaa684b0e55d4851f0e28e37a;p=lilypond.git diff --git a/lily/scaled-font-metric.cc b/lily/scaled-font-metric.cc index 3327b2d8b6..cf3bb64db0 100644 --- a/lily/scaled-font-metric.cc +++ b/lily/scaled-font-metric.cc @@ -1,4 +1,13 @@ -#include "font-metric.hh" +/* + scaled-font-metric.cc -- declare Scaled_font_metric + + source file of the GNU LilyPond music typesetter + + (c) 1999--2001 Han-Wen Nienhuys + + */ + +#include "scaled-font-metric.hh" #include "string.hh" #include "molecule.hh" @@ -6,6 +15,10 @@ Scaled_font_metric::Scaled_font_metric (Font_metric* m, Real magn) { magnification_f_ = magn; + SCM desc = m->description_; + + Real total_mag = magn * gh_scm2double (ly_cdr (desc)); + description_ = gh_cons (ly_car (desc), gh_double2scm (total_mag)); orig_l_ = m; } @@ -13,23 +26,39 @@ SCM Scaled_font_metric::make_scaled_font_metric (Font_metric*m, Real s) { Scaled_font_metric *sfm = new Scaled_font_metric (m,s); - sfm->name_ = m->name_; - return sfm->self_scm (); } -SCM -Scaled_font_metric::description () const +Molecule +Scaled_font_metric::find_by_name (String s) const { - SCM od = orig_l_->description (); - // todo: - // gh_set_cdr_x (od, gh_int2scm (magstep_i_)); - return od; + Molecule m = orig_l_->find_by_name (s); + Box b = m.extent_box (); + b.scale (magnification_f_); + Molecule q (b,fontify_atom ((Font_metric*) this, m.get_expr ())); + + return q ; } +Box +Scaled_font_metric::get_char (int i) const +{ + Box b = orig_l_->get_char (i); + b.scale (magnification_f_); + return b; +} -Molecule -Scaled_font_metric::find_by_name (String s, Real mag) const +Box +Scaled_font_metric::text_dimension (String t) const +{ + Box b (orig_l_->text_dimension (t)); + + b.scale (magnification_f_); + return b; +} + +int +Scaled_font_metric::count () const { - return orig_l_->find_by_name (s, magnification_f_ * mag); // ugh. + return orig_l_->count (); }