-(define (font-command font)
- (string-append
- "magfont"
- (string-encode-integer
- (hashq (ly:font-name font) 1000000))
- "m"
- (string-encode-integer
- (inexact->exact (round (* 1000 (ly:font-magnification font)))))))
-
-(define (define-fonts paper font-list)
- (define (define-font command fontname scaling)
- (string-append
- "/" command " { /" fontname " findfont "
- ;; FIXME
- (ly:number->string scaling) " output-scale div scalefont } bind def\n"))
- ;;(ly:number->string scaling) " scalefont } bind def\n"))
-
- (define (reencode-font raw encoding command)
- (string-append
- raw " " encoding " /" command " reencode-font\n"
- "/" command "{ /" command " findfont 1 scalefont } bind def\n"))
-
- ;; frobnicate NAME to jibe with external definitions.
- (define (possibly-mangle-fontname fontname)
- (cond
- ((tex-font? fontname)
- ;; FIXME: we need proper Fontmap for CM fonts, like so:
- ;; /CMR10 (cmr10.pfb);
- ;; (string-upcase fontname)
- (string-append fontname ".pfb"))
- ((or (equal? (substring fontname 0 4) "feta")
- (equal? (substring fontname 0 4) "parm"))
- (regexp-substitute/global
- #f "(feta|parmesan)([a-z-]*)([0-9]+)"
- fontname 'pre "GNU-LilyPond-" 1 2 "-" 3 'post))
- (else fontname)))
-
- (define (font-load-command paper font)
- (let* ((command (font-command font))
- (fontname (ly:font-name font))
- (mangled (possibly-mangle-fontname fontname))
- (encoding (assoc-get fontname font-encoding-alist))
- (designsize (ly:font-design-size font))
- (magnification (* (ly:font-magnification font)))
- (ops (ly:paper-lookup paper 'outputscale))
- (scaling (* ops magnification designsize)) )
-
- (if
- #f
- (begin
- (newline)
- (format (current-error-port) "fontname ~S\n" fontname)
- (format (current-error-port) "command ~S\n" command)
- (format (current-error-port) "mangled ~S\n" mangled)
- (format (current-error-port) "designsize ~S\n" designsize)
- (format (current-error-port) "foo-design ~S\n" foo-design)
- (format (current-error-port) "magnification ~S\n" magnification)
- (format (current-error-port) "ops ~S\n" ops)
- (format (current-error-port) "scaling ~S\n" scaling)))
-
- (if encoding
- ;; FIXME: should rather tag encoded font
- (let ((raw (string-append command "-raw")))
- (string-append
- (define-font raw mangled scaling)
- (reencode-font raw encoding command)))
- (define-font command mangled scaling))))
-
- (apply string-append
- (map (lambda (x) (font-load-command paper x)) font-list)))
-
-(define (define-origin file line col) "")
-