fontforge/fontforge — pull request #125 by mskala (2012-09-24 17:08:09+00:00)
Title: Allow native scripting AddExtrema() to take an optional "all" argument

This adds and documents an optional flag to AddExtrema() in the native scripting language; if specified and nonzero, the flag causes *all* extrema to be added, instead of only the "good" ones that would be added by default. I need this, or some other way of getting at the same functionality, for Tsukurimashou: without an option to add *all* extrema, the resulting fonts generally won't pass fontlint. It should not break existing scripts because pre-patch FontForge forbade AddExtrema() to take any argument, and the behaviour of calls without an argument remains the same.

The equivalent Python function (apparently - I can't actually run it on my installation) already takes an optional string flag argument to enable this or a couple of other modes, as well as another argument to override em size (but exactly what that means in this context isn't clear). The equivalent GUI command apparently adds all extrema when invoked from the glyph view with some points selected, or "only good" extrema when invoked from the font view or from the glyph view with no points selected. (That fact could be more clearly documented.) I'm using an optional integer argument, and zero or nonzero to trigger it, for consistency with existing native-scripting functions that take optional integer arguments to express a boolean "force" option, such as Reencode(). It's not clear to me that the other optional features currently allowed by the Python function work at all, nor how they work; but it wouldn't be difficult to also allow AddExtrema() in native scripts to take arguments that would be valid for the Python function, if such a thing were known to be useful. I'd prefer to leave that for someone to request if they have a use for it; I myself don't.