lilypond-devel
[Top][All Lists]
Advanced

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

Re: shortened flags: choosing appropriate flag (issue4410049)


From: Janek Warchoł
Subject: Re: shortened flags: choosing appropriate flag (issue4410049)
Date: Wed, 20 Apr 2011 13:18:23 +0200

Hi,

2011/4/17  <address@hidden>:
> Please add a stemful regtest with several overrides just to make sure
> that this works completely.

Added.

2011/4/18 Han-Wen Nienhuys <address@hidden>:
> You are initializing this list just once, while in principle it can
> have different values for every loaded font.  Even if it may work, it
> is wrong.
>
> As a general rule we try to avoid global variables, since they always
> are or become a pain in the ass.

ok...
I thought i had to cut down computations.

>>> this seems awfully kludgy.  Can't we just export another list of dimension
>>> variables directly in the font?   See gen-emmentaler-script.py and
>>> mf/out/*table*
>>
>> From what i understand gen-emmentaler-scripts.py it extracts some
>> variables, like glyph size, from mf files. That's quite not what we need
>> to do - the information that we need must be specified by font-designer
>> manually and separately from actual flag variables. (these numbers do
>> not appear in flag code mf variables nor can be calculated from them.)
>
> have a look at feta-generic.mf - the dimensions are abitrary and
> designer specified.

Do you mean line 36
  black_notehead_width# := 1.0 staff_space#;
?
I don't see it how it is used in table files later.
May i ask for a small example?

2011/4/18 Han-Wen Nienhuys <address@hidden>
>
> On Mon, Apr 18, 2011 at 11:16 AM, Han-Wen Nienhuys <address@hidden> wrote:
> >
> > You are initializing this list just once, while in principle it can
> > have different values for every loaded font.  Even if it may work, it
> > is wrong.
> >
> > As a general rule we try to avoid global variables, since they always
> > are or become a pain in the ass.
>
> Overall, I dont see why this needs precomputation.

So you say that we should calculate it each time a flag is being
attached to a stem?

> If you give the flags sequential suffixes, eg.
>
>  u3_0
>  u3_1
>  u3_2
>
> then you can do
>
>
> get_flag(Real stemlength) {
>  flagname = .. // "u3"
>  int suffix = 0
>
>  int best = -1;
>  Real best_dist = INFINITY;
>  while (true) {
>    Box b =fm->get_char (flagname + string(suffix))
>    if b.empty() {
>      break;
>    }
>    Real dy = b[Y].length() - stemlength
>    if abs(dy)  < best_dits  {
>      best_dist = abs(dy)
>      best = suffix
>    }
>    suffix ++;
>  }

Looks very straightforward indeed.
If i knew how to add to font a "property" about desired stem length
and how to read it, i think it would be easy to fix this.

thanks,
Janek

PS what about scheme stuff? will it be necessary to rewrite this into
scheme later, so that everything that is done with flags using c++
could be done with scheme? (like in flags-default.ly)



reply via email to

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