Navigation

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

    • jesentanadi

      SOLVED Find out what part of a glyph is selected
      General Questions • scripting fontparts • • jesentanadi  

      8
      0
      Votes
      8
      Posts
      810
      Views

      jesentanadi

      @frederik sorry, didn't realize it's new to FontParts too. I'll give 3.2b a try.
    • 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
    • RafaŁ Buchner

      SOLVED RContour.insertPoint() on curve?
      Documentation • scripting contours fontparts • • RafaŁ Buchner  

      5
      0
      Votes
      5
      Posts
      1054
      Views

      frederik

      thanks for your example!!
    • zackrobbins

      SOLVED Clicked on Views Icon- now robofont crashes on open.
      Problems & Bugs • scripting smart sets • • zackrobbins  

      3
      0
      Votes
      3
      Posts
      513
      Views

      zackrobbins

      Wow, that fixed it. I have no idea how I managed to unknowingly do that. Thanks!
    • pieterpjotr

      SOLVED Generate font with limited character set
      General Questions • scripting font generation • • pieterpjotr  

      4
      0
      Votes
      4
      Posts
      685
      Views

      frederik

      @pieterpjotr super enjoy!!
    • benedikt

      UNSOLVED Traceback when sorting AllFonts()
      Problems & Bugs • scripting fontparts • • benedikt  

      4
      0
      Votes
      4
      Posts
      716
      Views

      frederik

      @benedikt said in Traceback when sorting AllFonts(): fontParts.world.FontList these functionalities should be provided by an implementation and not by fontParts, similar to CurrentFont, CurrentGlyph, CurrentLayer, CurrentContour, CurrentPoint,... FontList is optional but could be provided by an implementation.
    • connor

      SOLVED Change Component Indexes
      General Questions • scripting components • • connor  

      3
      0
      Votes
      3
      Posts
      546
      Views

      connor

      Wow, thank you * 10000 for the help, Frederik! I really appreciate it.
    • dovezea

      SOLVED Deleting multiple layers at a time.
      Feature Requests • scripting layers fontparts vanilla • • dovezea  

      4
      0
      Votes
      4
      Posts
      1172
      Views

      dovezea

      Thanks so much Frederik! That's exactly what I was missing!
    • StephenNixon

      SOLVED Detect unsaved changes via script
      General Questions • scripting saving • • StephenNixon  

      4
      0
      Votes
      4
      Posts
      795
      Views

      StephenNixon

      Oops; nevermind! Just found out that macOS has a built-in feature to do this exact thing. Just use the shortcut option + command + w.
    • benedikt

      UNSOLVED Scripting window & folder aliases
      General Questions • scripting scripting window • • benedikt  

      2
      1
      Votes
      2
      Posts
      622
      Views

      frederik

      euhm, never tried that... but will write it down
    • RafaŁ Buchner

      SOLVED Strings into Names
      General Questions • scripting unicode glyph names • • RafaŁ Buchner  

      3
      0
      Votes
      3
      Posts
      891
      Views

      RafaŁ Buchner

      @gferreira Thanks! Works perfectly!
    • Guest

      UNSOLVED Observing isCompatible bug when using bezier tool
      Problems & Bugs • scripting observers • • Guest  

      1
      0
      Votes
      1
      Posts
      604
      Views

      Guest

      Hello again! My weekend robofont training (self imposed) continues, and I may have discovered a bug. I am attempting a live update on the compatibility of two glyphs from different fonts. The idea at its most basic could manifest as a red mark drawn to the glyph window canvas whenever the glyph becomes incompatible whilst you are drawing/editing the glyph. I am using isCompatible() and a glyph.changed observer It reports when I make a change to the glyph, calling a function that for now simply prints the result of isCompatible. It works fine if I remove a contour, and it works fine if I add a point to an existing contour using knife, but it seems to crash if I use the bezier tool to start drawing a new contour. I have a gist here, please try to replicate the error. https://gist.github.com/MBurvill/fb6772f9e8bc49e583f16e6dc650b7d8#file-isCompatibleObserverBugTest-py FYI I found the useage of glyph.changed in one of Frederiks examples (stencil preview), but usage of this observer appears to be undocumented, I would expect to be able to find it at http://doc.robofont.com/api/custom-observers/ Thanks!
    • nina

      SOLVED SetSuffix in Space Center?
      Feature Requests • scripting space center • • nina  

      2
      1
      Votes
      2
      Posts
      662
      Views

      nina

      I just noticed this is still sitting here. For future reference: I tried this again in RF 3.3, and it works perfectly now. from mojo.UI import CurrentSpaceCenter sc = CurrentSpaceCenter() sc.setSuffix('.sc') # boom, works
    • Guest

      Scripting: nearest oncurve point for a given coordinate
      General Questions • scripting contours • • Guest  

      3
      1
      Votes
      3
      Posts
      741
      Views

      jens

      I found a way to speed up the brute force approach though. If you can use external Python modules: from scipy import spatial tree = spatial.KDTree(t_list) # t_list is a list of pre-calculated point coordinate tuples on the cubic curve distance, index = tree.query(pt) # pt is the given point coordinate tuple t_for_pt = float(index) / (len(tree.data) - 1) t_list must be constructed in a way that the first entry is for t = 0 and the last entry for t = 1. It doesn't matter how many points for increments of t you calculate, as long as the index in t_list is proportional to t. Smaller increments of t increase the precision of the result, but the list takes longer to build.
    • nina

      Delete point & approximate existing curve
      Feature Requests • scripting contours • • nina  

      2
      0
      Votes
      2
      Posts
      633
      Views

      frederik

      mmm, not directly from the robofab objects but you could use the naked object g = CurrentGlyph() # remove the first segment from the first contour g[0].naked().removeSegment(0, preserveCurve=True) good luck!
    • bahman

      Launching a httpdserver
      General Questions • scripting • • bahman  

      2
      0
      Votes
      2
      Posts
      441
      Views

      frederik

      As far as I understand this example, this will run forever until a traceback is raised. This seems to work fine with an htmlView inside RoboFont. Good luck
    • bahman

      OpenWindow with update
      Feature Requests • scripting user interface • • bahman  

      3
      0
      Votes
      3
      Posts
      633
      Views

      bahman

      Is there any update on this. I'm trying to make a sub class of BaseWindowController to run a method if the window is already open. Still OpenWindow returns None. Thanks
    • thom

      Single Window Mode + separate font overview
      General Questions • scripting user interface • • thom  

      4
      0
      Votes
      4
      Posts
      721
      Views

      thom

      I have this... But it is buggy. See if you scroll. If you change a glyph the factory doest work, only after scrolling/clicking on the overview.. Here I need a bit help :) from vanilla import * from defconAppKit.controls.glyphCollectionView import * from defconAppKit.windows.baseWindow import BaseWindowController from mojo.UI import SetCurrentGlyphByName class MyFont(BaseWindowController): def __init__(self, glyphs): self.w = Window((900,600), '') self.w.collectionView = GlyphCollectionView((15, 15, -15, -65), doubleClickCallback=self.double, cellRepresentationName='doodle.GlyphCell') self.w.collectionView.setCellSize((100, 100)) self.setUpBaseWindowBehavior() self.w.collectionView.preloadGlyphCellImages() self.w.collectionView.set(glyphs) self.updateTitle() self.w.open() def updateTitle(self): title = f.info.familyName +' - '+ f.info.styleName+', '+ str(CurrentGlyph()) self.w.setTitle(title) def double(self, sender): order = f.lib.get('public.glyphOrder') SetCurrentGlyphByName(order[self.w.collectionView.getSelection()[0]]) self.updateTitle() f = CurrentFont() g = CurrentGlyph() glyphs = [] for g in f.lib.get('public.glyphOrder'): glyphs.append(f[g]) MyFont(glyphs)
    • Guest

      SOLVED HasOverlap in 1.7
      General Questions • scripting remove overlap • • Guest  

      3
      0
      Votes
      3
      Posts
      705
      Views

      Guest

      Great! I've fixed that file and now it works perfect. Thanks, em.
    • bahman

      SOLVED Glyph editor display toggles API
      General Questions • scripting user interface • • bahman  

      2
      0
      Votes
      2
      Posts
      490
      Views

      frederik

      he Bahman you can use: from mojo.UI import setGlyphViewDisplaySettings, getGlyphViewDisplaySettings settings = getGlyphViewDisplaySettings() print settings # change something, and set it back # setGlyphViewDisplaySettings(settings) good luck