]> git.donarmstrong.com Git - lilypond.git/commitdiff
* lily/pango-font.cc: backport: pango-font.cc, completely. This
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Wed, 30 Nov 2005 13:36:21 +0000 (13:36 +0000)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Wed, 30 Nov 2005 13:36:21 +0000 (13:36 +0000)
turns on TTF kerning.

* scm/output-ps.scm (glyph-string): backport: use width in glyph-string

ChangeLog
Documentation/index.html.in
GNUmakefile.in
buildscripts/mutopia-index.py
lily/all-font-metrics.cc
lily/include/pango-font.hh
lily/pango-font.cc
make/lilypond.fedora.spec.in
scm/output-ps.scm

index 041f37241f948786d1970538d4a988836d65cab3..db5f0f67bd9a586cb0b29b043ac490c3bcee096a 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,14 @@
+2005-11-30  Han-Wen Nienhuys  <hanwen@xs4all.nl>
+
+       * lily/pango-font.cc: backport: pango-font.cc, completely. This
+       turns on TTF kerning.
+
+       * scm/output-ps.scm (glyph-string): backport: use width in glyph-string
+
 2005-11-29  Han-Wen Nienhuys  <hanwen@xs4all.nl>
 
+       * GNUmakefile.in: backport of out-www excision.
+
        * scripts/*.py: update bug reporting addresses.  
 
        * lily/main.cc (LY_DEFINE): gmane address for reporting bugs.
index 79da4490689f9dafb16ef3d93f0c373fba941c79..fed0abf541e189227f7f6bcf5cb426920a8d04ba 100644 (file)
@@ -41,7 +41,7 @@
           <td class="left-column">
          <ul>
            <li>
-           <a class="title" href="../user/out-www/lilypond/Tutorial.html">Tutorial</a>
+           <a class="title" href="user/lilypond/Tutorial.html">Tutorial</a>
              <br>(start here)
          </ul>
          </td>
          <ul>
          
             <li>
-           <a class="title" href="../topdocs/out-www/NEWS.html">NEWS</a>
+           <a class="title" href="topdocs/NEWS.html">NEWS</a>
            <br>(changes since the last major release)
 
             <li>
-           <a class="title" href="../topdocs/out-www/INSTALL.html">INSTALL</a>
+           <a class="title" href="topdocs/INSTALL.html">INSTALL</a>
            <br>(how to compile)
          </ul>
          </td>
           &nbsp;
          <ul>
            <li>
-<a class="title" href="../user/out-www/lilypond/index.html">User manual</a>
-(in <a class="title" href="../user/out-www/lilypond.pdf">PDF</a>, in
-<a class="title" href="../user/out-www/lilypond.html">one big page, ~4Mb</a>)
+<a class="title" href="user/lilypond/index.html">User manual</a>
+(in <a class="title" href="user/lilypond.pdf">PDF</a>, in
+<a class="title" href="user/lilypond.html">one big page, ~4Mb</a>)
 
      <br>(everything about LilyPond)
      
-<li><a class="title"href="../../examples.html">Examples</a>
+<li><a class="title"href="../examples.html">Examples</a>
 
      <br>(see some examples)
 
-<li><a class="title" href="../../input/test/out-www/collated-files.html">Tips and tricks</a>
-(in  <a class="title" href="../../input/test/out-www/collated-files.pdf">PDF</a>)
+<li><a class="title" href="../input/test/collated-files.html">Tips and tricks</a>
+(in  <a class="title" href="../input/test/collated-files.pdf">PDF</a>)
 
      <br>(for advanced users)
- <li><a class="title" href="../user/out-www/music-glossary/index.html">Glossary</a>
-(in <a class="title" href="../user/out-www/music-glossary.pdf">PDF</a>, in
-<a class="title" href="../user/out-www/music-glossary.html">one big page</a>)
+ <li><a class="title" href="user/music-glossary/index.html">Glossary</a>
+(in <a class="title" href="user/music-glossary.pdf">PDF</a>, in
+<a class="title" href="user/music-glossary.html">one big page</a>)
 
      <br>(for non-English users)
          </ul>
           &nbsp;
          <ul>
            <li>
- <a  class="title" href="../user/out-www/lilypond-internals/index.html">Program reference</a>
- (in <a class="title" href="../user/out-www/lilypond-internals.html">one big page</a>)
+ <a  class="title" href="user/lilypond-internals/index.html">Program reference</a>
+ (in <a class="title" href="user/lilypond-internals.html">one big page</a>)
 
      <br>(definitions for tweaking)
 
            <li>
-     <a  class="title" href="../../input/regression/out-www/collated-files.html">Regression tests</a> (in <a  class="title" href="../../input/regression/out-www/collated-files.pdf">PDF</a>) ~ 2.4Mb
+     <a  class="title" href="../input/regression/collated-files.html">Regression tests</a> (in <a  class="title" href="../input/regression/collated-files.pdf">PDF</a>) ~ 2.4Mb
 
      <br>(for developers)
 
 
-           <li><a  class="title" href="../bibliography/out-www/index.html">Bibliography</a>
+           <li><a  class="title" href="bibliography/index.html">Bibliography</a>
 
      <br>(background information)
 <li><a class="title"  href="THANKS.html">Thank yous</a>
index 23fccd5411a991e20bfa6a3561a16fe4ae55fc83..9a4ad906bfd67c7f7265822b551724a283d498e5 100644 (file)
@@ -41,9 +41,9 @@ doc:
        $(MAKE) -C Documentation
 
 install-WWW:
-       -$(INSTALL) -m 755 -d $(DESTDIR)$(webdir) 
-       tar -C $(webdir)/ -xzf $(outdir)/web.tar.gz
-# install-WWW does not recurse; fake it visiting Documentation/user manually
+       -$(INSTALL) -m 755 -d $(DESTDIR)$(webdir)
+       cp -a $(outdir)/web-root/ $(DESTDIR)$(webdir)/
+
        $(MAKE) -C Documentation/user local-install-WWW
        $(MAKE) -C Documentation/user install-info
 
@@ -67,19 +67,31 @@ web-ext = html midi pdf png txt ly
 footify = $(PYTHON) $(step-bindir)/add-html-footer.py  --name $(PACKAGE_NAME) --version $(TOPLEVEL_VERSION)
 footifymail = MAILADDRESS=bug-lilypond@gnu.org
 
+
 local-WWW-post:
 # need UTF8 setting in case this is hosted on a website. 
-       echo -e 'AddDefaultCharset utf-8\nAddCharset utf-8 .html\nAddCharset utf-8 .en\nAddCharset utf-8 .nl\nAddCharset utf-8 .txt\n' > $(builddir)/.htaccess
-       $(PYTHON) $(buildscript-dir)/mutopia-index.py -o $(builddir)/examples.html ./
-       cd $(builddir) && $(FIND) . -name '*.html' -print | $(footifymail) xargs $(footify)
-       cd $(builddir) && find . -name \*.html~ -print | xargs rm -f
+       echo -e 'AddDefaultCharset utf-8\nAddCharset utf-8 .html\nAddCharset utf-8 .en\nAddCharset utf-8 .nl\nAddCharset utf-8 .txt\n' > $(outdir)/.htaccess
+       $(PYTHON) $(buildscript-dir)/mutopia-index.py -o $(outdir)/examples.html ./
+       echo '<META HTTP-EQUIV="refresh" content="0;URL=Documentation/index.html">' > $(outdir)/index.html
+       echo '<html><body>Redirecting to the documentation index...</body></html>' >> $(outdir)/index.html
+
+       $(FIND) $(builddir) -name '*.html' -print | $(footifymail) xargs $(footify)
+       $(FIND) $(builddir) -name \*.html~ -print | xargs rm -f
        cd $(builddir) && find Documentation input \
                $(web-ext:%=-path '*/out-www/*.%' -or) -type l \
                > $(outdir)/weblist
-       echo '<META HTTP-EQUIV="refresh" content="0;URL=Documentation/out-www/index.html">' > $(builddir)/index.html
-       echo '<html><body>Redirecting to the documentation index...</body></html>' >> $(builddir)/index.html
-       cd $(builddir) && ls *.html >> $(outdir)/weblist
-       cat $(outdir)/weblist | (cd $(builddir); GZIP=-9v tar -czf $(outdir)/web.tar.gz  -T -)
+       ls $(outdir)/*.html >> $(outdir)/weblist
+
+## rewrite paths so we lose out-www
+       rm -rf $(outdir)/web-root/
+       mkdir $(outdir)/web-root/
+       cat $(outdir)/weblist | (cd $(builddir); tar -cf-  -T- ) | \
+               tar -C $(outdir)/web-root/ -xf -  
+       cd $(outdir)/web-root/ &&  \
+               for a in `find -name out-www`; do \
+                       mv $$a/* $$a/.. ; \
+                       rmdir $$a ; \
+               done
 
 share-prefix = $(builddir)/share
 tree-prefix = $(builddir)/share/lilypond/$(TOPLEVEL_VERSION)
index 76ad6e1c5b5becaa8be65f6941f7349fad6fe879..8b02ea4ba2416294c71d63d694a216329c06047e 100644 (file)
@@ -18,6 +18,7 @@ def find (pat, dir):
        return lst
 
 
+junk_prefix = 'out-www/'
 
 headertext= r"""
 
@@ -26,16 +27,12 @@ headertext= r"""
 
 <p>You're looking at a page with some LilyPond samples.  These files
 are also included in the distribution. The output is completely
-generated from the <tt>.ly</tt> source file, without any further touch
-up.
+generated from the source file, without any further touch up.
 
 <p>
 
 The pictures are 90 dpi anti-aliased snapshots of the printed output.
-If you want a better impression of the appearance, do print out one of
-the PDF or PostScript files; they use scalable fonts, and should look
-good at any resolution.
-
+For a good impression of the quality print out the PDF file.
 """
 
 headertext_nopics= r"""
@@ -136,7 +133,7 @@ hr { border:0; height:1; color: #000000; background-color: #000000; }\n
                def list_item (file_name, desc, type, lst = list):
                        if os.path.isfile (file_name):
                                lst.write ('<li><a href="%s">%s</a>'
-                                          % (file_name, desc))
+                                          % (re.sub (junk_prefix, '', file_name), desc))
 
                                # FIXME: include warning if it uses \include
                                # files.
index 1273a3ae596feeb81160138edaff0a7d2d76ac8d..cbb646a305a747faf546148ad53f6636afc2bc6f 100644 (file)
@@ -78,7 +78,6 @@ All_font_metrics::find_pango_font (PangoFontDescription *description,
        progress_indication ("[" + String (pango_fn));
       
       Pango_font *pf = new Pango_font (pango_ft2_fontmap_,
-                                      RIGHT,
                                       description,
                                       output_scale);
       val = pf->self_scm ();
index b8119b746aa57e885922ac1982b194008eee8757..3874b29b6c1b1de09a0ad43bdc4f880cd82c89e2 100644 (file)
@@ -25,12 +25,12 @@ class Pango_font : public Font_metric
   PangoFontDescription *pango_description_;
   PangoAttrList *attribute_list_;
   Real scale_;
+  Real output_scale_;
   SCM physical_font_tab_;
 
 public:
   SCM physical_font_tab () const;
   Pango_font (PangoFT2FontMap *,
-             Direction leftright,
              PangoFontDescription *,
              Real);
   ~Pango_font ();
@@ -38,7 +38,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 (const PangoItem *, String) const;
 
   virtual void derived_mark () const;
 };
index c0218074672d459ae8fd0731a440d01732a158db..5f4950ae93a9e83aba4102c37b35d934312f216f 100644 (file)
 #include "stencil.hh"
 
 Pango_font::Pango_font (PangoFT2FontMap *fontmap,
-                       Direction dir,
                        PangoFontDescription *description,
                        Real output_scale)
 {
   (void) fontmap;
   physical_font_tab_ = scm_c_make_hash_table (11);
-  PangoDirection pango_dir = (dir == RIGHT)
-    ? PANGO_DIRECTION_LTR
-    : PANGO_DIRECTION_RTL;
+  PangoDirection pango_dir = PANGO_DIRECTION_LTR;
   context_
     = pango_ft2_get_context (PANGO_RESOLUTION, PANGO_RESOLUTION);
   //  context_ = pango_ft2_font_map_create_context (fontmap);
@@ -44,6 +41,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,15 +74,15 @@ 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 const *item, String str) const
 {
   const int GLYPH_NAME_LEN = 256;
   char glyph_name[GLYPH_NAME_LEN];
-  PangoAnalysis *pa = &(item->analysis);
+  PangoAnalysis const *pa = &(item->analysis);
   PangoGlyphString *pgs = pango_glyph_string_new ();
 
   pango_shape (str.to_str0 () + item->offset,
-              item->length, pa, pgs);
+              item->length, (PangoAnalysis*) pa, pgs);
 
   PangoRectangle logical_rect;
   PangoRectangle ink_rect;
@@ -101,7 +99,7 @@ Pango_font::pango_item_string_stencil (PangoItem *item, String str, Real dx) con
                   PANGO_ASCENT (ink_rect)));
 
   b.scale (scale_);
-  
+
   SCM glyph_exprs = SCM_EOL;
   SCM *tail = &glyph_exprs;
 
@@ -115,24 +113,24 @@ Pango_font::pango_item_string_stencil (PangoItem *item, String str, Real dx) con
 
       FT_Get_Glyph_Name (ftface, pg, glyph_name, GLYPH_NAME_LEN);
 
-
-      SCM char_id; 
+      SCM char_id;
       if (glyph_name[0] == '\0')
        {
          /*
            CID entry
-          */
+         */
          cid_keyed = true;
          char_id = scm_from_int (pg);
        }
       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_4 (scm_from_double (ggeo.width * scale_),
+                                   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);
     }
 
@@ -141,14 +139,16 @@ Pango_font::pango_item_string_stencil (PangoItem *item, String str, Real dx) con
     / (Real (PANGO_SCALE));
 
   FcPattern *fcpat = fcfont->font_pattern;
-  char *file_name = 0;
-  FcPatternGetString (fcpat, FC_FILE, 0, (FcChar8 **) & file_name);
-#ifdef __MINGW32__
-  /* Normalize file name.  */
-  // FIXME: memleak(s?), drop the #ifdef?
-  file_name = File_name (file_name).to_string ().get_copy_str0 ();
-#endif
+  char *file_name_as_ptr = 0;
+  FcPatternGetString (fcpat, FC_FILE, 0, (FcChar8 **) & file_name_as_ptr);
 
+  String file_name;
+  if (file_name_as_ptr)
+    {
+      /* Normalize file name.  */
+      file_name = File_name (file_name_as_ptr).to_string ();
+    }
+  
   char const *ps_name_str0 = FT_Get_Postscript_Name (ftface);
 
   if (!ps_name_str0)
@@ -156,15 +156,15 @@ Pango_font::pango_item_string_stencil (PangoItem *item, String str, Real dx) con
 
   String ps_name;
   if (!ps_name_str0
-      && file_name
-      && (String (file_name).index (".otf") >= 0
-         || String (file_name).index (".cff") >= 0))
+      && file_name != ""
+      && (file_name.index (".otf") >= 0
+         || file_name.index (".cff") >= 0))
     {
 
       /* UGH: kludge a PS name for OTF/CFF fonts.  */
       String name = file_name;
-      int idx = max (String (file_name).index (".otf"),
-                    String (file_name).index (".cff"));
+      int idx = max (file_name.index (".otf"),
+                    file_name.index (".cff"));
 
       name = name.left_string (idx);
 
@@ -185,7 +185,7 @@ Pango_font::pango_item_string_stencil (PangoItem *item, String str, Real dx) con
     {
       ((Pango_font *) this)->register_font_file (file_name, ps_name);
       pango_fc_font_unlock_face (fcfont);
-       
+
       SCM expr = scm_list_5 (ly_symbol2scm ("glyph-string"),
                             scm_makfrom0str (ps_name.to_str0 ()),
                             scm_from_double (size),
@@ -208,25 +208,52 @@ Pango_font::physical_font_tab () const
 Stencil
 Pango_font::text_stencil (String str) const
 {
-  GList *items = pango_itemize (context_,
-                               str.to_str0 (),
-                               0, str.length (), attribute_list_,
-                               NULL);
+  GList *items
+    = pango_itemize (context_,
+                    str.to_str0 (),
+                    0, str.length (), attribute_list_,
+                    NULL);
 
-  GList *ptr = items;
   Stencil dest;
-  Real x = 0.0;
-  while (ptr)
+
+  Real last_x = 0.0;
+
+  Direction text_dir = RIGHT;
+  for (GList *p = items; p; p = p->next)
+    {
+      PangoItem *item = (PangoItem *) p->data;
+      if (item->analysis.level == PANGO_DIRECTION_RTL)
+       text_dir = LEFT;
+    }
+  for (GList *ptr = items; ptr; ptr = ptr->next)
     {
       PangoItem *item = (PangoItem *) ptr->data;
 
-      Stencil item_stencil = pango_item_string_stencil (item, str, x);
+      Stencil item_stencil = pango_item_string_stencil (item, str);
 
-      x = item_stencil.extent (X_AXIS)[RIGHT];
+      if (text_dir == RIGHT)
+       {
+         item_stencil.translate_axis (last_x, X_AXIS);
+         last_x = item_stencil.extent (X_AXIS)[RIGHT];
+       }
+      else if (text_dir == LEFT)
+       {
+         dest.translate_axis (item_stencil.extent (X_AXIS)[RIGHT], X_AXIS);
+       }
 
+#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);
+       }
+#endif
+  
       dest.add_stencil (item_stencil);
-
-      ptr = ptr->next;
     }
 
   /*
@@ -241,7 +268,7 @@ Pango_font::text_stencil (String str) const
       */
       char *descr_string = pango_font_description_to_string (pango_description_);
       SCM exp
-       = scm_list_3 (ly_symbol2scm ("utf8-string"),
+       = scm_list_3 (ly_symbol2scm ("utf-8-string"),
                      scm_makfrom0str (descr_string),
                      scm_makfrom0str (str.to_str0 ()));
 
@@ -252,17 +279,6 @@ Pango_font::text_stencil (String str) const
       return Stencil (b, exp);
     }
 
-#if 0
-  // check extents.
-  if (!dest.extent_box ()[X_AXIS].is_empty ())
-    {
-      Stencil frame = Lookup::frame (dest.extent_box (), 0.1, 0.1);
-      Box empty;
-      empty.set_empty ();
-      Stencil dimless_frame (empty, frame.expr ());
-      dest.add_stencil (frame);
-    }
-#endif
 
   return dest;
 }
index 3091df8f605ba0bf70cd29ff47323dac6b613449..6d86228f1c1e16e4348ffa6d8ae88e0aafa821c1 100644 (file)
@@ -182,8 +182,7 @@ scrollkeeper-update
 
 %{_datadir}/lilypond/@TOPLEVEL_VERSION@/
 %{_datadir}/locale/*/LC_MESSAGES/lilypond.mo
-
-# %{_libdir}/lilypond/
+%{_libdir}/lilypond/
 
 
 %files documentation
index 8ad92dc74c900551cf6d9e1bdea8655720f3423e..954c03aa989c791cb571f44fc7b023f4ba9af344 100644 (file)
 (define (glyph-string
         postscript-font-name
         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"
+        w-x-y-named-glyphs)
+
+  (format #f "gsave 
+  /~a ~a ~a output-scale div scalefont setfont\n~a grestore"
          postscript-font-name
          (if cid?
              " /CIDFont findresource "
              " findfont")
-       
          size
          (apply
           string-append
           (map (lambda  (item)
                  (let*
-                     ((x (car item))
-                      (y (cadr item))
-                      (g (caddr item))
+                     ((w (car item))
+                      (x (cadr item))
+                      (y (caddr item))
+                      (g (cadddr item))
                       (prefix (if  (string? g) "/" "")))
 
-                   (if (and (= 0.0 x)
-                            (= 0.0 y))
-                       (format #f " ~a~a glyphshow\n" prefix g)
-                       (format #f " ~a ~a rmoveto ~a~a glyphshow\n"
-                               x y
-                               prefix
-                               g))))
-               x-y-named-glyphs))))
+                   (format #f " gsave ~a~a glyphshow grestore ~a ~a rmoveto \n" prefix g (+ w x) y)
+                   ))
+               w-x-y-named-glyphs))))
 
 (define (grob-cause offset grob)
   (let* ((cause (ly:grob-property grob 'cause))