- (timesig . ((font-family . number) (font-relative-size . 0)))
- (timesig-symbol . ((font-family . music) (font-relative-size . 0)))
-
- (mmrest . ((font-family . number) (font-relative-size . 1)))
- (mmrest-symbol . ((font-family . music) (font-relative-size . 0)))
-
- (mark . ((font-family . number) (font-relative-size . 1)))
- (script . ((font-family . roman) (font-relative-size . -1)))
- (large . ((font-family . roman) (font-relative-size . 1)))
- (Large . ((font-series . bold) (font-family . roman)
- (font-relative-size . 2)))
- (dynamic . ((font-family . dynamic) (font-relative-size . 0)))
- ))
- (properties-to-font .
- ,Font_interface::properties_to_font_name)
-
- ;; FIXME: this is a not-so-cool idea to use ALIGN
- ;; RAISE, LOOKUP, since they are not proper elt-properties,
- ;; and might interfere with them.
- (markup-to-properties . ,markup-to-properties)
- (abbreviation-alist
- . ((rows . ((align . 0)))
- (lines . ((align . 1)))
- (roman . ((font-family . roman)))
- (music . ((font-family . music) (lookup . name)))
- (finger . ((font-style . finger)))
- (bold . ((font-series . bold)))
- (upright . ((font-shape . upright)))
- (italic . ((font-shape . italic)))
- (named . ((lookup . name)))
- (super . ((raise . 1) (font-relative-size . -1)))
- (sub . ((raise . -1) (font-relative-size . -1)))
- (text . ((lookup . value)))
- )
- )
-
- )
- )
-
-(define (qualifiers-to-fontnames qualifiers font-descr-alist)
- " reduce the font list by successively applying a font-qualifier."
- (if (null? qualifiers)
- font-descr-alist
-
- (qualifiers-to-fontnames
- (cdr qualifiers)
- (filter-field (caar qualifiers) (cdar qualifiers) font-descr-alist)
- )
- ))
-
-(define (font-qualifies? qualifiers font-desc)
- "does FONT-DESC satisfy QUALIFIERS?"
- (if (null? qualifiers) #t
- (if (eq? (font-field (caar qualifiers) font-desc) (cdar qualifiers))
- (font-qualifies? (cdr qualifiers) font-desc)
- #f
- )
- )
- )
-
-(define (find-first-font qualifiers fonts)
- (if (null? fonts)
- ""
- (if (font-qualifies? qualifiers (caar fonts))
- (cdar fonts)
- (find-first-font qualifiers (cdr fonts))
- )
- ))
-
-
-(define (select-unique-font qualifiers fonts)
- "return a single font from FONTS (or a default, if none found)
-and warn if the selected font is not unique.
-"
- (let* (
- (err (current-error-port))
- )
-
-
- (if (not (= (length fonts) 1))
- (begin
- (display "\ncouldn't find unique font satisfying " err)
- (write qualifiers err)
- (display " found " err)
- (if (null? fonts)
- (display "none" err)
- (write (map cdr fonts) err))
- ))
-
- (if (null? fonts)
- "cmr10"
- (cdar fonts)) ; return the topmost.
-
- ))
-
-
-(define (chain-assoc x alist-list)
- (if (null? alist-list)
- #f
- (let* (
- (handle (assoc x (car alist-list)))
- )
- (if (pair? handle)
- handle
- (chain-assoc x (cdr alist-list))
- )
- )
- )
- )
-
-;; TODO
-;; the C++ version in font-interface.cc is usually used.
-(define (properties-to-font-name fonts properties-alist-list)
- (let* (
- ;; change order to change priorities of qualifiers.
- (q-order '(font-name font-family font-series font-shape font-design-size font-relative-size))
- (rawqualifiers (map (lambda (x) (chain-assoc x properties-alist-list))
- q-order))
- (qualifiers (filter-list pair? rawqualifiers))
- (selected (find-first-font qualifiers fonts))
- (err (current-error-port))
- )