]> git.donarmstrong.com Git - lilypond.git/commitdiff
(text_stencil): don't translate glyphs in
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Thu, 25 Aug 2005 16:46:03 +0000 (16:46 +0000)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Thu, 25 Aug 2005 16:46:03 +0000 (16:46 +0000)
unscaled transform, just translate stencils.

ChangeLog
lily/include/pango-font.hh
lily/pango-font.cc
scm/output-ps.scm

index a808010eee9526a41bfe5284fbb17196f21d16df..9927fc4555c6db92d6dcd3677ab9a98f81496313 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2005-08-25  Han-Wen Nienhuys  <hanwen@xs4all.nl>
 
+       * lily/pango-font.cc (text_stencil): don't translate glyphs in
+       unscaled transform, just translate stencils.
+
        * ly/performer-init.ly: init timing to #t.  Fixes bar checks in
        MIDI.
 
index b8119b746aa57e885922ac1982b194008eee8757..b290339f139cd7b7a3a190087c73a23d95ae55ef 100644 (file)
@@ -25,6 +25,7 @@ class Pango_font : public Font_metric
   PangoFontDescription *pango_description_;
   PangoAttrList *attribute_list_;
   Real scale_;
+  Real output_scale_;
   SCM physical_font_tab_;
 
 public:
@@ -38,7 +39,7 @@ public:
   SCM font_file_name () const;
   void register_font_file (String, String);
   Stencil text_stencil (String) const;
-  Stencil pango_item_string_stencil (PangoItem *, String, Real) const;
+  Stencil pango_item_string_stencil (PangoItem *, String) const;
 
   virtual void derived_mark () const;
 };
index 7f76168ee120be5884d8c5ff4790a2b4d7f21b19..184bf1463fa33d6c2a71e4dc3dd63d29073b56ef 100644 (file)
@@ -44,6 +44,7 @@ Pango_font::Pango_font (PangoFT2FontMap *fontmap,
 
     --hwn
   */
+  output_scale_ = output_scale;
   scale_ = INCH_TO_BP / (Real (PANGO_SCALE) * Real (PANGO_RESOLUTION) * output_scale);
 
   /*
@@ -76,7 +77,7 @@ Pango_font::derived_mark () const
 }
 
 Stencil
-Pango_font::pango_item_string_stencil (PangoItem *item, String str, Real dx) const
+Pango_font::pango_item_string_stencil (PangoItem *item, String str) const
 {
   const int GLYPH_NAME_LEN = 256;
   char glyph_name[GLYPH_NAME_LEN];
@@ -126,12 +127,11 @@ Pango_font::pango_item_string_stencil (PangoItem *item, String str, Real dx) con
        }
       else
        char_id = scm_makfrom0str (glyph_name);
-      *tail = scm_cons (scm_list_3 (scm_from_double (ggeo.x_offset * scale_
-                                                    + dx),
+      
+      *tail = scm_cons (scm_list_3 (scm_from_double (ggeo.x_offset * scale_),
                                    scm_from_double (ggeo.y_offset * scale_),
                                    char_id),
                        SCM_EOL);
-      dx = 0.0;
       tail = SCM_CDRLOC (*tail);
     }
 
@@ -214,18 +214,15 @@ Pango_font::text_stencil (String str) const
 
   GList *ptr = items;
   Stencil dest;
-  Real x = 0.0;
+
+  Real last_x = 0.0;
   while (ptr)
     {
       PangoItem *item = (PangoItem *) ptr->data;
 
-      Stencil item_stencil = pango_item_string_stencil (item, str, x);
-
-
-      /*
-      UGH. Is this correct for bidi? 
-      */
-      x = item_stencil.extent (X_AXIS)[RIGHT];
+      Stencil item_stencil = pango_item_string_stencil (item, str);
+      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 ())
index e0bd54d9240c8a682109cbda33c8acc3815f2cc3..e06bca586302b5454ab92f94a21dcdd2b8149ec9 100644 (file)
         size cid?
         x-y-named-glyphs)
 
-  (define (encoding-vector-hack glyphs)
-    
-    ;; GS fucks up with glyphs that are not in the
-    ;; encoding vector.
-    (define (inner j glyphs)
-      (if (or (null? glyphs) (> j 256))
-         '()
-         (cons (format "dup ~a /~a put\n"
-                       j (car glyphs))
-               (inner (1+ j) (cdr glyphs)))))
-         
-    (format "256 array 0 1 255 { 1 index exch /.notdef put} for\n ~a
-/EncHack reencode-font /EncHack findfont"
-           (apply string-append (inner 32 glyphs))))
-    ;; END HACK.
-  
   (format #f "gsave 1 output-scale div 1 output-scale div scale
   /~a ~a ~a scalefont setfont\n~a grestore"
          postscript-font-name
          (if cid?
              " /CIDFont findresource "
              " findfont")
-       
+         
          size
          (apply
           string-append