]> git.donarmstrong.com Git - lilypond.git/blob - lily/open-type-font.cc
(substitute_char): Rename, rewrite, modify this.
[lilypond.git] / lily / open-type-font.cc
1 /*
2   open-type-font.cc --  implement Open_type_font
3
4   source file of the GNU LilyPond music typesetter
5
6   (c) 2004 Han-Wen Nienhuys <hanwen@xs4all.nl>
7
8 */
9
10 #if 0
11 #include "warn.hh"
12 #include "open-type-font.hh"
13
14 SCM
15 Open_type_font::make_otf (String str)
16 {
17   Open_type_font * otf = new Open_type_font;
18   int error_code = FT_New_Face( freetype2_library, str.to_str0(),
19                        0, &(otf->face_));
20
21   //  int code = FT_Set_Charmap (otf->face_, );   
22
23   
24   if (error_code == FT_Err_Unknown_File_Format)
25     {
26       error("Unsupported font format");
27     }
28   else if (error_code)
29     {
30       error ("Unknown error reading font file.");
31     }
32
33   return otf->self_scm ();
34 }
35
36 Open_type_font::~Open_type_font()
37 {
38   FT_Done_Face (face_);
39 }
40
41
42 Box
43 Open_type_font::get_indexed_char (int signed_idx)
44 {
45   FT_UInt idx = signed_idx;
46   int code = 
47     FT_Load_Glyph (face_,
48                    idx,
49                    FT_LOAD_NO_SCALE);
50
51   FT_Glyph_Metrics m = face->glyph->metrics;
52   Box b (Interval (0, m->width) - m->horiBearingX,
53          Interval (0, m->height) - m->horiBearingY);
54   
55   return b;
56 }
57
58 int
59 Open_type_font::name_to_index (String nm)
60 {
61   
62 }
63
64
65 Real
66 Open_type_font::get_design_size () const
67 {
68   return 20.0;
69 }
70 #endif