On Wed, 2004-08-18 at 16:28, Han-Wen Nienhuys wrote:

> Carl, can you select fonts by tacking any properties you need (and
> only those) onto the props variable passed via the markup system? It
> will make sure you select text fonts in the appropriate encoding. 

I'm not sure exactly how to do this. In my code I call fontify-text,
which needs a font as an argument. The code I use to select the font is
listed below:

(ly:paper-get-font paper `(((font-family . sans)
                                           (font-encoding .
,ss-font-encoding)
                                           (font-series . medium)
                                           (font-shape . upright)
                                           (font-size . ,(stepmag 
string-label-font-mag)))))

 If I try to just list the characteristics I want (e.g. (font-family .
sans)) then I get the default courier font.  The only way I've found to
get the sans-serif font I'd really like is to include all the
information possible for a font specification.

It doesn't seem like I can use props as an argument to
ly:paper-get-font, because there are other properties (e.g. diagram
size, dot-color, etc.)

Should I use chain-assoc-get to get any font-related properties from
props, with default values like I'm currently using?  Something like the
following?  It seems that code like this would give everything I need,
but respect the settings in props.

(let* ((my-font-family (chain-assoc-get 'font-family props 'sans))
      (my-font-encoding (chain-assoc-get 'font-encoding props 'ec))
      (my-font-series (chain-assoc-get 'font-series props 'medium))
      (my-font-shape (chain-assoc-get 'font-shape props 'upright))
      (my-font-size (chain-assoc-get 'font-size props (stepmag
string-label-font-mag)))
      (selected-font (ly:paper-get-font paper 
            `(((font-family . ,my-font-family)
               (font-encoding . ,my-font-encoding)
               (font-series . ,my-font-series)
               (font-shape . ,my-font-shape)
               (font-size . ,my-font-size)))))
      (fontify-text selected-font "abcde"))
                        

If there's some other fundamental approach I should take, give me an
idea of where there's an example, and I'll figure it out.

Thanks,

Carl





_______________________________________________
lilypond-devel mailing list
[EMAIL PROTECTED]
http://lists.gnu.org/mailman/listinfo/lilypond-devel

Reply via email to