]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/pango-font.cc
Add basic scheme programmable engravers.
[lilypond.git] / lily / pango-font.cc
index f4a4922f240d7e98c224d31e5eb4979430cc85e1..1b90dcfed37be657483adf359f40d8687305b0d2 100644 (file)
@@ -172,6 +172,13 @@ Pango_font::pango_item_string_stencil (PangoGlyphItem const *glyph_item,
       PangoGlyph pg = pgi->glyph;
       PangoGlyphGeometry ggeo = pgi->geometry;
 
+      /*
+       Zero-width characters are valid Unicode characters,
+       but glyph lookups need to be skipped.
+      */
+      if (!(pg ^ PANGO_GLYPH_EMPTY))
+       continue;
+
       glyph_name[0] = '\0';
       if (has_glyph_names)
        {
@@ -316,32 +323,37 @@ Pango_font::text_stencil (string str,
   */
   PangoLayout *layout = pango_layout_new (context_);
   pango_layout_set_text (layout, str.c_str (), -1);
-  PangoLayoutLine *line = pango_layout_get_line (layout, 0);
-  GSList *layout_runs = line->runs;
+  GSList *lines = pango_layout_get_lines (layout);
 
   Stencil dest;
   Real last_x = 0.0;
 
-  for (GSList *p = layout_runs; p; p = p->next)
+  for (GSList *l = lines; l; l = l->next)
     {
-      PangoGlyphItem *item = (PangoGlyphItem *) p->data;
-      Stencil item_stencil = pango_item_string_stencil (item, tight);
+      PangoLayoutLine *line = (PangoLayoutLine *) l->data;
+      GSList *layout_runs = line->runs;
+
+      for (GSList *p = layout_runs; p; p = p->next)
+       {
+         PangoGlyphItem *item = (PangoGlyphItem *) p->data;
+         Stencil item_stencil = pango_item_string_stencil (item, tight);
 
-      item_stencil.translate_axis (last_x, X_AXIS);
-      last_x = item_stencil.extent (X_AXIS)[RIGHT];
+         item_stencil.translate_axis (last_x, X_AXIS);
+         last_x = item_stencil.extent (X_AXIS)[RIGHT];
 
 #if 0 // Check extents.
-      if (!item_stencil.extent_box ()[X_AXIS].is_empty ())
-       {
-         Stencil frame = Lookup::frame (item_stencil.extent_box (), 0.1, 0.1);
-         Box empty;
-         empty.set_empty ();
-         Stencil dimless_frame (empty, frame.expr ());
-         dest.add_stencil (frame);
-       }
+         if (!item_stencil.extent_box ()[X_AXIS].is_empty ())
+           {
+             Stencil frame = Lookup::frame (item_stencil.extent_box (), 0.1, 0.1);
+             Box empty;
+             empty.set_empty ();
+             Stencil dimless_frame (empty, frame.expr ());
+             dest.add_stencil (frame);
+           }
 #endif
 
-      dest.add_stencil (item_stencil);
+         dest.add_stencil (item_stencil);
+       }
     }
 
   string name = get_output_backend_name ();