- / (Real (PANGO_SCALE)) ;
-
- FcPattern *fcpat = fcfont->font_pattern;
- char *filename = 0;
- FcPatternGetString(fcpat, FC_FILE, 0, (FcChar8 **) &filename);
- char const *ps_name = FT_Get_Postscript_Name (ftface);
- ((Pango_font *) this)->register_font_file (filename, ps_name);
- pango_fc_font_unlock_face (fcfont);
-
- SCM expr = scm_list_4 (ly_symbol2scm ("glyph-string"),
- scm_makfrom0str (ps_name),
- scm_from_double (size),
- ly_quote_scm (glyph_exprs));
-
- Stencil item_stencil (b, expr);
- return item_stencil;
+ / (Real (PANGO_SCALE));
+
+ if (!ps_name_str0)
+ warning (_f ("no PostScript font name for font `%s'", file_name));
+
+ string ps_name;
+ if (!ps_name_str0
+ && file_name != ""
+ && (file_name.find (".otf") != NPOS
+ || file_name.find (".cff") != NPOS))
+ {
+ // UGH: kludge a PS name for OTF/CFF fonts.
+ string name = file_name;
+ ssize idx = file_name.find (".otf");
+ if (idx == NPOS)
+ idx = file_name.find (".cff");
+
+ name = name.substr (0, idx);
+
+ ssize slash_idx = name.rfind ('/');
+ if (slash_idx != NPOS)
+ {
+ slash_idx ++;
+ name = name.substr (slash_idx,
+ name.length () - slash_idx);
+ }
+
+ string initial = name.substr (0, 1);
+ initial = String_convert::to_upper (initial);
+ name = name.substr (1, name.length () - 1);
+ name = String_convert::to_lower (name);
+ ps_name = initial + name;
+ }
+ else if (ps_name_str0)
+ ps_name = ps_name_str0;
+
+ if (ps_name.length ())
+ {
+ ((Pango_font *) this)->register_font_file (file_name,
+ ps_name,
+ face_index);
+ pango_fc_font_unlock_face (fcfont);
+
+ SCM expr = scm_list_5 (ly_symbol2scm ("glyph-string"),
+ ly_string2scm (ps_name),
+ scm_from_double (size),
+ scm_from_bool (cid_keyed),
+ ly_quote_scm (glyph_exprs));
+
+ return Stencil (b, expr);
+ }
+
+ warning (_ ("FreeType face has no PostScript font name"));
+ return Stencil ();
+}
+
+SCM
+Pango_font::physical_font_tab () const
+{
+ return physical_font_tab_;