]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/pango-font.cc
Run `make grand-replace'.
[lilypond.git] / lily / pango-font.cc
index 77d279ab906bb6c34c56004014d25899cc0a6f6a..aa2c7f35c40410964a24a02bbadb642b6fbd8ded 100644 (file)
@@ -3,7 +3,7 @@
 
   source file of the GNU LilyPond music typesetter
 
-  (c) 2004--2006 Han-Wen Nienhuys <hanwen@xs4all.nl>
+  (c) 2004--2008 Han-Wen Nienhuys <hanwen@xs4all.nl>
 */
 
 #define PANGO_ENABLE_BACKEND // ugh, why necessary?
 #include "string-convert.hh"
 #include "warn.hh"
 #include "all-font-metrics.hh"
+#include "program-option.hh"
 
 #if HAVE_PANGO_FT2
 #include "stencil.hh"
 
 Pango_font::Pango_font (PangoFT2FontMap *fontmap,
-                       PangoFontDescription *description,
+                       PangoFontDescription const *description,
                        Real output_scale)
 {
   (void) fontmap;
+  
   physical_font_tab_ = scm_c_make_hash_table (11);
   PangoDirection pango_dir = PANGO_DIRECTION_LTR;
   context_
     = pango_ft2_get_context (PANGO_RESOLUTION, PANGO_RESOLUTION);
-  //  context_ = pango_ft2_font_map_create_context (fontmap);
 
   pango_description_ = pango_font_description_copy (description);
   attribute_list_ = pango_attr_list_new ();
@@ -104,7 +105,7 @@ Pango_font::pango_item_string_stencil (PangoItem const *item, string str,
   char glyph_name[GLYPH_NAME_LEN];
   PangoAnalysis const *pa = &(item->analysis);
   PangoGlyphString *pgs = pango_glyph_string_new ();
-
+  
   pango_shape (str.c_str () + item->offset,
               item->length, (PangoAnalysis*) pa, pgs);
 
@@ -163,7 +164,9 @@ Pango_font::pango_item_string_stencil (PangoItem const *item, string str,
        {
          int errorcode = FT_Get_Glyph_Name (ftface, pg, glyph_name, GLYPH_NAME_LEN);
          if (errorcode)
-           programming_error ("FT_Get_Glyph_Name returns error");
+           programming_error (_f ("FT_Get_Glyph_Name () error: %s",
+                                  freetype_error_string (errorcode).c_str ()
+                                  ));
        }
 
       SCM char_id = SCM_EOL;
@@ -215,6 +218,8 @@ Pango_font::pango_item_string_stencil (PangoItem const *item, string str,
       tail = SCM_CDRLOC (*tail);
     }
 
+  pango_glyph_string_free (pgs);  
+  pgs = 0;
   PangoFontDescription *descr = pango_font_describe (pa->font);
   Real size = pango_font_description_get_size (descr)
     / (Real (PANGO_SCALE));
@@ -347,8 +352,8 @@ Pango_font::text_stencil (string str, bool tight) const
     UGH. Should have flags per output format signifying supported
     options.
   */
-  if (output_backend_global != "ps"
-      && output_backend_global != "eps")
+  string name = get_output_backend_name ();
+  if (name != "ps" && name != "eps")
     {
       /*
        For Pango based backends, we take a shortcut.
@@ -363,6 +368,7 @@ Pango_font::text_stencil (string str, bool tight) const
       return Stencil (b, exp);
     }
 
+  g_list_free (items);
 
   return dest;
 }