lilypond-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Patch] font-family


From: Han-Wen Nienhuys
Subject: [Patch] font-family
Date: Wed, 14 Aug 2002 17:41:24 +0200

address@hidden writes:
> Hi, all!
> 
> With the attached patch, font-family is automatically set on accidentals,
> key signatures, custodes and rests.  This should take some burden from
> users that want to access symbols from the ancient font (and we do not
> have any more to write documentation on property font-family :-)).
> 
> It also should now be easily possible to define mixtures of font styles
> (as the baroque note head style already does), see scm/output-lib.scm.
> 
> Similar code for clefs and flags is still missing, but will follow.

Before you start adding more code like, let me make a comment. The
general pattern seems to be that you replace

        brew_molecule
        {
                Font * fm = get_default_font ();
                Molecule m = fm->get_glyph_by_name (...);

                         ..

                return m;
        }

by:

        brew_molecule
        {
                SCM some_prop =  me->get_grob_property ("foo");
                SCM answer = scm_eval (ly_symbol ("some-function"),
                                       style, some_prop);

                /*
                use answer to set font-properties.
                */
                Font * fm = get_default_font ();
                /*
                use answer to construct glyphname.
                */
                Molecule m = fm->get_glyph_by_name (...);

                ..

                return m;
        }


I have two problems with this approach:

 * it is very ad-hoc: the signature for every Scheme function is
   different

 * it does not have nice semantics  for overriding it from a file; The
   basic problem is that scm_eval() escapes into the global GUILE name
   space. Also evaluating Scheme code in this way is pretty inefficient. 

If this is happens in a single instance, I could let it go, but now
you're putting this all over the code, in vital parts (eg. note
heads.)  I want to suggest the following approach.


Foo::brew_molecule
{
        return single_glyph_from_font 
}


single_glyph_from_font (Grob *me)
{
        SCM proc = me->get_grob_property("find-font-symbol-procedure");


}

-- 

Han-Wen Nienhuys   |   address@hidden    | http://www.cs.uu.nl/~hanwen/





reply via email to

[Prev in Thread] Current Thread [Next in Thread]