2 (define-module (scm output-socket)
12 (define-public (draw-line thick x1 y1 x2 y2)
13 (format "drawline ~a ~a ~a ~a ~a"
16 (define-public (polygon xy-coords blot do-fill)
17 (format "polygon ~a ~a ~a"
19 (if do-fill "True" "False")
21 (map number->string xy-coords))
24 (define-public (named-glyph font glyph)
25 (format "glyphshow ~a \"~a\" ~a \"~a\""
26 (ly:font-glyph-name-to-charcode font glyph)
28 (modified-font-metric-font-scaling font)
32 (define-public (placebox x y s)
33 (if (not (string-null? s))
34 (format "at ~a ~a ~a\n" x y s)
37 (define-public (round-filled-box breapth width depth height blot-diameter)
38 (format "draw_round_box ~a ~a ~a ~a ~a"
39 breapth width depth height blot-diameter
42 (define (event-cause grob)
44 ((cause (ly:grob-property grob 'cause)))
47 ((ly:stream-event? cause) cause)
51 (define (grob-bbox grob offset)
53 ((x-ext (ly:grob-extent grob grob X))
54 (y-ext (ly:grob-extent grob grob Y))
58 (if (interval-empty? x-ext)
59 (set! x-ext '(0 . 0)))
61 (if (interval-empty? y-ext)
62 (set! y-ext '(0 . 0)))
64 (list (+ x (car x-ext))
70 (define-public (no-origin)
73 (define-public (grob-cause offset grob)
75 ((cause (event-cause grob))
76 (tag (if (and cause (integer? (ly:event-property cause 'input-tag)))
77 (ly:event-property cause 'input-tag)
79 (name (cdr (assoc 'name (ly:grob-property grob 'meta))))
83 (append (list "cause ~a \"~a\" ~a ~a ~a ~a\n"
86 (grob-bbox grob offset))
90 (define (escape-string str)
91 (string-regexp-substitute
93 (string-regexp-substitute "\"" "\\\"" str)))
95 (define-public (utf-8-string
99 (format "utf-8 \"~a\" \"~a\""
100 (escape-string descr)
102 ;; don't want unescaped spaces.
103 (escape-string string)
107 (define (bezier-sandwich lst thick)
110 "bezier_sandwich ~a [~a]"
113 (string-join (map (lambda (x) (format "(~a,~a)" (car x) (cdr x)))