+2005-01-22 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * scm/output-gnome.scm:
+ * scm/output-svg.scm:
+ * scm/lily-library.scm (font-name-style): Update font name
+ kludging for fontconfig use.
+
2005-01-20 Erlend Aasland <erlenda@gmail.com>
* scm/define-markup-commands.scm: Document right-align and
(else (error "unknown unit" (ly:unit)))))
;;; font
-(define-public (font-family font)
- (let ((name (ly:font-name font)))
- (if name
- (regexp-substitute/global #f "^GNU-(.*)-[.0-9]*$" name 'pre 1 'post)
- (begin
- ;;(stderr "font-name: ~S\n" (ly:font-name font))
- ;;(stderr "font-file-name: ~S\n" (ly:font-file-name font))
- (ly:font-file-name font)))))
+(define-public (font-name-style font)
+ ;; FIXME: ughr, (ly:font-name) sometimes also has Style appended.
+ (let* ((font-name (ly:font-name font))
+ (full-name (if font-name font-name (ly:font-file-name font)))
+ (name-style (string-split full-name #\-)))
+ ;; FIXME: ughr, barf: feta-alphabet is actually emmentaler
+ (if (string-prefix? "feta-alphabet" full-name)
+ (list "emmentaler"
+ (substring full-name (string-length "feta-alphabet")))
+ (if (not (null? (cdr name-style)))
+ name-style
+ (append name-style '("Regular"))))))
;;;
;;; * font selection: name, size, design size
;;; * font scaling
-;;; * .cff MUST NOT be in fc's fontpath?
+;;;; * .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
(map (lambda (x) (char->utf8-string x)) (string->list string))))
(define (music-font? font)
- (let ((family (font-family font)))
+ (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)))
- (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))
#: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)
- (stderr "FONT:~S\n" font)
- (stderr "FONT:~S\n" (pango-font-name font))
+ (debugf "FONT:~S\n" font)
+ (debugf "FONT:~S\n" (pango-font-name font))
(make <gnome-canvas-text>
#:parent (canvas-root)
;;;; TODO:
;;;; * font selection: name, size, design size
-;;;; * .cff MUST NOT be in fc's fontpath?
+;;;; * .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?
;;;; * inkscape page/pageSet support
;;;; * inkscape SVG-font support
;; FIXME: font can be pango font-name or smob
;; determine size and style properly.
(define (svg-font font)
- (let ((family (if (string? font) font (font-family font)))
+ (let ((name-style (if (string? font) (list font "Regular")
+ (font-name-style 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)
+ (car name-style)
+ (cadr name-style)
size anchor)))
(define (fontify font expr)
(entity 'text expr (cons 'style (svg-font font))))
-(define-public (otf-style-mangling font family)
- ;; Hmm, family is emmentaler20/26?
- (if (string=? (substring family 0 (min (string-length family) 10))
- "emmentaler")
- ;; urg; currently empty
- ;;(substring family 10)
- "20"
- "Regular"))
-
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; stencil outputters
;;;