;;;;
;;;; source file of the GNU LilyPond music typesetter
;;;;
-;;;; (c) 2004 Jan Nieuwenhuizen <janneke@gnu.org>
+;;;; (c) 2004--2005 Jan Nieuwenhuizen <janneke@gnu.org>
;;; TODO:
;;;
+;;; * font selection: name, size, design size
+;;; * font scaling
+;;;; * .cff MUST NOT be in fc's fontpath.
+;;;; - workaround: remove mf/out from ~/.fonts.conf,
+;;;; instead add ~/.fonts and symlink all /mf/out/*otf there.
+;;;; - bug in fontconfig/freetype/pango?
+
;;; * check: blot+scaling
;;; * Figure out and fix font scaling and character placement
;;; * EC font package: add missing X font directories and AFMs
(list (+ #xe0 x)
(+ #x80 (quotient y #x40))
(+ #x80 (modulo y #x40))))))
- (else (begin (stderr "programming-error: utf-8 too big:~x\n" i)
+ (else (begin (stderr "programming-error: utf8 too big:~x\n" i)
(list (integer->char 32))))))
(define (integer->utf8-string integer)
(map (lambda (x) (char->utf8-string x)) (string->list string))))
(define (music-font? font)
- (let ((encoding (ly:font-encoding font))
- (family (font-family font)))
- (or (memq encoding '(fetaMusic fetaBraces))
- (string=? (substring family 0 (min (string-length family) 10))
- "emmentaler"))))
-
-;; FIXME
-(define-public (otf-name-mangling font family)
- ;; Hmm, family is emmentaler20/26?
- (if (string=? (substring family 0 (min (string-length family) 10))
- "emmentaler")
- (string-append "LilyPond " (substring family 10))
- (if (string=? family "aybabtu")
- "LilyPondBraces"
- family)))
+ (let ((family (car (font-name-style font))))
+ (string=? (substring family 0 (min (string-length family) 10))
+ "emmentaler")))
(define (pango-font-name font)
(debugf "FONT-NAME:~S:~S\n" (ly:font-name font) (ly:font-design-size font))
- (debugf "FONT-FAMILY:~S:~S\n" (font-family font) (otf-name-mangling font (font-family font)))
- (otf-name-mangling font (font-family font)))
+ (apply format (append '(#f "~a, ~a") (font-name-style font))))
(define (pango-font-size font)
(let* ((designsize (ly:font-design-size font))
(magnification (* (ly:font-magnification font)))
-
- ;;font-name: "GNU-LilyPond-feta-20"
- ;;font-file-name: "feta20"
- ;;pango-font-name: "lilypond-feta, regular 32"
- ;;OPS:2.61
- ;;scaling:29.7046771653543
- ;;magnification:0.569055118110236
- ;;design:20.0
-
- ;; ugh, experimental sizing
- ;; where does factor ops come from?
- ;; Hmm, design size: 26/20
- (ops 2.60)
-
- (scaling (* ops magnification designsize)))
- (debugf "OPS:~S\n" ops)
+ ;; FIXME
+ ;;(scaling (* output-scale magnification designsize)))
+ (scaling (* 1.4 output-scale magnification designsize)))
+ ;;(debugf "OPS:~S\n" ops)
(debugf "scaling:~S\n" scaling)
(debugf "magnification:~S\n" magnification)
(debugf "design:~S\n" designsize)
#:parent (canvas-root)
#:x 0.0 #:y 0.0
#:anchor 'west
- ;;#:font postscript-font-name
#:font (pango-font-name font)
#:size-points 12
#:size-set #t
#:join-style 'round)))
(define (text font s)
+ (debugf "FONT:~S\n" font)
+ (debugf "FONT:~S\n" (pango-font-name font))
(make <gnome-canvas-text>
#:parent (canvas-root)
#:x 0.0 #:y (if (music-font? font) 0.15 0.69)
#:anchor (if (music-font? font) 'west 'south-west)
#:font (pango-font-name font)
+ ;; FIXME: points
#:size-points (pango-font-size font)
+ ;; or pixels?
+;; #:size (inexact->exact (round (pango-font-size font)))
#:size-set #t
#:text (if (integer? s)
(integer->utf8-string s)
(string->utf8-string s))))
+(define (utf8-string pango-font-description string)
+ (make <gnome-canvas-text>
+ #:parent (canvas-root)
+ #:x 0.0 #:y 0.0
+ #:anchor 'west
+ #:font pango-font-description
+ #:size-points 12
+ #:size-set #t
+ #:text string))