]> git.donarmstrong.com Git - lilypond.git/commitdiff
* mf/feta-bolletjes.mf (overdone_heads): add small style (ugly)
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Tue, 28 Mar 2006 14:50:49 +0000 (14:50 +0000)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Tue, 28 Mar 2006 14:50:49 +0000 (14:50 +0000)
note heads, for uniform widths in shape note output.

* scripts/lilypond-book.py (output): add links to filenames.

* scripts/lilypond-book.py (get_option_parser): init output_name
to ''. Backportme.

ChangeLog
flower/std-string.cc
lily/include/pango-font.hh
lily/open-type-font.cc
lily/pango-font.cc
lily/ttf.cc
mf/feta-bolletjes.mf
mf/feta-test-generic.mf
scripts/lilypond-book.py

index 8c871723e340f7a191977ebfc6a4ec270a745f92..6d302b4d3b1aefb35f42676cd488d5ce5e31e813 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2006-03-28  Han-Wen Nienhuys  <hanwen@lilypond.org>
 
+       * mf/feta-bolletjes.mf (overdone_heads): add small style (ugly)
+       note heads, for uniform widths in shape note output.
+
+       * scripts/lilypond-book.py (output): add links to filenames.
+
        * Documentation/topdocs/INSTALL.texi (Top): update versions.
 
        * lily/note-collision.cc (get_clash_groups): only consider when
index 855193ecb07b0a8849e66dec01f5a3e21224b0f0..304ddf33cf773076d1f43f3a70b1d30822a5b7ed 100644 (file)
@@ -101,6 +101,7 @@ string_compare (string const &a, string const &b)
 }
 
 #include "std-vector.hh"
+
 vector<string>
 string_split (string str, char c)
 {
index fd8ad695273f71218108cbd69a3dabbd47a4dee4..dc21ccf684199089a65de939d4cd9569e5894818 100644 (file)
@@ -27,7 +27,11 @@ class Pango_font : public Font_metric
   Real scale_;
   Real output_scale_;
   SCM physical_font_tab_;
-  Direction text_direction_; 
+  Direction text_direction_;
+
+  map<string, Index_to_charcode_map > charcode_maps_;
+
+  Index_to_charcode_map const *get_index_to_charcode_map (string postscript_name, FT_Face face);
 public:
   SCM physical_font_tab () const;
   Pango_font (PangoFT2FontMap *,
index 8e50a1a576b4ee385af3bb43ccd9864d6407d8bc..1a61c07884869fbe0ffd98ae1ad786cf1b06ee34 100644 (file)
@@ -68,18 +68,6 @@ load_scheme_table (char const *tag_str, FT_Face face)
   return tab;
 }
 
-Index_to_charcode_map
-make_index_to_charcode_map (FT_Face face)
-{
-  Index_to_charcode_map m;
-  FT_ULong charcode;
-  FT_UInt gindex;
-
-  for (charcode = FT_Get_First_Char (face, &gindex); gindex != 0;
-       charcode = FT_Get_Next_Char (face, charcode, &gindex))
-    m[gindex] = charcode;
-  return m;
-}
 
 Open_type_font::~Open_type_font ()
 {
index 86c4bf61f5ef6e244bea8bde81b32a31c9f15ac5..76ccfbc66d39ce2fbb20f1660a2e1d09a01a1999 100644 (file)
@@ -75,6 +75,19 @@ Pango_font::derived_mark () const
   scm_gc_mark (physical_font_tab_);
 }
 
+
+Index_to_charcode_map const *
+Pango_font::get_index_to_charcode_map (string key, FT_Face face)
+{
+  if (charcode_maps_.find (key) == charcode_maps_.end ())
+    charcode_maps_[key] = make_index_to_charcode_map (face);
+
+  if (charcode_maps_.find (key) == charcode_maps_.end ())
+    return 0;
+  
+  return &charcode_maps_[key];
+}
+
 Stencil
 Pango_font::pango_item_string_stencil (PangoItem const *item, string str) const
 {
@@ -101,10 +114,25 @@ Pango_font::pango_item_string_stencil (PangoItem const *item, string str) const
                   PANGO_ASCENT (ink_rect)));
 
   b.scale (scale_);
+  char const *ps_name_str0 = FT_Get_Postscript_Name (ftface);
+  FcPattern *fcpat = fcfont->font_pattern;
+  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 ();
+    }
+  
   SCM glyph_exprs = SCM_EOL;
   SCM *tail = &glyph_exprs;
-
+      
+  Index_to_charcode_map const *cmap = 0;
+  if  (! (ftface->face_flags & FT_FACE_FLAG_GLYPH_NAMES))
+    cmap = ((Pango_font*)this)->get_index_to_charcode_map (file_name, ftface);
+  
   bool cid_keyed = false;
   for (int i = 0; i < pgs->num_glyphs; i++)
     {
@@ -116,6 +144,13 @@ Pango_font::pango_item_string_stencil (PangoItem const *item, string str) const
       FT_Get_Glyph_Name (ftface, pg, glyph_name, GLYPH_NAME_LEN);
 
       SCM char_id;
+      if (glyph_name[0] == '\0' && cmap)
+       {
+         FT_ULong char_code = cmap->find (pg)->second;
+         
+         sprintf (glyph_name,  "uni%04lX", char_code);
+       }
+  
       if (glyph_name[0] == '\0')
        {
          /*
@@ -140,18 +175,6 @@ Pango_font::pango_item_string_stencil (PangoItem const *item, string str) const
   Real size = pango_font_description_get_size (descr)
     / (Real (PANGO_SCALE));
 
-  FcPattern *fcpat = fcfont->font_pattern;
-  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)
     warning (_f ("no PostScript font name for font `%s'", file_name));
index 82bc78dce28f2614fa85ab8b41b9c2e849915cfe..8d22ccee181e0b077c0dda5e77123dbca7bd919c 100644 (file)
 #include "warn.hh"
 #include "lily-guile.hh"
 #include "main.hh"
+#include "open-type-font.hh"
+
+
+Index_to_charcode_map
+make_index_to_charcode_map (FT_Face face)
+{
+  Index_to_charcode_map m;
+  FT_ULong charcode;
+  FT_UInt gindex;
+  
+  FT_Select_Charmap(face, FT_ENCODING_UNICODE);
+  for (charcode = FT_Get_First_Char (face, &gindex); gindex != 0;
+       charcode = FT_Get_Next_Char (face, charcode, &gindex))
+    m[gindex] = charcode;
+  return m;
+}
 
 /*
   Based on ttfps by Juliusz Chroboczek
@@ -132,20 +148,31 @@ print_trailer (void *out,
 
   lily_cookie_fprintf (out, "/CharStrings %d dict dup begin\n", mp->numGlyphs);
 
+  Index_to_charcode_map ic_map (make_index_to_charcode_map (face));
+
+  for (int i = 0; i < mp->numGlyphs; i++)
+    {
+      glyph_name[0] = 0;
+      if (face->face_flags & FT_FACE_FLAG_GLYPH_NAMES)
+       {
+         FT_Error error = FT_Get_Glyph_Name (face, i, glyph_name,
+                                             GLYPH_NAME_LEN);
+         if (error)
+           programming_error ("print_trailer(): FT_Get_Glyph_Name() returned error");
+         else
+           glyph_name[0] = 0;
+       }
 
-  if (face->face_flags & FT_FACE_FLAG_GLYPH_NAMES)
-    for (int i = 0; i < mp->numGlyphs; i++)
-      {
-       FT_Error error = FT_Get_Glyph_Name (face, i, glyph_name,
-                                           GLYPH_NAME_LEN);
-       if (error)
-         programming_error ("print_trailer(): FT_Get_Glyph_Name() returned error");
-       else
-         lily_cookie_fprintf (out, "/%s %d def ", glyph_name, i);
+      if (!glyph_name[0])
+       {
+         sprintf (glyph_name, "uni%04lX", ic_map[i]);
+       }
+      
+      lily_cookie_fprintf (out, "/%s %d def ", glyph_name, i);
 
-       if (! (i % 5))
-         lily_cookie_fprintf (out, "\n");
-      }
+      if (! (i % 5))
+       lily_cookie_fprintf (out, "\n");
+    }
 
   lily_cookie_fprintf (out, "end readonly def\n");
   lily_cookie_fprintf (out, "FontName currentdict end definefont pop\n");
index 8a1bd2883bb5208dea16ef68cd576365a649f863..98107ff8a4d3c3d780af4d34179fd315c6e79383 100644 (file)
@@ -207,6 +207,8 @@ if test > 0:
 fi;
 
 
+
+
 fet_beginchar ("Half notehead", "s1");
        draw_outside_ellipse (1.53 - puff_up_factor / 3.0, 34, 0.66, 0.17);
        undraw_inside_ellipse (3.25, 33, 0.81, 2.5 stafflinethickness#);
@@ -235,7 +237,6 @@ fet_beginchar ("Quart notehead", "s2");
        draw_staff (-2, 2, 0);
 fet_endchar;
 
-
 if test > 0:
        fet_beginchar ("Quart notehead", "s2");
                draw_outside_ellipse (1.49 - puff_up_factor / 3.0, 31,
@@ -245,6 +246,38 @@ if test > 0:
        fet_endchar;
 fi;
 
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+%%
+%% fonts for "small style"
+%% 
+
+fet_beginchar ("Half notehead (quarter size)", "s1small");
+       draw_outside_ellipse (1.49 - puff_up_factor / 3.0, 31, 0.707, 0.0);
+       undraw_inside_ellipse (3.25, 33, 0.81, 2.8 stafflinethickness#);
+
+       draw_staff (-2, 2, 0);
+fet_endchar;
+
+
+%% copy of normal.
+fet_beginchar ("Quart notehead (quarter size)", "s2small");
+       % used to have 32. With 31, they are slightly bolder.
+       draw_outside_ellipse (1.49 - puff_up_factor / 3.0, 31, 0.707, 0);
+       black_notehead_width# := charwd;
+
+       draw_staff (-2, 2, 0);
+fet_endchar;
+
+%% smaller.
+fet_beginchar ("Whole notehead (quarter size)", "s0small");
+       draw_outside_ellipse (1.60 - puff_up_factor / 3.0, 0, 0.707, 0);
+       undraw_inside_ellipse (1.30, 125 - puff_up_factor * 10,
+                              0.68, 2 stafflinethickness#);
+
+       draw_staff (-2, 2, 0);
+fet_endchar;
+
 
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
index 44b0168dd26ac07a39c302b41553c3a5edd8a868..552731486d58724e5f50f2f0a1bd19fcc35d307a 100644 (file)
@@ -6,8 +6,8 @@
 %input feta-eindelijk;
 %input feta-toevallig;
 %input feta-puntje;
-%input feta-bolletjes; 
-input feta-arrow;      
+input feta-bolletjes;  
+%input feta-arrow;     
 %input feta-schrift;   
 %input feta-schrift;
 %input feta-banier;
index efe7e5c784cd1087b3453240445b8022bcb7ab3e..4fbadf98134ed0154b21bc4d2fd840178162f68f 100644 (file)
@@ -603,7 +603,14 @@ output = {
 @end html
 ''',
 
-               PRINTFILENAME: '''@file{%(filename)s}
+               PRINTFILENAME: '''
+@html
+<a href="%(filename)s">
+@end html
+@file{%(filename)s}
+@html
+</a>
+@end html
        ''',
 
                QUOTE: r'''@quotation