2 virtual-font-metric.cc -- implement Virtual_font_metric
4 source file of the GNU LilyPond music typesetter
6 (c) 2002 Han-Wen Nienhuys <hanwen@cs.uu.nl>
10 #include "virtual-font-metric.hh"
11 #include "all-font-metrics.hh"
13 #include "molecule.hh"
14 #include "paper-def.hh"
18 passing DEF is ughish. Should move into paperdef?
20 Virtual_font_metric::Virtual_font_metric (SCM name_list,
21 Real mag,Paper_def*def)
24 SCM *tail = &font_list_;
25 for (SCM s = name_list; gh_pair_p (s); s = gh_cdr (s))
29 Font_metric *fm = def->find_font (nm, mag);
30 *tail = scm_cons (fm->self_scm(),SCM_EOL);
31 tail = SCM_CDRLOC (*tail);
36 Virtual_font_metric::derived_mark()const
38 scm_gc_mark (font_list_);
42 Virtual_font_metric::count () const
45 for (SCM s = font_list_; gh_pair_p (s); s = gh_cdr (s))
47 k+= unsmob_metrics (gh_car (s))->count ();
54 Virtual_font_metric::find_by_name (String glyph) const
57 for (SCM s = font_list_; m.empty_b () && gh_pair_p (s); s = gh_cdr (s))
59 m = unsmob_metrics (gh_car (s))->find_by_name (glyph);
68 Virtual_font_metric::get_char (int code) const
71 for (SCM s = font_list_; gh_pair_p (s); s = gh_cdr (s))
73 Font_metric* fm = unsmob_metrics (gh_car (s));
74 int k = last_k + fm->count ();
75 if (last_k <= code && code < k)
77 return fm->get_char (code - last_k);
88 Virtual_font_metric::get_char_molecule (int code) const
92 for (SCM s = font_list_; gh_pair_p (s); s = gh_cdr (s))
94 Font_metric* fm = unsmob_metrics (gh_car (s));
95 int k = last_k + fm->count ();
96 if (last_k <= code && code < k)
98 m = fm->get_char_molecule (code - last_k);