]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/pango-select.cc
(all-grob-descriptions): remove all
[lilypond.git] / lily / pango-select.cc
index c49c63cf37934a579004f55097555fc40e62004f..5002fe8a197b8c488e53a0f34d38356d6576abcf 100644 (file)
@@ -13,8 +13,9 @@
 #include "output-def.hh"
 #include "pango-font.hh"
 
-Font_metric *
-select_pango_font (Output_def *layout, SCM chain)
+
+PangoFontDescription *
+properties_to_pango_description (SCM chain, Real text_size)
 {
   SCM name = ly_chain_assoc (ly_symbol2scm ("font-name"), chain);
 
@@ -42,16 +43,21 @@ select_pango_font (Output_def *layout, SCM chain)
     }
 
   Real step = robust_scm2double (ly_symbol2scm ("font-size"), 0.0);
-  Real size = layout->get_dimension (ly_symbol2scm ("text-font-size"))
-    * pow (2.0, step / 6.0) * point_constant;
+  Real size = text_size * pow (2.0, step / 6.0);
+  
   pango_font_description_set_size (description,
                                   gint (size * PANGO_SCALE));
-  
-  Font_metric * fm = all_fonts_global->find_pango_font (description);
-
-  return find_scaled_font (layout, fm, 1.0);
+  return description;
 }
 
+Font_metric *
+select_pango_font (Output_def *layout, SCM chain)
+{
+  PangoFontDescription *pfd = properties_to_pango_description (chain,
+                                                              point_constant * layout->get_dimension (ly_symbol2scm ("text-font-size")));
+  
+  return all_fonts_global->find_pango_font (pfd, 1.0, output_scale (layout));
+}
 
 PangoStyle
 symbol_to_pango_style (SCM style)
@@ -59,7 +65,7 @@ symbol_to_pango_style (SCM style)
   PangoStyle pstyle = PANGO_STYLE_NORMAL;
   if (style == ly_symbol2scm ("italic"))
     {
-      pstyle = PANGO_STYLE_NORMAL;
+      pstyle = PANGO_STYLE_ITALIC;
     }
   else if (style == ly_symbol2scm ("oblique")
           || style == ly_symbol2scm ("slanted")
@@ -74,7 +80,7 @@ symbol_to_pango_style (SCM style)
 PangoVariant
 symbol_to_pango_variant (SCM variant)
 {
-  PangoVariant pvariant;
+  PangoVariant pvariant = PANGO_VARIANT_NORMAL;
   if (variant == ly_symbol2scm ("caps"))
     {
       pvariant = PANGO_VARIANT_SMALL_CAPS;
@@ -143,9 +149,12 @@ symbols_to_pango_font_description(SCM family,
 {
   PangoFontDescription * description = pango_font_description_new ();
 
-  String family_str = scm_is_symbol (family)
-    ? ly_symbol2string (family)
-    : String("roman");
+  String family_str = "roman";
+  if (scm_is_symbol (family))
+    family_str = ly_symbol2string (family);
+  else if (scm_is_string (family))
+    family_str = ly_scm2string (family);
+
   pango_font_description_set_family (description,
                                     family_str.to_str0 ());
   pango_font_description_set_style (description,