On Monday 27 Dec 2004 11:27, William wrote: > I was relying on what I thought was a guarantee of NOTE_TYPE always being > set, namely that [something complicated]. Have I missed some logic? I don't know for sure without going to look at the code, and that's why you shouldn't do it. Remember you're writing to us as well as the compiler. Even if this test is in fact safe, the fact that it doesn't _look_ safe means that it could waste time by distracting anyone trying to locate mysterious crashes elsewhere later. Especially since that previous conditional does include the extra existence test, which makes it appear necessary. Defensive coding (which is all we want to do before 1.0) indicates that you should always do the extra test in a situation like that. If we were in a more aggressive development phase and it turned out that these tests were unnecessary, it might make more sense to rip out all of them and add a comment saying why you think the property's existence is guaranteed at this point. (Ideally this sort of thing would be done through some more rigorous pre and post condition tests of course.) But we're not. Moving on: The WHOLE REST ON STAFF (etc) Unicode/non-Unicode naming would be fine by me. > > That does make for a potential incompatibility in the font .xml files, > > How so? Because WHOLE REST used to refer to a whole rest without leger lines, and now it refers (or will refer) to a whole rest with leger lines. So a new RG using old font .xml files will get the wrong character for that, and will also potentially have trouble with the fact that it asks for WHOLE REST ON STAFF that didn't exist in old .xml files. (That's why we should have a fallback to the WHOLE REST version for when that character is not found.) At the moment the font .xml files are all distributed with RG so this isn't likely to be a practical problem, but in principle people could have their own. For all I know, maybe some people already do. > Is there any graceful fall-back at the moment for any > glyphs (not just MUSICAL SYMBOL WHOLE REST and MUSICAL SYMBOL HALF REST) > that are unavailable? Only in certain particular cases where it's thought likely that some fonts might not provide both characters -- as is also potentially the case here. For example, there are loads of fallback cases in NotePixmapFactory::makeTimeSigPixmap to cope with fonts that may or may not include special time signature digits, and in drawFlags to cope with fonts that have combining flags instead of separate glyphs for multiple flag sets. I would suggest that any logic for handling this sort of fallback goes at the highest possible level (i.e. NotePixmapFactory), to avoid special cases in NoteCharName/NoteFont where possible. Use the getCharacter method that returns a bool, and if it returns false, try the character with the opposite value of in/out of staff and use that instead. The general principle is that it's better to render _something_ than to fail completely. Chris |