Re: [Feature Request] Python API Support Curve & Point Selections

Abraham Lee <[email protected]> Tue, 8 May 2018 17:22:49 -0600
Newsgroups gmane.comp.fonts.fontforge.devel
Message-ID <CAHAQwh240ZiY1m5wwhURxPSLiG9d524ow2F-1DkrjNT3ww9z8A@mail.gmail.com>
Hi, Frank!

I feel a bit silly that I didn't notice it before, but I discovered that
there is a command already that handles the undo points, called
preserveLayerAsUndo, which affects the currently active layer (if no
argument is supplied) or you can target a specific layer . So, I've
incorporated that into my scripts at the appropriate lines and it's working
great!

Thanks,
Abraham

On Wed, May 2, 2018 at 1:50 PM, Abraham Lee <[email protected]>
wrote:

> Hi, Frank!
>
> On Wed, May 2, 2018 at 9:56 AM, Frank Trampe <[email protected]>
> wrote:
>
>> What sort of operations might you perform on selected points? Since it's
>> a script, isn't it just as easy to apply the same operation to each point?
>>
>
> Not necessarily. For example, if I want to round a corner, just one, I
> need to be able to select that point and none others. If I want to
> "harmonize" the curvature between two curves, I may only want adjust a
> single point instead of the entire glyph.
>
> This doesn't just apply to points, but also contour segments. For example,
> I have a script that will calculate and display the curvature of a contour.
> That's great, but I don't always need to see the curvature *everywhere*.
> So, if I could select just a portion of a contour (which can be defined as
> a list of points, I could work with that), that would be nice. Not
> critical, but helpful.
>
>
>> And how would you use undo points in a script? If the result is wrong,
>> you can just rerun the modified script, right?
>>
>
> I thought so, too, but it seems to be a bit hit-and-miss. For example, I
> open a font, (optionally, depending on the script) select one or more
> glyphs, and run a script. Often, there is no undo-point back to the
> original, newly opened glyphs. Here's another scenario I experience. Let's
> say I've made 3 edits (so there is an undo history) and then run a script
> (the 4th edit), when I try to undo the script's actions to go back to the
> 3rd, it acts like the script never ran at all and reverts to the 2nd edit
> instead of the 3rd. I doubt it's caused by something I'm intentionally
> doing, but I won't rule that out. If there was a way to add an entry into
> the undo history list right before my script actually does anything, that'd
> be excellent (or better, have one automatically created, but I can work
> with either). So, I always have to create a backup of the glyph's current
> state to some other layer so I can do a clean undo if I need.
>
> Thanks for all your help!
>
> Best,
> Abraham
>

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot

_______________________________________________
fontforge-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/fontforge-devel
http://fontforge.10959.n7.nabble.com/Developer-f3.html