hello Erik, thanks for the feedback.
the mojo.canvas page has been updated with more information (including a link to the NSEvent documentation) and code samples.
I’m still trying to wrap my head around canvas… haven’t really built anything with it yet.
what RoboFont does related to test install:
each test install font path is added to a list in the prefs, on quit RF loops over this list and deinstalls all fonts.
When RF crashes, it cannot deinstall those fonts. So the next launch detects those test installed fonts, a popup will appear and RF tries to deinstall them.
RoboFont tries to inform users as much as possible on issues happening in the background. Silent fixes are not the best solutions for many cases...
Thank you so much for the example, not only for the fact you got the basic functionality there, but also for the comments and tips. I will study it hard
I can certainly take it from here,
It's mostly a learning exercise, but if it turns out to be useful I'll see about making it robust enough for sharing.
Side note about docs: I think that if you print help it should not print a joke (or broken) link otherwise it leads you to believe you're missing important information that is no longer accessible, perhaps it can be updated?
It's a similar story for the "starting with mojo" link on the homepage, I can't count the amount of times I clicked on that thinking that's where I will find answers and there's nothing there. Both examples undermine the authority of the docs that do exist, leaving you wondering if they are incomplete.
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.
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
def __init__(self, glyphs):
self.w = Window((900,600), '')
self.w.collectionView = GlyphCollectionView((15, 15, -15, -65), doubleClickCallback=self.double, cellRepresentationName='doodle.GlyphCell')
title = f.info.familyName +' - '+ f.info.styleName+', '+ str(CurrentGlyph())
def double(self, sender):
order = f.lib.get('public.glyphOrder')
f = CurrentFont()
g = CurrentGlyph()
glyphs = 
for g in f.lib.get('public.glyphOrder'):