Forum Replies Created
-
AuthorPosts
-
I would advise to subscribe to the notification
fontDidSave
and create a duplicate whenever that notification is been send.There is also a
fontWillSave
andfontWillAutoSave
(in case you want to keep a version each 10 min)good luck
Due to optimisations a text will not update directly cause it is receiving lots of updates in a short time.
You will have to force the text view to update
instead of using the private
_nsObject
I would encourage you to usegetNSTextField()
good luck
this is already fixed in the beta and upcoming 1.7 release
thanks for reporting!
use:
g = CurrentGlyph() contour = g[1] contour.selected = True g.update()
Hi
the mixed parents will be fixed in the next update, thanks for reporting
one thing: a
tool.getGlyph()
method will always return a glyph from a glyph view, if you select a font window, it will send you acurrentGlyphChanged
notification, but the glyph will not actually change when using thetool.getGlyph()
. To get the global current glyph useCurrentGlyph()
the other weirdness: see https://github.com/typemytype/RoboFontExamples/blob/master/observers/eventObserver.py
a tool can become active separately from a
currentGlyphChanged
orviewDidChangeGlyph
the best thing todo is to draw the glyph into a pen store and process the data and draw it back into the glyph
this should work :)
enjoy
from robofab.pens.pointPen import AbstractPointPen class SortingPen(AbstractPointPen): def __init__(self): self._contours = [] def beginPath(self): self._contours.append([]) def addPoint(self, pt, segmentType=None, smooth=False, name=None, **kwargs): self._contours[-1].append((pt, segmentType, smooth, name, kwargs)) def endPath(self): pass def addComponent(self, baseGlyph, transformation): pass def drawPoints(self, pen): # sort by the len of oncurves and offcurvers for each contour sortable = [] for contour in self._contours: oncurves = 0 offcurves = 0 for pt, segmentType, smooth, name, kwargs in contour: if segmentType is None: offcurves += 1 else: oncurves += 1 sortable.append((oncurves, offcurves, contour)) sortable.sort() for oncurvers, offcurvers, contour in sortable: pen.beginPath() for pt, segmentType, smooth, name, kwargs in contour: pen.addPoint(pt, smooth=smooth, segmentType=segmentType, name=name, **kwargs) pen.endPath() # get the current glyph g = CurrentGlyph() # get the pen sorting = SortingPen() # draw into that pen g.drawPoints(sorting) # clear the contours g.clearContours() # draw back into the glyph sorting.drawPoints(g.getPointPen())
hi
could you make an small example?
I cannot reproduce this issue, with a quick test…
thanks
from mojo.events import BaseEventTool, installTool class TestTool(BaseEventTool): def currentGlyphChanged(self): g = self.getGlyph() f = g.getParent() print g.name, f installTool(TestTool())
The font lib key will be
com.typesupply.ufo2fdk.glyphOrderAndAliasDB
and will also be used in Tal’s ufo2fdk package.Hi
That lib key doest exists, it was just an example how it could be solved somehow.
But if I was you I would just wait for the next update, there is an option to store the FDK Glyph Alias DB in the font.lib. That solve the issue of production glyph names vs real glyph names
good luck
I would advice you to use
getExtensionDefault(key, fallback)
andsetExtensionDefault(key, value)
He Nina
Space Center already doest that, in all three input boxes. You could use that for Word-O-Mat… so it has support for pasting glif xml
from lib.UI.spaceCenter.glyphSequenceEditText import GlyphSequenceEditText from vanilla import * class Test: def __init__(self): self.w = Window((200, 100)) # the only tricky thing is that it is optimized for the lowerlevel defcon font object... self.w.input = GlyphSequenceEditText((10, 10, -10, 22), CurrentFont().naked(), callback=self.inputChangedCallback) self.w.open() def inputChangedCallback(self, sender): print sender.get() Test()
FYI:
RoboFont writes different representations to the pasteboard, any thing that is responding to a paste action can read their preferred representation.
it is possible to add you’re own representations if you subscribe to the paste notification, just a add or rewrite whatever you like :)
He
I don’t fully understand why but here is a script that is changing the size and position of the current window to the pervious current window
from AppKit import NSApp # get all ordered windows windows = NSApp().orderedWindows() # get the size of the window (x, y), (w, h) = windows[1].frame() # set the size of the window windows[0].setFrame_display_animate_(((x, y), (w, h)), True, False)
good luck!
it should be living in
/usr/local/bin/vfb2ufo
it should also listen to
which vfb2ufo
in terminal, that is how RoboFont looks for it.And you probably have to restart RoboFont as the hasVFB2UFO flag is being set during start up
good luck
it should, just change the ext of the save image path to .gif or .mov
if it not get generated: is there a traceback, does it export as pdf? with multiple pages?
can you make an example?
thanks
yep, using executeCommand solves your issue when
shell
is set to True -
AuthorPosts