Fixes Issue 1504, allowing feather beam line breaking.
[lilypond/patrick.git] / lily / pfb-scheme.cc
blob89666192a30d4a4bdcd75aa1aa990a82a31ef4c1
2 #include "program-option.hh"
3 #include "source-file.hh"
4 #include "memory-stream.hh"
5 #include "open-type-font.hh"
6 #include "main.hh"
7 #include "warn.hh"
9 LY_DEFINE (ly_pfb_2_pfa, "ly:pfb->pfa",
10 1, 0, 0, (SCM pfb_file_name),
11 "Convert the contents of a Type@tie{}1 font in PFB format"
12 " to PFA format.")
14 LY_ASSERT_TYPE (scm_is_string, pfb_file_name, 1);
16 string file_name = ly_scm2string (pfb_file_name);
18 if (be_verbose_global)
19 progress_indication ("\n[" + file_name);
21 vector<char> pfb_string = gulp_file (file_name, 0);
22 char *pfa = pfb2pfa ((Byte *) &pfb_string[0], pfb_string.size ());
24 SCM pfa_scm = scm_from_locale_string (pfa);
25 free (pfa);
27 if (be_verbose_global)
28 progress_indication ("]");
30 return pfa_scm;
33 LY_DEFINE (ly_otf_2_cff, "ly:otf->cff",
34 1, 0, 0, (SCM otf_file_name),
35 "Convert the contents of an OTF file to a CFF file,"
36 " returning it as a string.")
38 LY_ASSERT_TYPE (scm_is_string, otf_file_name, 1);
40 string file_name = ly_scm2string (otf_file_name);
41 if (be_verbose_global)
42 progress_indication ("\n[" + file_name);
44 FT_Face face = open_ft_face (file_name, 0 /* index */);
45 string table = get_otf_table (face, "CFF ");
47 SCM asscm = scm_from_locale_stringn ((char *) table.data (),
48 table.length ());
50 if (be_verbose_global)
51 progress_indication ("]");
53 return asscm;