]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/pango-font.cc
Fix some bugs in the dynamic engraver and PostScript backend
[lilypond.git] / lily / pango-font.cc
index 1faa34fc40bb592f0c716a6a84cf45923b6d81cf..73ea7426a65ea4a6bf498d1c9881a4bd138ae7ec 100644 (file)
@@ -140,7 +140,8 @@ Pango_font::pango_item_string_stencil (PangoItem const *item, string str) const
   SCM *tail = &glyph_exprs;
       
   Index_to_charcode_map const *cmap = 0;
-  if  (! (ftface->face_flags & FT_FACE_FLAG_GLYPH_NAMES))
+  bool has_glyph_names = ftface->face_flags & FT_FACE_FLAG_GLYPH_NAMES;
+  if  (! has_glyph_names)
     cmap = ((Pango_font*)this)->get_index_to_charcode_map (file_name, ftface);
   
   bool cid_keyed = false;
@@ -151,9 +152,15 @@ Pango_font::pango_item_string_stencil (PangoItem const *item, string str) const
       PangoGlyph pg = pgi->glyph;
       PangoGlyphGeometry ggeo = pgi->geometry;
 
-      FT_Get_Glyph_Name (ftface, pg, glyph_name, GLYPH_NAME_LEN);
-
-      SCM char_id;
+      glyph_name[0] = '\0';
+      if (has_glyph_names)
+       {
+         int errorcode = FT_Get_Glyph_Name (ftface, pg, glyph_name, GLYPH_NAME_LEN);
+         if (errorcode)
+           programming_error ("FT_Get_Glyph_Name returns error");
+       }
+      
+      SCM char_id = SCM_EOL;
       if (glyph_name[0] == '\0'
          && cmap
 
@@ -164,15 +171,20 @@ Pango_font::pango_item_string_stencil (PangoItem const *item, string str) const
          FT_ULong char_code = cmap->find (pg)->second;
          get_unicode_name (glyph_name, char_code);
        }
-      
-  
+
+      if (glyph_name[0] ==  '\0' && has_glyph_names)
+       {
+         programming_error ("Glyph has no name, but font supports glyph naming. Skipping glyph.");
+         continue;
+       }
+         
       if (glyph_name[0] == '\0')
        {
          /*
            CID entry
          */
          cid_keyed = true;
-         char_id = scm_from_int (pg);
+         char_id = scm_from_uint32 (pg);
        }
       else
        char_id = scm_makfrom0str (glyph_name);