X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=lily%2Fpfb-scheme.cc;h=e718a13bf079f36c89708aebf65ddbcf1aa98611;hb=a1267e20afa61258ce3031f07d916e0e66ac6582;hp=f708c098a09329511805f27a1d6f8db4a1409112;hpb=8d1f238d09ada2152baebdfc949b7f56c2e7bfd6;p=lilypond.git diff --git a/lily/pfb-scheme.cc b/lily/pfb-scheme.cc index f708c098a0..e718a13bf0 100644 --- a/lily/pfb-scheme.cc +++ b/lily/pfb-scheme.cc @@ -7,22 +7,35 @@ #include "main.hh" #include "warn.hh" -LY_DEFINE (ly_pfb_2_pfa, "ly:pfb->pfa", - 1, 0, 0, (SCM pfb_file_name), +LY_DEFINE (ly_type1_2_pfa, "ly:type1->pfa", + 1, 0, 0, (SCM type1_file_name), "Convert the contents of a Type@tie{}1 font in PFB format" - " to PFA format.") + " to PFA format. If the file is already in PFA format," + " pass through it.") { - LY_ASSERT_TYPE (scm_is_string, pfb_file_name, 1); + LY_ASSERT_TYPE (scm_is_string, type1_file_name, 1); - string file_name = ly_scm2string (pfb_file_name); + string file_name = ly_scm2string (type1_file_name); debug_output ("[" + file_name); // start message on a new line - vector pfb_string = gulp_file (file_name, 0); - char *pfa = pfb2pfa ((Byte *) &pfb_string[0], pfb_string.size ()); + vector type1_string = gulp_file (file_name, 0); + SCM pfa_scm; - SCM pfa_scm = scm_from_latin1_string (pfa); - free (pfa); + if ((Byte) type1_string[0] == 0x80) + { + /* The file is in PFB format. Convert it to PFA format. */ + char *pfa = pfb2pfa ((Byte *) &type1_string[0], + (int) type1_string.size ()); + pfa_scm = scm_from_latin1_string (pfa); + free (pfa); + } + else + { + /* The file is in PFA format. Pass it through. */ + type1_string.push_back(0); + pfa_scm = scm_from_latin1_string (&type1_string[0]); + } debug_output ("]", false);