opening all fonts from a folder

RoboFont Forums Help / General opening all fonts from a folder

This topic contains 6 replies, has 2 voices, and was last updated by  frederik 5 years, 10 months ago.

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #6051

    luke
    Member

    hi frederik,
    is there an easy way to open all fonts from a folder.
    when using this, I would have to open one after another.

    f = OpenFont("/path/file.ufo", showUI=False)
    

    maybe you could help me with this, thank you very much!

    #6052

    frederik
    Keymaster

    you can use something like this

    from lib.tools.misc import walkDirectoryForFile
    
    root = "/my/Fonts/Folder"
    for path in walkDirectoryForFile(root, ".ufo"):
        OpenFont(path)
    
    #6055

    luke
    Member

    thank you very much!

    OpenFont(path, showUI=False)
    

    instead of

    OpenFont(path)
    

    does not seem to work in this case?
    or should that also work?

    #6056

    luke
    Member

    sorry, or maybe it works – lets put it then in other words:
    how is it possible to access/see what is open (without an UI).

    print AllFonts()
    

    does’nt work in this case.

    #6059

    luke
    Member

    Okay, got it. Thanks a lot!

    #6060

    frederik
    Keymaster

    well AllFonts() just return all fonts with an UI. If you open a font without a UI (with showUI=False) your script knows which fonts you opened. You can store them in a list if you like.

    good luck

    #6064

    frederik
    Keymaster

    Thank you Frederik,
    already found a solution – one thing: should observers like “FontDidOpen” or “FontWillOpen” work with OpenFont(path, showUI=False).
    Thanks in Advance.

    Hi Luke
    I’ve split your unrelated question into a different topic see http://doc.robofont.com/forums/topic/split-opening-italic-otfs/

    when you open a font without a UI, your script knows when and where it did/will open, so you don’t need those notifications…

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

You must be logged in to reply to this topic.