]> git.donarmstrong.com Git - lilypond.git/commitdiff
Issue 4876/3: Enable fontname replacing in Pango_font class
authorMasamichi Hosoda <trueroad@trueroad.jp>
Sat, 25 Jun 2016 09:39:10 +0000 (18:39 +0900)
committerMasamichi Hosoda <trueroad@trueroad.jp>
Mon, 4 Jul 2016 12:46:34 +0000 (21:46 +0900)
This commit enables fontname replacing for CFF (OTF/OTC) fonts.

lily/pango-font.cc

index 9e3a2d38b30b53086c1067759a6e15c75680c315..b805f34a8541eeb594f51f1aced0633f4c3dcf0e 100644 (file)
@@ -41,6 +41,7 @@
 #include "warn.hh"
 #include "all-font-metrics.hh"
 #include "program-option.hh"
+#include "open-type-font.hh"
 
 #if HAVE_PANGO_FT2
 #include "stencil.hh"
@@ -200,7 +201,7 @@ Pango_font::pango_item_string_stencil (PangoGlyphItem const *glyph_item) const
 
   b.scale (scale_);
 
-  char const *ps_name_str0 = FT_Get_Postscript_Name (ftface);
+  const string ps_name_str0 = get_postscript_name (ftface);
   FcPattern *fcpat = fcfont->font_pattern;
 
   FcChar8 *file_name_as_ptr = 0;
@@ -320,11 +321,11 @@ Pango_font::pango_item_string_stencil (PangoGlyphItem const *glyph_item) const
   Real size = pango_font_description_get_size (descr)
               / (Real (PANGO_SCALE));
 
-  if (!ps_name_str0)
+  if (ps_name_str0.empty ())
     warning (_f ("no PostScript font name for font `%s'", file_name));
 
   string ps_name;
-  if (!ps_name_str0
+  if (ps_name_str0.empty ()
       && file_name != ""
       && (file_name.find (".otf") != NPOS
           || file_name.find (".cff") != NPOS))
@@ -351,7 +352,7 @@ Pango_font::pango_item_string_stencil (PangoGlyphItem const *glyph_item) const
       name = String_convert::to_lower (name);
       ps_name = initial + name;
     }
-  else if (ps_name_str0)
+  else if (!ps_name_str0.empty ())
     ps_name = ps_name_str0;
 
   if (ps_name.length ())