From: Han-Wen Nienhuys <hanwen@xs4all.nl>
Date: Thu, 25 Aug 2005 16:46:03 +0000 (+0000)
Subject: (text_stencil): don't translate glyphs in
X-Git-Tag: release/2.7.8~14
X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=cd029434d0cb431315ed12f51ff01cf2813bb365;p=lilypond.git

(text_stencil): don't translate glyphs in
unscaled transform, just translate stencils.
---

diff --git a/ChangeLog b/ChangeLog
index a808010eee..9927fc4555 100644
--- 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.
 
diff --git a/lily/include/pango-font.hh b/lily/include/pango-font.hh
index b8119b746a..b290339f13 100644
--- a/lily/include/pango-font.hh
+++ b/lily/include/pango-font.hh
@@ -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;
 };
diff --git a/lily/pango-font.cc b/lily/pango-font.cc
index 7f76168ee1..184bf1463f 100644
--- a/lily/pango-font.cc
+++ b/lily/pango-font.cc
@@ -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 ())
diff --git a/scm/output-ps.scm b/scm/output-ps.scm
index e0bd54d924..e06bca5863 100644
--- a/scm/output-ps.scm
+++ b/scm/output-ps.scm
@@ -138,29 +138,13 @@
 	 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