Combine selected points into one point

RoboFont Forums Enhancements Combine selected points into one point

This topic contains 17 replies, has 4 voices, and was last updated by  frederik 8 years, 4 months ago.

Viewing 15 posts - 1 through 15 (of 18 total)
  • Author
    Posts
  • #3981

    Sami
    Participant

    I would love to select two or more points and say ‘combine points into one point’. This function would calculate the average center of selected points + calculate average bcps for that one point. Would be handy for cleaning paths, for example after auto-tracing. In the next update maybe?

    #3985

    frederik
    Keymaster

    That would be an excellent extension :)

    #3987

    Bas
    Participant

    It would also be an excellent native function…

    #4109

    charlesmchen
    Participant

    I’ve written an extension that does this.

    https://github.com/charlesmchen/robofont-extensions-and-scripts

    If its not what you had in mind, or if you have any other ideas for extensions, let me know.

    I’m not yet satisfied with how it updates control points adjacent to “merged” points.

    #4114

    frederik
    Keymaster

    He

    cool!

    Move your scripts that have callbacks from the menu to the root folder.
    From there you can import everything inside a RoboFont extension.

    #4116

    charlesmchen
    Participant

    Hmm, I’m not sure I understand.

    You’re saying that any script that corresponds to a menu item needs to be in the root folder (ie. the “script root” in the Extension Builder)?

    #4117

    frederik
    Keymaster

    no, but you will have access to other python scripts and modules if they are on the same level or deeper
    (this isn’t a limitation of RoboFont, this is default python behavior if the module isn’t added to the site packages or sys.path)

    scripting Root
    - test.py                       # test can import testFolder and all sub py files  
    - testFolder                 
    -- __init__.py
    -- otherFile.py                 # otherFile can not import test.py or otherTestFolder
    - otherTestFolder
    -- __init__.py
    

    hope this makes sense

    #4119

    charlesmchen
    Participant

    Ah, I see what you mean.
    Alternately, RoboFont could add the root folder of the extension to the python path when it invokes a script from that extension.
    I’m not sure how you’re invoking extension scripts in Robofont…

    Anyhow, I’ve reorganized the extension per your suggestion.

    Thanks

    #4120

    frederik
    Keymaster

    Alternately, RoboFont could add the root folder of the extension to the python path when it invokes a script from that extension.
    I’m not sure how you’re invoking extension scripts in Robofont…

    mm, I think this will be a mess after a while.
    It’s already super easy to add a path to sys.path :)

    #4137

    charlesmchen
    Participant

    Yes, you’re right.

    #4144

    charlesmchen
    Participant
    #4145

    frederik
    Keymaster

    a progress bar example:

    from defconAppKit.windows.progressWindow import ProgressWindow
    
    # CurrentFontWindow is only available only in RoboFont 1.3
    from mojo.UI import CurrentFontWindow
    
    import time
    
    progress = ProgressWindow("my progress")
    time.sleep(2)
    progress.close()
    
    
    ## attach as sheet to a window
    progress = ProgressWindow("my progress", parentWindow=CurrentFontWindow().window())
    time.sleep(2)
    progress.update("action....")
    time.sleep(2)
    progress.close()
    
    ## with tickcount
    count = 20
    progress = ProgressWindow("my progress", tickCount=count)
    
    for i in range(count):
        time.sleep(.1)
        progress.update("action....%s" %i)
        
    progress.close()
    
    #4147

    charlesmchen
    Participant

    cool, thanks.

    #4148

    charlesmchen
    Participant

    Hmm, that can’t be right.

    for i in range(count):
        time.sleep(.1)
        progress.update("action....%s" %i)
    

    You’re formatting a string with an int but using the string format descriptor: %s
    Also, shouldn’t progress.update() take an int argument?

    Lastly,

    from mojo.UI import CurrentFontWindow
    

    Yields:

    importError: cannot import name CurrentFontWindow

    in RoboFont 1.2

    #4149

    charlesmchen
    Participant

    oho, just saw this:

    # CurrentFontWindow is only available only in RoboFont 1.3

Viewing 15 posts - 1 through 15 (of 18 total)

You must be logged in to reply to this topic.