Forum Replies Created
-
AuthorPosts
-
you can interpolate with a different x, y values:
newGlyph.interpolate((factorX, factorY), glyph1, glyph2)
also see http://robofab.com/howto/interpolate.html
The glyphPreview thing is actually a simple thing. It scales the glyph according the size of the view.
why do you want to scale the glyph? is the glyph to big?what could help is to set a unitsperem in the parent of the glyph:
dummyFont = RFont(showUI=False) newGlyph = dummyFont.newGlyph("testInterpolation") newGlyph.interpolate(factor, masterGlyph1, masterGlyph2) box = newGlyph.box() if box: minx, miny, maxx, maxy = box dummyFont.info.unitsPerEm = maxy - miny # calculate the height of the glyph preview.setGlyph(newGlyph)
good luck!
A unicode value is a hexadecimal number (using 0123456789ABCDEF) that makes it base 16. In a glyph object a unicode value is stored as a decimal (base 10) so you have to convert it, an option is to use
int("FFFF", 16)
.The values in the AGL2UV dictionary are already decimal numbers as you need to put into
glyph.unicode
if you want to convert a decimal number back to the hex value:
"%X" % 255
good luck
2 possible options:
first check: when inserting a glyph and the glyph name is already in the font, all unicodes are removed, duplicates are not allowed
secondly: when setting a unicode it must be the integer value of the hex value
unicodeValueHex = "0302" print int(unicodeValueHex, 16)
g.autoUnicodes() only works when the glyph name is in the
from fontTools.agl import AGL2UV
dict,
FYI in the next version its is possible to set your own agl (adobe glyph list) in the prefsmmm, no but that is maybe a good idea… will take this in consideration
side note: the @MMK group prefix is a prefix used by Metric Machine
good luck!
Hi
1.
maybe some other optionsyou can enable “Curve Length” to display distances between points or use this example code https://github.com/typemytype/RoboFontExamples/blob/master/observers/drawSelectedPointDistances.py
2.
The background of each layer is coloured with a tiny of the layer color. Maybe the tint value should be a (hidden) preference.3.
Write a simple script and assign a short key to it:g = CurrentGlyph() backgroundGlyph =g.getLayer("background") backgroundGlyph.clear()
4.
Not in the current version. I already tried several options but nothing worked good enough to be a perfect script-killer.Good luck
for now only the close/open state of a panel inside the inspector window is saved to the user defaults. Not the the size. Will think about it :)
I see
bug will be solved in the next update
good luck
April 26, 2014 at 19:54 in reply to: Auto resize Window according to AccordionView size/state? #5875mmm
this is not that easy :)
it is possible, I would add an observer on “NSViewFrameDidChangeNotification” of the content view of the scrollview, an accordion view is actually a scrollview with some accordion powers
hope this makes sense :)
He Thom
use in your “external” scripts
from robofab.world import CurrentFont
or
from mojo.roboFont import CurrentFont
Those global variables (CurrentFont, CurrentGlyph, …) are injected in the main script automatically.
good luck!
see what the
getDisplayStates()
returns :)from mojo.UI import MultiLineView view = MultiLineView((0, 0, 0, 0)) print view.getDisplayStates()
{ 'Inverse': False, 'xHeight Cut': False, 'Show Kerning': True, 'Left to Right': True, 'Show Metrics': False, 'Show Space Matrix': True, 'Upside Down': False, 'Right to Left': False, 'Stroke': False, 'Beam': False, 'Water Fall': False, 'Multi Line': True, 'Single Line': False, 'Show Control glyphs': False, 'Fill': True }
good luck
the easiest is to add items to the popup (only in a subclass of the EditingTool)
off course you can always use NSMenu and pop up a menu in a view at specific location
from mojo.events import EditingTool, installTool class TestTool(EditingTool): def additionContectualMenuItems(self): return [("Test item", self.callback), ("submenu", [("Test Item", self.callback), ("Test Item 2", self.callback)])] def callback(self): print "hello world" installTool(TestTool())
oke, you want to use a MultiLineView, I misunderstood :)
a small example:
from mojo.UI import MultiLineView from vanilla import * inputText = """Hello world""" class LineController(object): def __init__(self): self.w = Window((400, 400), minSize=(200, 200)) self.w.lineView = MultiLineView((0, 0, -0, -0)) font = CurrentFont() charMap = font.getCharacterMapping() glyphs = [] for char in inputText: if char == "\n": glyph = self.w.lineView.createNewLineGlyph() else: uni = ord(char) glyphName = charMap.get(uni) if glyphName: glyphName = glyphName[0] glyph = font[glyphName] glyphs.append(glyph) self.w.lineView.set(glyphs) self.w.open() LineController()
mm, seems to be a bitmap drawing bug: a single contour with a ttf-preferred-contour direction will draw this bug. I fixed it with a small detour.
thanks
I would use a spaceCenter object to manage input and change it there
from mojo.UI import OpenSpaceCenter # open a space center or get the current one spaceCenter = OpenSpaceCenter(CurrentFont()) # get the input as a list print spaceCenter.get() # get the input as raw string (same as you see in the edit text view) print spaceCenter.getRaw() # set the input as raw string spaceCenter.setRaw("hello\\nworld")
-
AuthorPosts