[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: shortened flags: choosing appropriate flag (issue4410049)
From: |
Han-Wen Nienhuys |
Subject: |
Re: shortened flags: choosing appropriate flag (issue4410049) |
Date: |
Mon, 18 Apr 2011 11:23:21 -0300 |
On Mon, Apr 18, 2011 at 11:16 AM, Han-Wen Nienhuys <address@hidden> wrote:
>> }
>> uses (i think) two different design sizes (one for cues, one for normal
>> notes) and yet everything is fine - change from regular flags to
>> shortened flags take place on note d both in cues and normal notes.
>> Also when i compile this and a copy of this file with
>> #(set-global-staff-size 15) the results are correct.
>> Perhaps i'm not understanding something?
>
> 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.
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 ++;
}
Mike promised he would have a look at an alternative implementation of
the C++ by the end of this week.
--
Han-Wen Nienhuys - address@hidden - http://www.xs4all.nl/~hanwen