OLD | NEW |
1 ;;;; This file is part of LilyPond, the GNU music typesetter. | 1 ;;;; This file is part of LilyPond, the GNU music typesetter. |
2 ;;;; | 2 ;;;; |
3 ;;;; Copyright (C) 2000--2012 Han-Wen Nienhuys <hanwen@xs4all.nl> | 3 ;;;; Copyright (C) 2000--2012 Han-Wen Nienhuys <hanwen@xs4all.nl> |
4 ;;;; Jan Nieuwenhuizen <janneke@gnu.org> | 4 ;;;; Jan Nieuwenhuizen <janneke@gnu.org> |
5 ;;;; | 5 ;;;; |
6 ;;;; LilyPond is free software: you can redistribute it and/or modify | 6 ;;;; LilyPond is free software: you can redistribute it and/or modify |
7 ;;;; it under the terms of the GNU General Public License as published by | 7 ;;;; it under the terms of the GNU General Public License as published by |
8 ;;;; the Free Software Foundation, either version 3 of the License, or | 8 ;;;; the Free Software Foundation, either version 3 of the License, or |
9 ;;;; (at your option) any later version. | 9 ;;;; (at your option) any later version. |
10 ;;;; | 10 ;;;; |
(...skipping 429 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
440 @lilypond[verbatim,quote] | 440 @lilypond[verbatim,quote] |
441 \\markup { | 441 \\markup { |
442 \\with-link #'label { | 442 \\with-link #'label { |
443 \\italic { This links to the page containing the label... } | 443 \\italic { This links to the page containing the label... } |
444 } | 444 } |
445 } | 445 } |
446 @end lilypond" | 446 @end lilypond" |
447 (let* ((arg-stencil (interpret-markup layout props arg)) | 447 (let* ((arg-stencil (interpret-markup layout props arg)) |
448 (x-ext (ly:stencil-extent arg-stencil X)) | 448 (x-ext (ly:stencil-extent arg-stencil X)) |
449 (y-ext (ly:stencil-extent arg-stencil Y))) | 449 (y-ext (ly:stencil-extent arg-stencil Y))) |
450 (ly:make-stencil | 450 (ly:stencil-add |
451 `(delay-stencil-evaluation | 451 (ly:make-stencil |
452 ,(delay (ly:stencil-expr | 452 `(delay-stencil-evaluation |
453 (let* ((table (ly:output-def-lookup layout 'label-page-table)) | 453 ,(delay (let* ((table (ly:output-def-lookup layout 'label-page-table)) |
454 (page-number (if (list? table) | 454 (page-number (if (list? table) |
455 (assoc-get label table) | 455 (assoc-get label table) |
456 #f)) | 456 #f))) |
457 (link-expr (list 'page-link page-number | 457 (list 'page-link page-number |
458 `(quote ,x-ext) `(quote ,y-ext)))) | 458 `(quote ,x-ext) `(quote ,y-ext))))) |
459 (ly:stencil-add (ly:make-stencil link-expr x-ext y-ext) | 459 x-ext y-ext) |
460 arg-stencil))))) | 460 arg-stencil))) |
461 x-ext | |
462 y-ext))) | |
463 | 461 |
464 | 462 |
465 (define-markup-command (beam layout props width slope thickness) | 463 (define-markup-command (beam layout props width slope thickness) |
466 (number? number? number?) | 464 (number? number? number?) |
467 #:category graphic | 465 #:category graphic |
468 " | 466 " |
469 @cindex drawing beams within text | 467 @cindex drawing beams within text |
470 | 468 |
471 Create a beam with the specified parameters. | 469 Create a beam with the specified parameters. |
472 @lilypond[verbatim,quote] | 470 @lilypond[verbatim,quote] |
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
658 \\hspace #2 | 656 \\hspace #2 |
659 \\box { | 657 \\box { |
660 \\pad-markup #1 { | 658 \\pad-markup #1 { |
661 padded | 659 padded |
662 } | 660 } |
663 } | 661 } |
664 } | 662 } |
665 @end lilypond" | 663 @end lilypond" |
666 (let* | 664 (let* |
667 ((stil (interpret-markup layout props arg)) | 665 ((stil (interpret-markup layout props arg)) |
668 (xext (ly:stencil-extent stil X)) | 666 (xext (interval-widen (ly:stencil-extent stil X) amount)) |
669 (yext (ly:stencil-extent stil Y))) | 667 (yext (interval-widen (ly:stencil-extent stil Y) amount))) |
670 | 668 |
671 (ly:make-stencil | 669 (ly:make-stencil |
672 (ly:stencil-expr stil) | 670 (list 'explicit-extent-stencil xext yext (ly:stencil-expr stil)) |
673 (interval-widen xext amount) | 671 xext yext))) |
674 (interval-widen yext amount)))) | |
675 | 672 |
676 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | 673 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
677 ;; space | 674 ;; space |
678 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | 675 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
679 | 676 |
680 (define-markup-command (strut layout props) | 677 (define-markup-command (strut layout props) |
681 () | 678 () |
682 #:category other | 679 #:category other |
683 " | 680 " |
684 @cindex creating vertical spaces in text | 681 @cindex creating vertical spaces in text |
(...skipping 1218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1903 (ly:stencil-aligned-to m X dir))) | 1900 (ly:stencil-aligned-to m X dir))) |
1904 | 1901 |
1905 (define-markup-command (with-dimensions layout props x y arg) | 1902 (define-markup-command (with-dimensions layout props x y arg) |
1906 (number-pair? number-pair? markup?) | 1903 (number-pair? number-pair? markup?) |
1907 #:category other | 1904 #:category other |
1908 " | 1905 " |
1909 @cindex setting extent of text objects | 1906 @cindex setting extent of text objects |
1910 | 1907 |
1911 Set the dimensions of @var{arg} to @var{x} and@tie{}@var{y}." | 1908 Set the dimensions of @var{arg} to @var{x} and@tie{}@var{y}." |
1912 (let* ((m (interpret-markup layout props arg))) | 1909 (let* ((m (interpret-markup layout props arg))) |
1913 (ly:make-stencil (ly:stencil-expr m) x y))) | 1910 (ly:make-stencil |
| 1911 (list 'explicit-extent-stencil x y (ly:stencil-expr m)) |
| 1912 x y))) |
1914 | 1913 |
1915 (define-markup-command (pad-around layout props amount arg) | 1914 (define-markup-command (pad-around layout props amount arg) |
1916 (number? markup?) | 1915 (number? markup?) |
1917 #:category align | 1916 #:category align |
1918 "Add padding @var{amount} all around @var{arg}. | 1917 "Add padding @var{amount} all around @var{arg}. |
1919 | 1918 |
1920 @lilypond[verbatim,quote] | 1919 @lilypond[verbatim,quote] |
1921 \\markup { | 1920 \\markup { |
1922 \\box { | 1921 \\box { |
1923 default | 1922 default |
1924 } | 1923 } |
1925 \\hspace #2 | 1924 \\hspace #2 |
1926 \\box { | 1925 \\box { |
1927 \\pad-around #0.5 { | 1926 \\pad-around #0.5 { |
1928 padded | 1927 padded |
1929 } | 1928 } |
1930 } | 1929 } |
1931 } | 1930 } |
1932 @end lilypond" | 1931 @end lilypond" |
1933 (let* ((m (interpret-markup layout props arg)) | 1932 (let* ((m (interpret-markup layout props arg)) |
1934 (x (ly:stencil-extent m X)) | 1933 (x (interval-widen (ly:stencil-extent m X) amount)) |
1935 (y (ly:stencil-extent m Y))) | 1934 (y (interval-widen (ly:stencil-extent m Y) amount))) |
1936 (ly:make-stencil (ly:stencil-expr m) | 1935 (ly:make-stencil |
1937 (interval-widen x amount) | 1936 (list 'explicit-extent-stencil x y (ly:stencil-expr m)) |
1938 (interval-widen y amount)))) | 1937 x y))) |
1939 | 1938 |
1940 (define-markup-command (pad-x layout props amount arg) | 1939 (define-markup-command (pad-x layout props amount arg) |
1941 (number? markup?) | 1940 (number? markup?) |
1942 #:category align | 1941 #:category align |
1943 " | 1942 " |
1944 @cindex padding text horizontally | 1943 @cindex padding text horizontally |
1945 | 1944 |
1946 Add padding @var{amount} around @var{arg} in the X@tie{}direction. | 1945 Add padding @var{amount} around @var{arg} in the X@tie{}direction. |
1947 | 1946 |
1948 @lilypond[verbatim,quote] | 1947 @lilypond[verbatim,quote] |
1949 \\markup { | 1948 \\markup { |
1950 \\box { | 1949 \\box { |
1951 default | 1950 default |
1952 } | 1951 } |
1953 \\hspace #4 | 1952 \\hspace #4 |
1954 \\box { | 1953 \\box { |
1955 \\pad-x #2 { | 1954 \\pad-x #2 { |
1956 padded | 1955 padded |
1957 } | 1956 } |
1958 } | 1957 } |
1959 } | 1958 } |
1960 @end lilypond" | 1959 @end lilypond" |
1961 (let* ((m (interpret-markup layout props arg)) | 1960 (let* ((m (interpret-markup layout props arg)) |
1962 (x (ly:stencil-extent m X)) | 1961 (x (interval-widen (ly:stencil-extent m X) amount)) |
1963 (y (ly:stencil-extent m Y))) | 1962 (y (ly:stencil-extent m Y))) |
1964 (ly:make-stencil (ly:stencil-expr m) | 1963 (ly:make-stencil |
1965 (interval-widen x amount) | 1964 (list 'explicit-extent-stencil x y (ly:stencil-expr m)) |
1966 y))) | 1965 x y))) |
1967 | 1966 |
1968 (define-markup-command (put-adjacent layout props axis dir arg1 arg2) | 1967 (define-markup-command (put-adjacent layout props axis dir arg1 arg2) |
1969 (integer? ly:dir? markup? markup?) | 1968 (integer? ly:dir? markup? markup?) |
1970 #:category align | 1969 #:category align |
1971 "Put @var{arg2} next to @var{arg1}, without moving @var{arg1}." | 1970 "Put @var{arg2} next to @var{arg1}, without moving @var{arg1}." |
1972 (let ((m1 (interpret-markup layout props arg1)) | 1971 (let ((m1 (interpret-markup layout props arg1)) |
1973 (m2 (interpret-markup layout props arg2))) | 1972 (m2 (interpret-markup layout props arg2))) |
1974 (ly:stencil-combine-at-edge m1 axis dir m2 0.0))) | 1973 (ly:stencil-combine-at-edge m1 axis dir m2 0.0))) |
1975 | 1974 |
1976 (define-markup-command (transparent layout props arg) | 1975 (define-markup-command (transparent layout props arg) |
1977 (markup?) | 1976 (markup?) |
1978 #:category other | 1977 #:category other |
1979 "Make @var{arg} transparent. | 1978 "Make @var{arg} transparent. |
1980 | 1979 |
1981 @lilypond[verbatim,quote] | 1980 @lilypond[verbatim,quote] |
1982 \\markup { | 1981 \\markup { |
1983 \\transparent { | 1982 \\transparent { |
1984 invisible text | 1983 invisible text |
1985 } | 1984 } |
1986 } | 1985 } |
1987 @end lilypond" | 1986 @end lilypond" |
1988 (let* ((m (interpret-markup layout props arg)) | 1987 (let* ((m (interpret-markup layout props arg)) |
1989 (x (ly:stencil-extent m X)) | 1988 (x (ly:stencil-extent m X)) |
1990 (y (ly:stencil-extent m Y))) | 1989 (y (ly:stencil-extent m Y))) |
1991 (ly:make-stencil "" x y))) | 1990 (ly:make-stencil |
| 1991 (list 'explicit-extent-stencil x y "") |
| 1992 x y))) |
1992 | 1993 |
1993 (define-markup-command (pad-to-box layout props x-ext y-ext arg) | 1994 (define-markup-command (pad-to-box layout props x-ext y-ext arg) |
1994 (number-pair? number-pair? markup?) | 1995 (number-pair? number-pair? markup?) |
1995 #:category align | 1996 #:category align |
1996 "Make @var{arg} take at least @var{x-ext}, @var{y-ext} space. | 1997 "Make @var{arg} take at least @var{x-ext}, @var{y-ext} space. |
1997 | 1998 |
1998 @lilypond[verbatim,quote] | 1999 @lilypond[verbatim,quote] |
1999 \\markup { | 2000 \\markup { |
2000 \\box { | 2001 \\box { |
2001 default | 2002 default |
2002 } | 2003 } |
2003 \\hspace #4 | 2004 \\hspace #4 |
2004 \\box { | 2005 \\box { |
2005 \\pad-to-box #'(0 . 10) #'(0 . 3) { | 2006 \\pad-to-box #'(0 . 10) #'(0 . 3) { |
2006 padded | 2007 padded |
2007 } | 2008 } |
2008 } | 2009 } |
2009 } | 2010 } |
2010 @end lilypond" | 2011 @end lilypond" |
2011 (let* ((m (interpret-markup layout props arg)) | 2012 (ly:stencil-add |
2012 (x (ly:stencil-extent m X)) | 2013 (ly:make-stencil |
2013 (y (ly:stencil-extent m Y))) | 2014 (list 'explicit-extent-stencil x-ext y-ext "") |
2014 (ly:make-stencil (ly:stencil-expr m) | 2015 x-ext y-ext) |
2015 (interval-union x-ext x) | 2016 (interpret-markup layout props arg))) |
2016 (interval-union y-ext y)))) | |
2017 | 2017 |
2018 (define-markup-command (hcenter-in layout props length arg) | 2018 (define-markup-command (hcenter-in layout props length arg) |
2019 (number? markup?) | 2019 (number? markup?) |
2020 #:category align | 2020 #:category align |
2021 "Center @var{arg} horizontally within a box of extending | 2021 "Center @var{arg} horizontally within a box of extending |
2022 @var{length}/2 to the left and right. | 2022 @var{length}/2 to the left and right. |
2023 | 2023 |
2024 @lilypond[quote,verbatim] | 2024 @lilypond[quote,verbatim] |
2025 \\new StaffGroup << | 2025 \\new StaffGroup << |
2026 \\new Staff { | 2026 \\new Staff { |
(...skipping 2044 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4071 @cindex referencing page numbers in text | 4071 @cindex referencing page numbers in text |
4072 | 4072 |
4073 Reference to a page number. @var{label} is the label set on the referenced | 4073 Reference to a page number. @var{label} is the label set on the referenced |
4074 page (using the @code{\\label} command), @var{gauge} a markup used to estimate | 4074 page (using the @code{\\label} command), @var{gauge} a markup used to estimate |
4075 the maximum width of the page number, and @var{default} the value to display | 4075 the maximum width of the page number, and @var{default} the value to display |
4076 when @var{label} is not found." | 4076 when @var{label} is not found." |
4077 (let* ((gauge-stencil (interpret-markup layout props gauge)) | 4077 (let* ((gauge-stencil (interpret-markup layout props gauge)) |
4078 (x-ext (ly:stencil-extent gauge-stencil X)) | 4078 (x-ext (ly:stencil-extent gauge-stencil X)) |
4079 (y-ext (ly:stencil-extent gauge-stencil Y))) | 4079 (y-ext (ly:stencil-extent gauge-stencil Y))) |
4080 (ly:make-stencil | 4080 (ly:make-stencil |
4081 `(delay-stencil-evaluation | 4081 (list |
4082 ,(delay (ly:stencil-expr | 4082 'explicit-extent-stencil |
4083 (let* ((table (ly:output-def-lookup layout 'label-page-table)) | 4083 x-ext |
4084 (page-number (if (list? table) | 4084 y-ext |
4085 (assoc-get label table) | 4085 `(delay-stencil-evaluation |
4086 #f)) | 4086 ,(delay (ly:stencil-expr |
4087 (page-markup (if page-number (format #f "~a" page-number)
default)) | 4087 (let* ((table (ly:output-def-lookup layout 'label-page-table)) |
4088 (page-stencil (interpret-markup layout props page-markup)
) | 4088 (page-number (if (list? table) |
4089 (gap (- (interval-length x-ext) | 4089 (assoc-get label table) |
4090 (interval-length (ly:stencil-extent page-stencil
X))))) | 4090 #f)) |
4091 (interpret-markup layout props | 4091 (page-markup (if page-number (format #f "~a" page-number
) default)) |
4092 (markup #:hspace gap page-markup)))))) | 4092 (page-stencil (interpret-markup layout props page-markup
)) |
| 4093 (gap (- (interval-length x-ext) |
| 4094 (interval-length (ly:stencil-extent page-stencil
X))))) |
| 4095 (interpret-markup layout props |
| 4096 (markup #:hspace gap page-markup))))))) |
4093 x-ext | 4097 x-ext |
4094 y-ext))) | 4098 y-ext))) |
4095 | 4099 |
4096 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | 4100 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
4097 ;; scaling | 4101 ;; scaling |
4098 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | 4102 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
4099 | 4103 |
4100 (define-markup-command (scale layout props factor-pair arg) | 4104 (define-markup-command (scale layout props factor-pair arg) |
4101 (number-pair? markup?) | 4105 (number-pair? markup?) |
4102 #:category graphic | 4106 #:category graphic |
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4316 (throw key | 4320 (throw key |
4317 (interpret-markup-list | 4321 (interpret-markup-list |
4318 layout props args))) | 4322 layout props args))) |
4319 (make-null-markup)))))) | 4323 (make-null-markup)))))) |
4320 (lambda (key stencils) | 4324 (lambda (key stencils) |
4321 (map | 4325 (map |
4322 (lambda (sten) | 4326 (lambda (sten) |
4323 (interpret-markup layout props | 4327 (interpret-markup layout props |
4324 (compose (make-stencil-markup sten)))) | 4328 (compose (make-stencil-markup sten)))) |
4325 stencils))))) | 4329 stencils))))) |
OLD | NEW |