Navigation

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Users
    • Solved
    • Unsolved
    1. Home
    2. Recent
    Log in to post
    • All categories
    • Announcements
    • General Questions
    • Feature Requests
    • Problems & Bugs
    • Extensions
    • Documentation
    • Tools Corner
    • All Topics
    • New Topics
    • Watched Topics
    • Unreplied Topics

    • RachaelMiller

      SOLVED WASD instead of arrow keys?
      General Questions • • RachaelMiller  

      9
      0
      Votes
      9
      Posts
      28
      Views

      connor

      I updated it based on @frederik's comments and added a few objects: from vanilla import FloatingWindow from mojo.events import addObserver, extractNSEvent class WASDTool: def __init__(self): addObserver(self, "keyWasPressed", "keyDown") def keyWasPressed(self, info): glyph = info["glyph"] if glyph: event = info["event"] characters = event.characters() shiftDown = extractNSEvent(info)['shiftDown'] commandDown = extractNSEvent(info)['commandDown'] x = 1 if shiftDown: x = 5 if commandDown: x = 100 KEYMAPPING = { "w":(0,x), "a":(-x,0), "s":(0,-x), "d":(x,0), } objects = [] objects.extend(glyph.selectedBPoints) objects.extend([p for p in glyph.selectedPoints if p.type == "offcurve"]) objects.extend(glyph.selectedComponents) objects.extend(glyph.selectedAnchors) if objects != []: # convert to lowercase so we dont have to use a huge dict if characters.lower() in KEYMAPPING.keys(): move = KEYMAPPING[characters.lower()] if move: glyph.prepareUndo("movePoints") for obj in objects: obj.moveBy(move) glyph.changed() glyph.performUndo() WASDTool()
    • nowell

      Observer for active document change?
      General Questions • • nowell  

      3
      0
      Votes
      3
      Posts
      20
      Views

      nowell

      Thank you so much, @okaytype! fontBecameCurrent is exactly what I was looking for. I’m familiar with sorting AllFonts() but was hoping to have my list ordered according to the window stack. @frederik, could you add fontBecameCurrent to the RoboFont Observers doc? It seems to be missing.
    • HB888

      SOLVED Generated font does not want to centre in PPT
      General Questions • • HB888  

      3
      0
      Votes
      3
      Posts
      19
      Views

      HB888

      @frederik no, I was able to resolve that by following your kerning instructions. This is just a general issue when testing on some PPT files where if you choose the centre align tool, the font stays left aligned.
    • StephenNixon

      SOLVED Copy glyph from default layer to another
      General Questions • scripting layers • • StephenNixon  

      6
      0
      Votes
      6
      Posts
      733
      Views

      ArrowType

      I’ve adjusted this to go through the currently-selection glyphs only, and to clear the non-foreground layer before copying to it. from mojo.UI import AskString f = CurrentFont() newLayer = AskString('Layer to copy all existing glyphs to, e.g. "overlap"') for glyphName in f.selection: glyph = f[glyphName] glyph.getLayer(newLayer).clear() # if you wish to clear the non-foreground layer glyph.layers[0].copyLayerToLayer("foreground", newLayer) glyph.getLayer(newLayer).leftMargin = glyph.layers[0].leftMargin glyph.getLayer(newLayer).rightMargin = glyph.layers[0].rightMargin
    • connor

      SOLVED Hide Specific Points
      General Questions • • connor  

      4
      1
      Votes
      4
      Posts
      23
      Views

      frederik

      I would hide the other points while a surgeon point is placed. Unhide when the operation is cancelled or when a surgeon point gets promoted to a real point.
    • ryan

      SOLVED Easy way to replicate Scripts menu bar?
      General Questions • scripting user interface menu • • ryan  

      8
      1
      Votes
      8
      Posts
      503
      Views

      ryan

      Ah! Ok I rewrote Gustavo’s script to rebuild the menu each time it's run. So I can just rerun the script when I want it to update. # menuTitle: _ Add / Update Custom Scripts Menu from AppKit import NSApp, NSMenu, NSMenuItem from lib.UI.fileBrowser import RFPathItem def addMenu(name, path): '''Creates a new menu item in RoboFont’s main application menu.''' # create a new menu menu = NSMenu.alloc().initWithTitle_(name) # create a path item that will build the menu and connect all the callbacks pathItem = RFPathItem(path, ['.py'], isRoot=True) pathItem.getMenu(title=name, parentMenu=menu) # get the main menu menubar = NSApp().mainMenu() # search if the menu item already exists newItem = menubar.itemWithTitle_(name) if newItem: menubar.removeItem_(newItem) newItem = NSMenuItem.alloc().initWithTitle_action_keyEquivalent_(name, '', '') menubar.insertItem_atIndex_(newItem, menubar.numberOfItems()-3) # set the menu as submenu newItem.setSubmenu_(menu) addMenu('menu name', '/path/to/folder/') Key lines: if newItem: menubar.removeItem_(newItem)
    • Manufraktur

      SOLVED Clean curve/remove points
      General Questions • • Manufraktur  

      10
      0
      Votes
      10
      Posts
      88
      Views

      frederik

      super!!! thanks @robstenson @Manufraktur
    • jansindl3r

      SOLVED RoboFont will convert TrueType splines to splines with 2 offcurve points.
      General Questions • truetype quadratic • • jansindl3r  

      4
      0
      Votes
      4
      Posts
      27
      Views

      jansindl3r

      After some work I realized that I need to keep everything as it is, only change from cubic to quadratic or the other way round. I went for cubic -> quadratic. The conversion doesn't has to be perfect. All tools add extra points. I found out that the simplest conversion from cubic to quadratic is to offset offcurve points to 75% of their lengths. I am using brutal way of changing it with xml parser. I see that when I cmd + c a cubic contour to quadratic or the other way around font I get the desired result, which I am not able to access via code though.
    • HB888

      SOLVED Font not does not centre
      General Questions • • HB888  

      6
      0
      Votes
      6
      Posts
      39
      Views

      ryan

      @HB888 is there a chance you have a “space” typed at the end of each of the 2nd and 3rd lines?
    • 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!
    • rdmcmurray

      SOLVED Check if open font has UI?
      General Questions • user interface fontparts • • rdmcmurray  

      3
      0
      Votes
      3
      Posts
      11
      Views

      rdmcmurray

      Thank you @gferreira! I was calling showInterface as a property of the font itself which obviously didn't get me very far!
    • RafaŁ Buchner

      SOLVED How to turn “line” segment into “curve” segment with code?
      General Questions • fontparts pens • • RafaŁ Buchner  

      5
      0
      Votes
      5
      Posts
      33
      Views

      frederik

      don't know the context but you can also use the MathGlyphPen from fontMath to convert all line segments to curve segments
    • Colo-in-NYC

      SOLVED Components best practices
      General Questions • components interpolation • • Colo-in-NYC  

      3
      0
      Votes
      3
      Posts
      30
      Views

      okaytype

      A few other potential issues: Path directions can change, eg flip a component horizontally Rounding can become an issue, especially if going small or thin Subsetting is a potential issue, depending on the method Also worth knowing that any component with a transformation (scale, rotate, flip, skew, etc) is automatically decomposed when the font is generated.
    • Colo-in-NYC

      SOLVED Tweaking the fraction feature code
      General Questions • opentype features • • Colo-in-NYC  

      3
      0
      Votes
      3
      Posts
      15
      Views

      Colo-in-NYC

      Thank you for the response. I get it, I think. Address two different problems with the processes for addressing those issues, rather than conflate the code of one problem with the "solution" for the other. Cheers. Now to get the kerning part right!
    • grahambradley

      SOLVED Instant switching between Preferences files?
      General Questions • user interface preferences • • grahambradley  

      3
      0
      Votes
      3
      Posts
      19
      Views

      grahambradley

      I just remembered that I asked this question - so sorry for the delayed response! ThemeManager is exactly the kind of solution I was looking for. I'll try it out. Thank you so much!
    • RafaŁ Buchner

      SOLVED How to add name table entry with nameID bigger than 22?
      General Questions • variable fonts default ufo name tables • • RafaŁ Buchner  

      5
      0
      Votes
      5
      Posts
      30
      Views

      RafaŁ Buchner

      thanks!!!
    • bahman

      SOLVED Modular extensions
      General Questions • • bahman  

      3
      0
      Votes
      3
      Posts
      20
      Views

      gferreira

      hello @bahman, another option is to include the shared libraries in the extension using git subtree – see the notes here. cheers!
    • bahman

      SOLVED Data folder
      General Questions • extensions ufo • • bahman  

      2
      1
      Votes
      2
      Posts
      28
      Views

      frederik

      you can store your tool specific data in the data folder! defcon has an api for reading and writing files, not for folders inside the data folder. font = CurrentFont() defconFont = font.naked() print(defconFont) print(defconFont.data.fileNames) # data must be bytes defconFont.data["com.bahman.superKernTool.as.bytes"] = b"myData" myData = dict() myData["superkern"] = "foo" defconFont.data["com.bahman.superKernTool.as.plist"] = plistlib.dumps(myData) defconFont.save('test.ufo') good luck
    • jansindl3r

      UNSOLVED contextual kerning in RB, MM?
      General Questions • kerning opentype features metrics machine • • jansindl3r  

      12
      0
      Votes
      12
      Posts
      85
      Views

      bahman

      @frederik I dream of the day someone would convert fontTools feature ast objects to json and we won't use fea file anymore.
    • bahman

      SOLVED MultiLine View related questions.
      General Questions • space center • • bahman  

      7
      0
      Votes
      7
      Posts
      42
      Views

      bahman

      Thank you for this!