]> git.donarmstrong.com Git - lilypond.git/commitdiff
* scm/framework-ps.scm (output-variables): separately scale the
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Sat, 1 Jan 2005 15:03:05 +0000 (15:03 +0000)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Sat, 1 Jan 2005 15:03:05 +0000 (15:03 +0000)
page to mm

* lily/pango-font.cc (Pango_font): fix scaling.

* lily/font-metric.cc (design_size): design_size returns a
dimension now as well.

ChangeLog
lily/font-metric.cc
lily/font-select.cc
lily/include/pango-font.hh
lily/open-type-font.cc
lily/pango-font.cc
lily/pango-select.cc
lily/tfm.cc
scm/framework-ps.scm

index ca5108a5c344c70f064bf17d64a3838bf9ac5a0f..111a47c5075dd9906b15c91e36879314f80b26a1 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2005-01-01  Han-Wen Nienhuys  <hanwen@xs4all.nl>
+
+       * scm/framework-ps.scm (output-variables): separately scale the
+       page to mm 
+
+       * lily/pango-font.cc (Pango_font): fix scaling.
+
+       * lily/font-metric.cc (design_size): design_size returns a
+       dimension now as well.
+
 2004-12-31  Han-Wen Nienhuys  <hanwen@xs4all.nl>
 
        * mf/GNUmakefile ($(outdir)/%.otf-table): use findstring. Fixes
index cc0ae4244f588a9ed9394d24c42e05eaab4b20c2..415e2db6de1fa32feab8383adb7a3e3c51a4189e 100644 (file)
@@ -13,6 +13,7 @@
 #include <math.h>
 #include <cctype>
 
+#include "dimensions.hh"
 #include "modified-font-metric.hh"
 #include "open-type-font.hh"
 #include "stencil.hh"
@@ -24,7 +25,7 @@
 Real
 Font_metric::design_size () const
 {
-  return 1.0;
+  return 1.0 * point_constant;
 }
 
 String
index 9ded64e067b4a52f206ae1bcbfcdfdbfdedd6b02..348544e3e42924236276b1df01c0cb4f0433e983 100644 (file)
@@ -8,6 +8,7 @@
 
 #include <math.h>
 
+#include "dimensions.hh"
 #include "all-font-metrics.hh"
 #include "output-def.hh"
 #include "font-interface.hh"
@@ -47,11 +48,6 @@ wild_compare (SCM field_val, SCM val)
          || field_val == val);
 }
 
-/*
-  TODO: this triggers a great number of font-loads (feta11 upto
-  parmesan23). We could make a Delayed_load_font_metric for which the
-  design size is specced in advance.
- */
 Font_metric *
 get_font_by_design_size (Output_def *layout, Real requested,
                         SCM font_vector,
@@ -144,7 +140,8 @@ select_encoded_font (Output_def *layout, SCM chain, SCM input_encoding)
       SCM font_encoding
        = scm_cdr (ly_chain_assoc (ly_symbol2scm ("font-encoding"), chain));
 
-      return get_font_by_mag_step (layout, req, vec, scm_to_double (base_size),
+      return get_font_by_mag_step (layout, req, vec,
+                                  scm_to_double (base_size) * point_constant,
                                   font_encoding, input_encoding);
     }
 
index 8b832dcbc44d3ae6ec8f5d6cce651067ed144188..55e566eb65d08049e06ac53d4b047034014cbd45 100644 (file)
@@ -45,13 +45,12 @@ symbols_to_pango_font_description (SCM family,
                                   SCM style,
                                   SCM variant,
                                   SCM weight,
-                                  SCM stretch,
-                                  Real size);
+                                  SCM stretch);
 
 Font_metric *
 select_pango_font (Output_def *layout, SCM chain);
 
-const int PANGO_DPI = 1200;
+const int PANGO_RESOLUTION = 1200;
 
 #endif /* HAVE_PANGO16 */
 #endif /* PANGO_FONT_HH */
index 9664dd43ba779d0f2e72dc0f681ae44d2c391126..627a35aae4dac2f5eaa0821e7535845160d869e6 100644 (file)
@@ -176,7 +176,7 @@ Open_type_font::get_indexed_char (int signed_idx) const
   Box b (Interval (-hb, m.width - hb),
         Interval (-vb, m.height - vb));
 
-  b.scale (design_size () * Real (point_constant) / face_->units_per_EM);
+  b.scale (design_size ()  / Real (face_->units_per_EM));
   return b;
 }
 
@@ -214,7 +214,7 @@ Open_type_font::design_size () const
                               quickly. --hwn.
                              */
                             scm_from_int (1));
-  return scm_to_double (entry);
+  return scm_to_double (entry) * Real (point_constant);
 }
 
 
index 6957e8d00c3b18fdbc3251a24aa49e77445aafeb..042ac350a6f054efbb93c7da2ed1983692c28bcd 100644 (file)
@@ -29,10 +29,16 @@ Pango_font::Pango_font (PangoFT2FontMap *fontmap,
     ? PANGO_DIRECTION_LTR
     : PANGO_DIRECTION_RTL;
   context_ =
-    pango_ft2_get_context (PANGO_DPI, PANGO_DPI);
+    pango_ft2_get_context (PANGO_RESOLUTION, PANGO_RESOLUTION);
   //  context_ = pango_ft2_font_map_create_context (fontmap);  
   attribute_list_= pango_attr_list_new();
-  scale_ = inch_constant / (Real (PANGO_SCALE) * Real (PANGO_DPI));
+
+  /*
+    urgh. I don't understand this. Why isn't this 1/(scale * resolution)
+
+    --hwn
+   */
+  scale_ = INCH_TO_BP / (Real (PANGO_SCALE) * Real (PANGO_RESOLUTION));
   
   pango_context_set_language (context_, pango_language_from_string ("en_US"));
   pango_context_set_base_dir (context_, pango_dir);
@@ -105,7 +111,7 @@ Pango_font::pango_item_string_stencil (PangoItem *item, String str, Real dx) con
 
   PangoFontDescription *descr = pango_font_describe (pa->font);
   Real size = pango_font_description_get_size (descr)
-    /  (Real (PANGO_SCALE)) ;
+    /  (Real (PANGO_SCALE));
       
   FcPattern *fcpat = fcfont->font_pattern;
   char *filename = 0;
index 71553a1a9164c70558419722701d5313d4e089a5..402f7881464f677512184057523b740e0195fa29 100644 (file)
@@ -8,6 +8,7 @@
 */
 #include <math.h>
 
+#include "dimensions.hh"
 #include "all-font-metrics.hh"
 #include "output-def.hh"
 #include "pango-font.hh"
@@ -22,13 +23,6 @@ select_pango_font (Output_def *layout, SCM chain)
     {
       String name_str = ly_scm2string (scm_cdr (name));
       description = pango_font_description_from_string (name_str.to_str0 ());
-      
-      
-      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);
-      pango_font_description_set_size (description,
-                                      gint (size * PANGO_SCALE));
     }
   else
     {
@@ -42,16 +36,17 @@ select_pango_font (Output_def *layout, SCM chain)
       SCM weight = ly_chain_assoc_get (ly_symbol2scm ("font-series"), chain,
                                       SCM_BOOL_F);
       
-      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);
-
       description
        = symbols_to_pango_font_description (family, style, variant, weight,
-                                            SCM_BOOL_F,
-                                            size);
+                                            SCM_BOOL_F);
     }
 
+  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;
+  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,
@@ -146,8 +141,7 @@ symbols_to_pango_font_description(SCM family,
                                  SCM style,
                                  SCM variant,
                                  SCM weight,
-                                 SCM stretch,
-                                 Real size)
+                                 SCM stretch)
 {
   PangoFontDescription * description = pango_font_description_new ();
 
@@ -164,8 +158,6 @@ symbols_to_pango_font_description(SCM family,
                                     symbol_to_pango_weight (weight));
   pango_font_description_set_stretch (description,
                                      symbol_to_pango_stretch (stretch));
-  pango_font_description_set_size (description,
-                                  gint (size * PANGO_SCALE));
 
   return description;
 }
index 6770486f881ae7ff92a4347176851733a52a5200..815edd3ca1e83577609d1845e9ce2f9556845f02 100644 (file)
@@ -111,7 +111,7 @@ Tex_font_metric::make_tfm (String file_name)
 Real
 Tex_font_metric::design_size () const
 {
-  return info_.design_size;
+  return info_.design_size * point_constant;
 }
 
 String
index 4c535726067ad0348aaee33d769536061b9241ff..4425cf8a1135f260d4e4c1ada236d36390959648 100644 (file)
      (value->string (ly:output-def-lookup layout ly-key)) " def \n"))
 
   (string-append
-   "/lily-output-units " (number->string mm-to-bigpoint) " def %% milimeter \n"
+   "/lily-output-units " (number->string mm-to-bigpoint) " def %% milimeter
+lily-output-units lily-output-units scale
+"
    (output-entry "staff-line-thickness" 'linethickness)
    (output-entry "line-width" 'linewidth)
    (output-entry "paper-size" 'papersizename)
    (output-entry "staff-height" 'staffheight)  ;junkme.
    "/output-scale "
    (number->string (ly:output-def-lookup layout 'outputscale))
-   " lily-output-units mul def \n"
+   " def \n"
    (output-entry "page-height" 'vsize)
    (output-entry "page-width" 'hsize)))