Navigation

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Users
    • Solved
    • Unsolved
    1. Home
    2. Tags
    3. scripting
    Log in to post

    • ryan

      Some commands leave behind "ghost selection"
      Problems & Bugs • scripting contours glyph editor selection • • ryan  

      3
      0
      Votes
      3
      Posts
      13
      Views

      frederik

      noted down for future RF version to auto deselect on removeContour :) thanks!
    • tallpauley

      UNSOLVED Command Palette
      Extensions • scripting shortcut • • tallpauley  

      4
      1
      Votes
      4
      Posts
      32
      Views

      tallpauley

      @tallpauley Thanks for the update to run the command! This gives me something to play around with. To take it a step further, is there a lib API I can use to also pull in space center and glyph view shortcuts, like whatever they use to populate their "Hot Keys" tabs? (Btw, I won't filter out commands that don't have shortcut keys, this is part of the allure of having a command palette, you can access commands that don't have shortcuts keys defined yet). I saw mojo.UI.setGlyphViewDisplaySettings, but this isn't all the available commands for glyph view. For space center I didn't see any API in mojo.UI I would dig around myself, but I think you guys compile to .pyc and I don't want to violate the EULA by reverse engineering (hence me actually clicking on the EULA lol). Once I have all the commands available, I think I should have what I need.
    • flo

      SOLVED Mass-import ligatures/svgs
      General Questions • scripting pens svg • • flo  

      8
      0
      Votes
      8
      Posts
      60
      Views

      kylelynah

      @gferreira I was able to get it to work once I downloaded additional module files. thanks!
    • horashann

      SOLVED How to copy anchors from one font to another
      Extensions • scripting anchors • • horashann  

      2
      0
      Votes
      2
      Posts
      30
      Views

      gferreira

      hello @horashann, yes, this can be done with a simple script: # get source and destination fonts srcFont = AllFonts().getFontsByFamilyName('MyFontFamily').getFontsByStyleName('Regular')[0] dstFont = AllFonts().getFontsByFamilyName('MyFontFamily').getFontsByStyleName('Italic')[0] # iterate over selected glyphs in the source font for glyphName in srcFont.selectedGlyphNames: # get the source glyph srcGlyph = srcFont[glyphName] # if the glyph doesn't have any anchors, skip it if not len(srcGlyph.anchors): continue # get the destination glyph dstGlyph = dstFont[glyphName] # iterate over all anchors in the source glyph for anchor in srcGlyph.anchors: # copy anchor to destination glyph dstGlyph.appendAnchor(anchor.name, (anchor.x, anchor.y)) # done! make sure to replace MyFontFamily and Regular / Italic with the family name and style names of your fonts. cheers!
    • jansindl3r

      UNSOLVED How to share living instance?
      Extensions • scripting modules • • jansindl3r  

      4
      0
      Votes
      4
      Posts
      21
      Views

      frederik

      Dont get it why Gustavo's answer does not work... You initiate only once an instance from that class and import it back into other modules. A fourth easy solution is to add a variable to NSApp() import AppKit app = AppKit.NSApp() app._my_extenstion_name_controller = "foo" this will be accessible everywhere, but this is actually the same as Gustavo's answers, just stored somewhere else :)
    • ryan

      SOLVED Recover programmatically wiped Input Samples?
      General Questions • scripting space center preferences • • ryan  

      3
      0
      Votes
      3
      Posts
      30
      Views

      ryan

      Lifesaver! Thanks @frederik
    • RafaŁ Buchner

      UNSOLVED How to get programmatically highlighted glyph in the space center
      General Questions • scripting space center • • RafaŁ Buchner  

      4
      0
      Votes
      4
      Posts
      48
      Views

      frederik

      maybe you have to explain what you want to achieve... A space center object has getRaw which returns the input text as seen in the control and get which returns a list of glyph names, those are parsed from the input controls.
    • jansindl3r

      SOLVED unexpected behaviour when copying glyph in Python
      Problems & Bugs • scripting fontparts pens • • jansindl3r  

      4
      0
      Votes
      4
      Posts
      28
      Views

      jansindl3r

      @gferreira I see, thanks!!!
    • nina

      UNSOLVED Contextual menu — enable/disable entries?
      General Questions • scripting user interface font overview • • nina  

      4
      1
      Votes
      4
      Posts
      57
      Views

      frederik

      oh, idd not working as it should be... will be fixed in next beta/release thanks
    • frankrolf

      SOLVED Adjust preferences based on UFO document?
      Feature Requests • scripting preferences • • frankrolf  

      2
      0
      Votes
      2
      Posts
      25
      Views

      frederik

      the /data folder seems like a good place you can subscribe to fontBecameCurrent and execute the .py file with from lib.scripting.scriptTools import ScriptRunner ScriptRunner("path/To/script.py)
    • ryan

      SOLVED Folder support in Start-up Scripts tab in Preferences
      Feature Requests • scripting preferences • • ryan  

      5
      1
      Votes
      5
      Posts
      75
      Views

      gferreira

      support for folders in the list of start-up scripts is now available in the 3.4 beta — thanks! also added to the docs
    • bahman

      SOLVED Keep reference to an arbitrary vanilla window for later use
      Problems & Bugs • scripting vanilla • • bahman  

      5
      1
      Votes
      5
      Posts
      38
      Views

      okaytype

      Well that doesn't surprise me since I have no idea what I'm doing. I'll read up on notifications. It would be helpful to know why this is bad though.
    • nowell

      SOLVED Glyph.newLayer() no longer working in RF3.3?
      General Questions • scripting layers • • nowell  

      4
      0
      Votes
      4
      Posts
      59
      Views

      frederik

      he Nowell, Could you explain why glyph.newLayer(..) is not working for you? see the fontParts documentation. Is there a traceback? This should work... In RoboFont each glyph has his own undo manager and its always possible to add an other glyph undo item to a different undo manager, but requires some deep hacking. I dont think the solution is there... This behaviour was indeed different in RF1 as layers where stored in the glyph.lib, this was a tiny hack on the UFO specification. UFO3 has own implementation of layers. From a UX perspective this is not a good plan to have undos on different data (glyphs) sets at once. Hope this makes sense...
    • nowell

      SOLVED Only PNG images can be added by a script?
      General Questions • scripting fontparts images • • nowell  

      8
      0
      Votes
      8
      Posts
      315
      Views

      Kalisspera

      If you need to work with JPG images, you could consider converting them to PNG format before adding them through the script. And hey, if you ever need to optimize those JPG files for better performance or smaller sizes, check out jpg compress tools. They can help maintain image quality while reducing file sizes effectively.
    • ArrowType

      UNSOLVED Possible bug in lib.fontObjects.fontPartsWrappers UIdocument()? Works in v3.2, but not latest v3.3 beta.
      General Questions • scripting fontparts • • ArrowType  

      2
      0
      Votes
      2
      Posts
      64
      Views

      frederik

      This should be solved in the upcoming release, and already works fine in the cutting-edge-nightly-build version...
    • ArrowType

      SOLVED How can I reload a Python module on the *first* attempt?
      General Questions • scripting modules • • ArrowType  

      3
      0
      Votes
      3
      Posts
      76
      Views

      ArrowType

      Ahhh, that makes sense now. That’s a good tip about __init.py__ as well. Thank you so much for your help, Gustavo!
    • bahman

      UNSOLVED Decorating the RF objects!
      General Questions • scripting fontparts • • bahman  

      5
      1
      Votes
      5
      Posts
      180
      Views

      bahman

      @frederik Yeah that is very powerful. I have another related question. let's say I want my custom method to be executed every time an object changes. I don't want to add a defcon notification but rather override a method and use the super on an internal method of glyph object, then execute my own method. I looked at defcon but it seemed that it's only possible by overriding _set_dirty, but not sure if that's the right way. What do you think?
    • mr

      SOLVED Making a font the front window
      General Questions • scripting user interface font window • • mr  

      2
      0
      Votes
      2
      Posts
      217
      Views

      gferreira

      hello @mr, this seems to work: from mojo.UI import AllFontWindows f = AllFonts().getFontsByStyleName('Italic')[0] for fontWindow in AllFontWindows(): if fontWindow._font == f.naked(): fontWindow.window().show() cheers!
    • erik

      SOLVED Can I get to the SpaceCenter InputText strings from Python?
      General Questions • scripting space center preferences input text • • erik  

      3
      1
      Votes
      3
      Posts
      275
      Views

      okaytype

      I didn't know about spaceCenterInputSamples and managed to get at them through the space center window itself. I should probably look at updating these: https://gist.github.com/okay-type/6e36bfd93e938f5f98253ab31a27f24e https://gist.github.com/okay-type/85e6f60fc35092d5a6249ee26b2bdd4c
    • erik

      SOLVED Set background image “lock” by script?
      General Questions • scripting images glyph lib • • erik  

      3
      0
      Votes
      3
      Posts
      173
      Views

      erik

      Hi Gustavo, thank you! Ok, that explains it. I assumed the lock was for each glyph separately.