]> git.donarmstrong.com Git - lilypond.git/blob - scm/output-socket.scm
* scm/define-markup-commands.scm (justify-field): add.
[lilypond.git] / scm / output-socket.scm
1
2 (define-module (scm output-socket)
3   #:re-export (quote)
4   )
5
6 (use-modules (guile)
7              (srfi srfi-1)
8              (srfi srfi-13)
9              (lily))
10
11 (define (dummy . rest)
12   "")
13
14 (for-each
15  (lambda (x) 
16    (module-define! (current-module)
17                    x
18                    dummy))
19  
20  (ly:all-stencil-expressions))
21
22
23 (define-public (draw-line thick x1 y1 x2 y2)
24   (format "drawline ~a ~a ~a ~a ~a"
25           thick x1 y2 x2 y2))
26
27
28 (define-public (named-glyph font glyph)
29   (format "glyphshow ~a \"~a\" ~a"
30           (ly:font-glyph-name-to-charcode font glyph)
31           (ly:font-name font)
32           (modified-font-metric-font-scaling font)
33           ))
34
35 (define-public (placebox x y s) 
36   (format "at ~a ~a ~a\n" x y s))
37
38 (define-public (round-filled-box  breapth width depth height blot-diameter)
39   (format "draw_round_box ~a ~a ~a ~a ~a"
40           breapth width depth height blot-diameter
41           ))
42
43 (define (music-cause grob)
44   (let*
45       ((cause (ly:grob-property  grob 'cause)))
46
47     (cond
48      ((ly:music? cause) cause)
49      ((ly:grob? cause) (music-cause cause))
50      (else
51       #f))))
52
53 (define (grob-bbox grob offset)
54   (let*
55       ((x-ext (ly:grob-extent grob grob X))
56        (y-ext (ly:grob-extent grob grob Y))
57        (x (car offset))
58        (y (cdr offset))
59        )
60
61     (list (+ x (car x-ext))
62           (+ y (car y-ext))
63           (+ x (cdr x-ext))
64           (+ y (cdr y-ext)))
65     ))
66
67 (define-public (no-origin)
68   "nocause\n")
69
70 (define-public (grob-cause offset grob)
71   (let*
72       ((cause (music-cause grob)))
73   (if (and cause (integer? (ly:music-property cause 'input-tag)))
74       (apply format
75              (append
76               (list "cause ~a ~a ~a ~a ~a\n" (ly:music-property cause 'input-tag))
77               (grob-bbox grob offset)
78              ))
79       "")))
80
81 (define-public (glyph-string
82          postscript-font-name
83          size cid?
84          x-y-named-glyphs)
85   
86   (format "text \"~a\" ~a ~a " postscript-font-name size
87           (string-join (map (lambda (xyn) (caddr xyn))
88                             x-y-named-glyphs))))