CVSROOT:        /cvsroot/lilypond
Module name:    lilypond
Branch:         
Changes by:     Han-Wen Nienhuys <[EMAIL PROTECTED]>    05/08/25 13:37:00

Modified files:
        .              : ChangeLog THANKS 
        Documentation/topdocs: NEWS.tely 
        lily           : pango-font.cc text-interface.cc 
        scm            : define-grob-properties.scm 
                         define-markup-commands.scm 

Log message:
        * scm/define-markup-commands.scm (wordwrap-string): use
        text-direction
        (wordwrap-stencils): idem.
        (line): idem..
        (fill-line): idem.
        
        * scm/define-grob-properties.scm (all-user-grob-properties): add
        text-direction.

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/ChangeLog.diff?tr1=1.4082&tr2=1.4083&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/THANKS.diff?tr1=1.145&tr2=1.146&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/Documentation/topdocs/NEWS.tely.diff?tr1=1.79&tr2=1.80&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/lily/pango-font.cc.diff?tr1=1.39&tr2=1.40&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/lily/text-interface.cc.diff?tr1=1.5&tr2=1.6&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/scm/define-grob-properties.scm.diff?tr1=1.118&tr2=1.119&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/scm/define-markup-commands.scm.diff?tr1=1.112&tr2=1.113&r1=text&r2=text

Patches:
Index: lilypond/ChangeLog
diff -u lilypond/ChangeLog:1.4082 lilypond/ChangeLog:1.4083
--- lilypond/ChangeLog:1.4082   Thu Aug 25 12:38:21 2005
+++ lilypond/ChangeLog  Thu Aug 25 13:36:59 2005
@@ -1,3 +1,14 @@
+2005-08-25  Han-Wen Nienhuys  <[EMAIL PROTECTED]>
+
+       * scm/define-markup-commands.scm (wordwrap-string): use
+       text-direction
+       (wordwrap-stencils): idem.
+       (line): idem..
+       (fill-line): idem.
+
+       * scm/define-grob-properties.scm (all-user-grob-properties): add
+       text-direction.
+
 2005-08-25  Nicolas Sceaux  <[EMAIL PROTECTED]>
 
        * lily/lily-parser.cc (Lily_parser): also copy output_basename_
@@ -30,7 +41,7 @@
 
        * lily/vertical-align-engraver.cc (process_music): call
        Align_interface::set_axis(). This forces #'elements to be ordered,
-       preventing random vertical reordering  of staves.
+       preventing random vertical reordering of staves.
 
        * scm/define-grob-interfaces.scm (dynamic-line-spanner-interface):
        add avoid-slur property. 
Index: lilypond/Documentation/topdocs/NEWS.tely
diff -u lilypond/Documentation/topdocs/NEWS.tely:1.79 
lilypond/Documentation/topdocs/NEWS.tely:1.80
--- lilypond/Documentation/topdocs/NEWS.tely:1.79       Wed Aug 24 15:54:56 2005
+++ lilypond/Documentation/topdocs/NEWS.tely    Thu Aug 25 13:37:00 2005
@@ -48,6 +48,14 @@
 
 
 @item
+The order of words in @code{\markup} commands may now be reversed by
+setting the @code{text-direction} property. This is useful for
+Right-to-Left languages like Hebrew.
+
+This feature was sponsored by Aaron Mehl.
+
+
[EMAIL PROTECTED]
 Texts over multi measure rests now stretch corresponding measure.
 
 @lilypond[relative=2,fragment,raggedright]
Index: lilypond/THANKS
diff -u lilypond/THANKS:1.145 lilypond/THANKS:1.146
--- lilypond/THANKS:1.145       Wed Aug 24 15:54:56 2005
+++ lilypond/THANKS     Thu Aug 25 13:36:59 2005
@@ -21,6 +21,7 @@
 
 SPONSORS
 
+Aaron Mehl
 Jay Hamilton
 Jamie Bullock
 D. Josiah Boothby
Index: lilypond/lily/pango-font.cc
diff -u lilypond/lily/pango-font.cc:1.39 lilypond/lily/pango-font.cc:1.40
--- lilypond/lily/pango-font.cc:1.39    Sat Aug 13 21:35:22 2005
+++ lilypond/lily/pango-font.cc Thu Aug 25 13:37:00 2005
@@ -221,6 +221,9 @@
 
       Stencil item_stencil = pango_item_string_stencil (item, str, x);
 
+      /*
+      UGH. Is this correct for bidi? 
+      */
       x = item_stencil.extent (X_AXIS)[RIGHT];
 
       dest.add_stencil (item_stencil);
Index: lilypond/lily/text-interface.cc
diff -u lilypond/lily/text-interface.cc:1.5 lilypond/lily/text-interface.cc:1.6
--- lilypond/lily/text-interface.cc:1.5 Thu Aug 11 12:47:26 2005
+++ lilypond/lily/text-interface.cc     Thu Aug 25 13:37:00 2005
@@ -92,5 +92,9 @@
 
 ADD_INTERFACE (Text_interface, "text-interface",
               "A scheme markup text, see @usermanref{Text markup}.",
-              "baseline-skip direction text word-space");
+              "baseline-skip "
+              "text "
+              "word-space "
+              "text-direction "
+              );
 
Index: lilypond/scm/define-grob-properties.scm
diff -u lilypond/scm/define-grob-properties.scm:1.118 
lilypond/scm/define-grob-properties.scm:1.119
--- lilypond/scm/define-grob-properties.scm:1.118       Mon Aug 22 14:03:11 2005
+++ lilypond/scm/define-grob-properties.scm     Thu Aug 25 13:37:00 2005
@@ -461,6 +461,9 @@
 reading this property.")
      (text ,markup? "Text markup.  See @usermanref{Text markup}.")
 ;;FIXME -- Should both be the same?
+     (text-direction ,ly:dir? "This controls the ordering of the
+words. The default RIGHT is for roman text. Arabic or hebrew should
+use LEFT.")
      (thick-thickness ,number? "Bar line thickness, measured in
 @code{linethickness}.")
      (thickness ,number? "Bar line thickness, measured in
Index: lilypond/scm/define-markup-commands.scm
diff -u lilypond/scm/define-markup-commands.scm:1.112 
lilypond/scm/define-markup-commands.scm:1.113
--- lilypond/scm/define-markup-commands.scm:1.112       Thu Aug 25 11:15:35 2005
+++ lilypond/scm/define-markup-commands.scm     Thu Aug 25 13:37:00 2005
@@ -344,6 +344,7 @@
                     (interval-length (ly:stencil-extent stc X))))
               stencils))
         (text-width (apply + text-widths))
+        (text-dir (chain-assoc-get 'text-direction props RIGHT))
         (word-count (length stencils))
         (word-space (chain-assoc-get 'word-space props))
         (line-width (chain-assoc-get 'linewidth props))
@@ -358,12 +359,12 @@
                                        (- line-width text-width)))
                        (else 
                                (get-fill-space word-count line-width 
text-widths))))
-     (fill-space-normal
-       (map (lambda (x)
-               (if (< x word-space)
-                       word-space
-                               x))
-                       fill-space))
+        (fill-space-normal
+         (map (lambda (x)
+                (if (< x word-space)
+                    word-space
+                    x))
+              fill-space))
                                        
         (line-stencils (if (= word-count 1)
                            (list
@@ -372,24 +373,35 @@
                             point-stencil)
                            stencils)))
 
+    (if (= text-dir LEFT)
+       (set! line-stencils (reverse line-stencils)))
+
     (if (null? (remove ly:stencil-empty? orig-stencils))
        empty-stencil
-       (stack-stencils-padding-list X RIGHT fill-space-normal line-stencils))))
+       (stack-stencils-padding-list X
+                                    RIGHT fill-space-normal line-stencils))))
        
 (def-markup-command (line layout props args) (markup-list?)
   "Put @var{args} in a horizontal line.  The property @code{word-space}
 determines the space between each markup in @var{args}."
   (let*
       ((stencils (map (lambda (m) (interpret-markup layout props m)) args))
-       (space    (chain-assoc-get 'word-space props)))
-
-  (stack-stencil-line
-   space
-   (remove ly:stencil-empty? stencils))))
+       (space    (chain-assoc-get 'word-space props))
+       (text-dir (chain-assoc-get 'text-direction props RIGHT)) 
+       )
+
+    
+    (if (= text-dir LEFT)
+       (set! stencils (reverse stencils)))
+    
+
+    (stack-stencil-line
+     space
+     (remove ly:stencil-empty? stencils))))
 
 
 (define (wordwrap-stencils stencils
-                          justify base-space line-width)
+                          justify base-space line-width text-dir)
   
   "Perform simple wordwrap, return stencil of each line."
   
@@ -445,7 +457,9 @@
 
           (line (stack-stencil-line
                  line-word-space
-                 (reverse line-stencils))))
+                 (if (= text-dir RIGHT)
+                     (reverse line-stencils)
+                     line-stencils))))
 
        (if (pair? (cdr line-break))
            (loop (cons line lines)
@@ -462,10 +476,12 @@
       ((baseline-skip (chain-assoc-get 'baseline-skip props))
        (line-width (chain-assoc-get 'linewidth props))
        (word-space (chain-assoc-get 'word-space props))
+       (text-dir (chain-assoc-get 'text-direction props RIGHT)) 
        (lines (wordwrap-stencils
               (remove ly:stencil-empty?
                       (map (lambda (m) (interpret-markup layout props m)) 
args))
-              justify word-space  line-width)
+              justify word-space line-width
+              text-dir)
               ))
 
     (stack-lines DOWN 0.0 baseline-skip lines)))
@@ -490,6 +506,7 @@
        (word-space (chain-assoc-get 'word-space props))
        (para-strings (regexp-split arg "\n[ \t\n]*\n[ \t\n]*"))
        
+       (text-dir (chain-assoc-get 'text-direction props RIGHT)) 
        (list-para-words (map (lambda (str)
                               (regexp-split str "[ \t\n]+"))
                             para-strings))
@@ -502,7 +519,9 @@
                                        (interpret-markup layout props x))
                                      words)))
                               (lines (wordwrap-stencils stencils
-                                                        justify word-space 
line-width)))
+                                                        justify word-space
+                                                        line-width text-dir
+                                                        )))
 
                            lines))
                        


_______________________________________________
Lilypond-cvs mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/lilypond-cvs

Reply via email to