Resources

RoboFont Forums Bugs Resources

This topic contains 4 replies, has 2 voices, and was last updated by  Jack Jennings 7 years, 7 months ago.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #5475

    Jack Jennings
    Participant

    Not really a bug, but how come the “Resources” folder when you generate an extension is capitalized?

    On another note, what is the intended purpose of this folder?

    #5477

    frederik
    Keymaster

    If you look into any app bundle folder names are capitalized

    The Resources folder is used for assets like image, everything except .py files.

    This is handy in combination with an ExtensionBundle object

    from mojo.extensions import ExtensionBundle
    
    myBundle = ExtensionBundle("MyBundleName")
    
    # assuming in the Resource folder there is a file called "myToolbarIcon.png"
    # when retrieving files from a bundle an extension is not required
    # this will return a NSImage object
    toolbarIcon = myBundle.get("myToolbarIcon")
    
    

    see:
    * http://doc.robofont.com/extensions/building-extensions/
    * http://doc.robofont.com/api/mojo/mojo-extensions/

    #5493

    Jack Jennings
    Participant

    That’s good to know about referencing images in a bundle. Is it also possible to reference the resources that are built in to RoboFont (like extensionIcon.png)?

    #5495

    frederik
    Keymaster

    the ExtensionBundle us written similarly as NSImage.imageNamed_

    from AppKit import *
    
    print NSImage.imageNamed_("ExtensionIcon")
    
    #5499

    Jack Jennings
    Participant

    Perfect!

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.