From 136bdc3c4835942f396d57ac78df71d97c43d3e8 Mon Sep 17 00:00:00 2001
From: Han-Wen Nienhuys <hanwen@xs4all.nl>
Date: Tue, 3 May 2005 22:22:56 +0000
Subject: [PATCH] * lily/context-def.cc (path_to_acceptable_context): bugfix,
 depth should be taken without child context.

* ly/chord-modifiers-init.ly (blackTriangleMarkup): use it.

* scm/define-markup-commands.scm (triangle): new command, as
robust replacement for unicode Delta/Triangle.
---
 ChangeLog                      | 14 ++++++++++++++
 VERSION                        |  2 +-
 buildscripts/ps-embed-cff.py   | 35 ----------------------------------
 lily/context-def.cc            |  5 +----
 lily/lookup.cc                 |  1 +
 ly/chord-modifiers-init.ly     |  6 ++++--
 ly/engraver-init.ly            |  8 ++++----
 ps/music-drawing-routines.ps   | 13 +++++++------
 scm/define-markup-commands.scm | 21 ++++++++++++++++++++
 scm/output-ps.scm              |  3 ++-
 scm/output-tex.scm             |  4 ++--
 11 files changed, 57 insertions(+), 55 deletions(-)
 delete mode 100644 buildscripts/ps-embed-cff.py

diff --git a/ChangeLog b/ChangeLog
index ffd2f2b408..10870c2944 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,19 @@
+2005-05-04  Han-Wen Nienhuys  <hanwen@xs4all.nl>
+
+	* lily/context-def.cc (path_to_acceptable_context): bugfix, depth
+	should be taken without child context.
+
+	* ly/chord-modifiers-init.ly (blackTriangleMarkup): use it.
+
+	* scm/define-markup-commands.scm (triangle): new command, as
+	robust replacement for unicode Delta/Triangle.
+
 2005-05-03  Han-Wen Nienhuys  <hanwen@xs4all.nl>
 
+	* ps/music-drawing-routines.ps: add fillp argument.
+
+	* lily/lookup.cc (round_filled_polygon): polygon takes filled? argument
+
 	* lily/font-config.cc (init_fontconfig): don't add cff/
 
 	* VERSION (PACKAGE_NAME): release 2.5.22
diff --git a/VERSION b/VERSION
index bcd4ae6864..8ec81acb43 100644
--- a/VERSION
+++ b/VERSION
@@ -1,6 +1,6 @@
 PACKAGE_NAME=LilyPond
 MAJOR_VERSION=2
 MINOR_VERSION=5
-PATCH_LEVEL=22
+PATCH_LEVEL=23
 MY_PATCH_LEVEL=
 
diff --git a/buildscripts/ps-embed-cff.py b/buildscripts/ps-embed-cff.py
deleted file mode 100644
index 8eabaede5b..0000000000
--- a/buildscripts/ps-embed-cff.py
+++ /dev/null
@@ -1,35 +0,0 @@
-#!@PYTHON@
-import sys
-
-file  = sys.argv[1]
-font_set_name  = sys.argv[2]
-output = sys.argv[3]
-body = open (file).read() 
-body_length  = len (body)
-version = '0'
-binary_data = "/%(font_set_name)s %(body_length)d StartData "  % vars() \
-  + body
-binary_length = len (binary_data)
-
-header = r"""%%%%BeginResource: font %(font_set_name)s
-%%!PS-Adobe-3.0 Resource-FontSet
-%%%%DocumentNeededResources: ProcSet (FontSetInit)
-%%%%Title: (FontSet/%(font_set_name)s)
-%%%%Version: %(version)s
-%%%%EndComments
-%%%%IncludeResource: ProcSet (FontSetInit)
-%%%%BeginResource: FontSet (%(font_set_name)s)
-/FontSetInit /ProcSet findresource begin
-%%%%BeginData: %(binary_length)d Binary Bytes
-""" % vars()
-
-
-footer = """\n%%%%EndData
-%%%%EndResource
-%%%%EOF
-%%%%EndResource\n""" % vars()
-
-fo = open (output,'w')
-fo.write (header)
-fo.write (binary_data)
-fo.write (footer)
diff --git a/lily/context-def.cc b/lily/context-def.cc
index a17eb49954..858ef35ff9 100644
--- a/lily/context-def.cc
+++ b/lily/context-def.cc
@@ -227,12 +227,9 @@ Context_def::path_to_acceptable_context (SCM type_sym, Output_def *odef) const
 	= g->path_to_acceptable_context (type_sym, odef);
       if (result.size () && result.size () < best_depth)
 	{
+	  best_depth = result.size ();
 	  result.insert (g, 0);
 	  best_result = result;
-
-	  /* this following line was added in 1.9.3, but hsould've been
-	     there all along... Let's hope it doesn't cause nightmares.  */
-	  best_depth = result.size ();
 	}
     }
 
diff --git a/lily/lookup.cc b/lily/lookup.cc
index 57d668fe73..567cb9dd6d 100644
--- a/lily/lookup.cc
+++ b/lily/lookup.cc
@@ -308,6 +308,7 @@ Lookup::round_filled_polygon (Array<Offset> points, Real blotdiameter)
   SCM polygon_scm = scm_list_n (ly_symbol2scm ("polygon"),
 				ly_quote_scm (shrinked_points_scm),
 				scm_make_real (blotdiameter),
+				SCM_BOOL_T,
 				SCM_UNDEFINED);
 
   Stencil polygon = Stencil (box, polygon_scm);
diff --git a/ly/chord-modifiers-init.ly b/ly/chord-modifiers-init.ly
index e3ce577382..ff78e3daca 100644
--- a/ly/chord-modifiers-init.ly
+++ b/ly/chord-modifiers-init.ly
@@ -4,8 +4,9 @@ chordmodifiers = #default-chord-modifier-list
 
 
 whiteTriangleMarkup = \markup {
+  \triangle ##f
   %%  394 capital delta
-  #(ly:export (ly:wide-char->utf-8 #x0394))
+  %#(ly:export (ly:wide-char->utf-8 #x0394))
 
   %% 2206 : delta from the symbol font.
   %   #(ly:export (ly:wide-char->utf-8 #x2206))
@@ -17,9 +18,10 @@ whiteTriangleMarkup = \markup {
 } 
 
 blackTriangleMarkup = \markup {
+  \triangle ##t
 
   %% black up pointing triangle
-  #(ly:export (ly:wide-char->utf-8 #x25B2))
+%  #(ly:export (ly:wide-char->utf-8 #x25B2))
 }
 
 ignatzekExceptionMusic = {
diff --git a/ly/engraver-init.ly b/ly/engraver-init.ly
index f058624211..4c71a445c4 100644
--- a/ly/engraver-init.ly
+++ b/ly/engraver-init.ly
@@ -402,7 +402,7 @@ AncientRemoveEmptyStaffContext = \context {
 
 \context {
   \type Score_engraver
-  \name Score
+  \name "Score"
 
   \description "This is the top level notation context.  No
     other context can contain a @code{Score} context.  This context
@@ -435,12 +435,12 @@ AncientRemoveEmptyStaffContext = \context {
 
   \defaultchild "Staff"
   \accepts "Staff"
-  \accepts "TabStaff"
+  \accepts "RhythmicStaff"
+%{  \accepts "TabStaff"
   \accepts "VaticanaStaff"
   \accepts "GregorianTranscriptionStaff"
   \accepts "MensuralStaff"
   \accepts "StaffGroup"
-  \accepts "RhythmicStaff"
   \accepts "DrumStaff"
   \accepts "Lyrics"
   \accepts "ChordNames"
@@ -450,7 +450,7 @@ AncientRemoveEmptyStaffContext = \context {
   \accepts "Devnull"
   \accepts "NoteNames"
   \accepts "FiguredBass"
-
+%}
   soloText = #"Solo"
   soloIIText = #"Solo II"
   aDueText = #"a2"
diff --git a/ps/music-drawing-routines.ps b/ps/music-drawing-routines.ps
index 53dc007fc2..a2e74c35bf 100644
--- a/ps/music-drawing-routines.ps
+++ b/ps/music-drawing-routines.ps
@@ -157,8 +157,9 @@ bind def
 	} ifelse
 } bind def
 
-/draw_polygon % x(n) y(n) x(n-1) y(n-1) ... x(1) y(1) n blot
+/draw_polygon % x(n) y(n) x(n-1) y(n-1) ... x(1) y(1) n blot fill
 {
+	/fillp exch def
 	/blot exch def
 
 	0 setlinecap
@@ -168,12 +169,12 @@ bind def
 	/points exch def
 	2 copy
 	moveto
-	1 1 points {pop lineto} for
-	currentdict /testing known {
-		%% outline only, for testing:
-		stroke
+	1 1 points { pop lineto } for
+	closepath 
+	fillp {
+		gsave stroke grestore fill
 	}{
-		closepath gsave stroke grestore fill
+		stroke
 	} ifelse
 } bind def
 
diff --git a/scm/define-markup-commands.scm b/scm/define-markup-commands.scm
index 09364bcc74..89f8fee98b 100644
--- a/scm/define-markup-commands.scm
+++ b/scm/define-markup-commands.scm
@@ -25,6 +25,27 @@
 optionally filled."
   (make-circle-stencil radius thickness fill))
 
+(def-markup-command (triangle layout props filled) (boolean?)
+  "A triangle, filled or not"
+  (let*
+      ((th (chain-assoc-get 'thickness props  0.1))
+       (size (chain-assoc-get 'font-size props 0))
+       (ex (* (magstep size)
+	      0.8
+	      (chain-assoc-get 'baseline-skip props 2))))
+
+    (ly:make-stencil
+     `(polygon '(0.0 0.0
+		     ,ex 0.0
+		     ,(* 0.5 ex)
+		     ,(* 0.86 ex))
+	   ,th
+	   ,filled)
+
+     (cons 0 ex)
+     (cons 0 (* .86 ex))
+     )))
+
 (def-markup-command (circle layout props arg) (markup?)
   "Draw a circle around @var{arg}.  Use @code{thickness},
 @code{circle-padding} and @code{font-size} properties to determine line
diff --git a/scm/output-ps.scm b/scm/output-ps.scm
index 8789ab096a..7d5ed56e9a 100644
--- a/scm/output-ps.scm
+++ b/scm/output-ps.scm
@@ -245,11 +245,12 @@
   (string-append 
    (ly:number->string x) " " (ly:number->string y) " { " s " } place-box\n"))
 
-(define (polygon points blotdiameter)
+(define (polygon points blotdiameter filled?)
   (string-append
    (ly:numbers->string points) " "
    (ly:number->string (/ (length points) 2)) " "
    (ly:number->string blotdiameter)
+   (if filled? " true " " false ")
    " draw_polygon"))
 
 (define (repeat-slash wid slope thick)
diff --git a/scm/output-tex.scm b/scm/output-tex.scm
index 960d62d439..0d60bd50a1 100644
--- a/scm/output-tex.scm
+++ b/scm/output-tex.scm
@@ -183,8 +183,8 @@
 (define (resetcolor)
   (string-append "\\color[rgb]{0,0,0}\n"))
 
-(define (polygon points blotdiameter)
-  (embedded-ps (list 'polygon `(quote ,points) blotdiameter)))
+(define (polygon points blotdiameter fill)
+  (embedded-ps (list 'polygon `(quote ,points) blotdiameter fill)))
 
 (define (draw-line thick fx fy tx ty)
   (embedded-ps (list 'draw-line thick fx fy tx ty)))
-- 
2.39.5