;;; TODO:
;;;
+;;; * font selection: name, size, design size
+;;; * font scaling
+;;; * .cff MUST NOT be in fc's fontpath?
+
;;; * check: blot+scaling
;;; * Figure out and fix font scaling and character placement
;;; * EC font package: add missing X font directories and AFMs
(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)
- (ops output-scale)
-
- (scaling (* 1.5 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)
#: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)
#:x 0.0 #:y 0.0
#:anchor 'west
#:font pango-font-description
- ;;#:size-points
+ #:size-points 12
#:size-set #t
#:text string))
;;;; http://www.w3.org/TR/SVG12/ -- page, pageSet in draft
;;;; TODO:
+;;;; * font selection: name, size, design size
+;;;; * .cff MUST NOT be in fc's fontpath?
+
;;;; * inkscape page/pageSet support
;;;; * inkscape SVG-font support
;;;; - use fontconfig/fc-cache for now, see output-gnome.scm
(define (font-size font)
(let* ((designsize (ly:font-design-size font))
(magnification (* (ly:font-magnification font)))
- (ops 2)
- (scaling (* ops magnification designsize)))
+ (scaling (* output-scale magnification designsize)))
(debugf "scaling:~S\n" scaling)
(debugf "magnification:~S\n" magnification)
(debugf "design:~S\n" designsize)
(apply string-append
(map (lambda (x) (char->entity x)) (string->list string))))
+;; FIXME: font can be pango font-name or smob
+;; determine size and style properly.
(define (svg-font font)
- (let* ((encoding (ly:font-encoding font))
- (anchor (if (memq encoding '(fetaMusic fetaBraces)) 'start 'start))
- (family (font-family font)))
- (format #f "font-family:~a;font-style:~a;font-size:~a;text-anchor:~S;"
- (otf-name-mangling font family)
- (otf-style-mangling font family)
- (font-size font) anchor)))
+ (let ((family (if (string? font) font (font-family font)))
+ (size (if (string? font) 12 (font-size font)))
+ (anchor "west"))
+ (format #f "font-family:~a;font-style:~a;font-size:~a;text-anchor:~a;"
+ family
+ (otf-style-mangling font family)
+ size anchor)))
(define (fontify font expr)
(entity 'text expr (cons 'style (svg-font font))))
-;; FIXME
-(define-public (otf-name-mangling font family)
- ;; Hmm, family is emmentaler20/26?
- (if (string=? (substring family 0 (min (string-length family) 10))
- "emmentaler")
- "LilyPond"
- (if (string=? family "aybabtu")
- "LilyPondBraces"
- family)))
-
(define-public (otf-style-mangling font family)
;; Hmm, family is emmentaler20/26?
(if (string=? (substring family 0 (min (string-length family) 10))
"emmentaler")
- (substring family 10)
+ ;; urg; currently empty
+ ;;(substring family 10)
+ "20"
"Regular"))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(define (text font string)
(dispatch `(fontify ,font ,(entity 'tspan (string->entities string)))))
+
+(define (utf8-string pango-font-description string)
+ (dispatch `(fontify ,pango-font-description ,(entity 'tspan string))))