Check if SplineChar defines a fg layer before trying to iterate its refs

Fixes segfault due to invalid access of sc2->layers[] in FVApplySubstitution().
Unknown function/script-file should be reported in the context of the caller.

This results in a more useful error message containing the filename
and line number at which the attempted call was made.
Added SelectGlyphsSplines and SelectGlyphsReferences scripting functions
Added ChangeWeight scripting function.
Allow bItalic() to take a second argument for the xheight percentage.
If script filename doesn't exist, look instead for one ending in .ff
or .pe