~ubuntu-branches/ubuntu/precise/lilypond/precise

« back to all changes in this revision

Viewing changes to lily/scaled-font-metric.cc

  • Committer: Bazaar Package Importer
  • Author(s): Thomas Bushnell, BSG
  • Date: 2006-12-19 10:18:12 UTC
  • mfrom: (3.1.4 feisty)
  • Revision ID: james.westby@ubuntu.com-20061219101812-7awtjkp0i393wxty
Tags: 2.8.7-3
scripts/midi2ly.py: When setting DATADIR, find Lilypond python files
in the @TOPLEVEL_VERSION@ directory, not 'current'.  Patch thanks to
Chris Lamb (chris@chris-lamb.co.uk).  (Closes: #400550)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*   
2
 
     scaled-font-metric.cc -- declare Scaled_font_metric
3
 
  
4
 
  source file of the GNU LilyPond music typesetter
5
 
  
6
 
  (c) 1999--2004 Han-Wen Nienhuys <hanwen@cs.uu.nl>
7
 
  
8
 
 */
9
 
 
10
 
#include "scaled-font-metric.hh"
11
 
#include "string.hh"
12
 
#include "stencil.hh"
13
 
 
14
 
 
15
 
Scaled_font_metric::Scaled_font_metric (Font_metric* m, Real magn)
16
 
{
17
 
  magnification_ = magn;
18
 
  SCM desc = m->description_;
19
 
 
20
 
  Real total_mag = magn * gh_scm2double (ly_cdr (desc));
21
 
  assert (total_mag);
22
 
  
23
 
  description_ = gh_cons (ly_car (desc), gh_double2scm (total_mag));
24
 
  orig_ = m;
25
 
}
26
 
 
27
 
SCM
28
 
Scaled_font_metric::make_scaled_font_metric (Font_metric*m, Real s)
29
 
{
30
 
  Scaled_font_metric *sfm = new Scaled_font_metric (m,s);
31
 
  return sfm->self_scm ();
32
 
}
33
 
 
34
 
Stencil
35
 
Scaled_font_metric::find_by_name (String s) const
36
 
{
37
 
  Stencil m = orig_->find_by_name (s);
38
 
  Box b = m.extent_box ();
39
 
  b.scale (magnification_);
40
 
  Stencil q (b,fontify_atom ((Font_metric*) this, m.get_expr ()));
41
 
 
42
 
  return q ;
43
 
}
44
 
 
45
 
Box 
46
 
Scaled_font_metric::get_indexed_char (int i) const
47
 
{
48
 
  Box b = orig_->get_indexed_char (i);
49
 
  b.scale (magnification_);
50
 
  return b;  
51
 
}
52
 
 
53
 
Box 
54
 
Scaled_font_metric::get_ascii_char (int i) const
55
 
{
56
 
  Box b = orig_->get_ascii_char (i);
57
 
  b.scale (magnification_);
58
 
  return b;  
59
 
}
60
 
 
61
 
Box
62
 
Scaled_font_metric::text_dimension (String t) const
63
 
{
64
 
  Box b (orig_->text_dimension (t));
65
 
 
66
 
  b.scale (magnification_);
67
 
  return b;
68
 
}
69
 
 
70
 
int
71
 
Scaled_font_metric::count () const
72
 
{
73
 
  return orig_->count ();
74
 
}
75
 
 
76
 
Offset
77
 
Scaled_font_metric::get_indexed_wxwy (int k) const
78
 
{
79
 
  Offset o = orig_->get_indexed_wxwy (k);
80
 
  return o * magnification_;
81
 
}
82
 
 
83
 
int
84
 
Scaled_font_metric::name_to_index (String s)const
85
 
{
86
 
  return orig_->name_to_index (s);
87
 
}