frederik

Forum Replies Created

Viewing 15 posts - 121 through 135 (of 531 total)
  • Author
    Posts
  • in reply to: GlyphPreview / interpolate / scale #5902

    frederik
    Keymaster

    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!

    in reply to: inserting glyph with specific unicode value #5898

    frederik
    Keymaster

    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

    in reply to: inserting glyph with specific unicode value #5896

    frederik
    Keymaster

    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 prefs

    in reply to: "safe mode" #5893

    frederik
    Keymaster

    mmm, no but that is maybe a good idea… will take this in consideration

    in reply to: Groups / @MMK #5890

    frederik
    Keymaster

    side note: the @MMK group prefix is a prefix used by Metric Machine

    good luck!

    in reply to: Handful of questions for new Robofont User #5885

    frederik
    Keymaster

    Hi

    1.
    maybe some other options

    you 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

    in reply to: Layer palette size in Inspector #5882

    frederik
    Keymaster

    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 :)

    in reply to: GlyphLineView #5876

    frederik
    Keymaster

    I see

    bug will be solved in the next update

    good luck


    frederik
    Keymaster

    mmm

    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 :)


    frederik
    Keymaster

    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!

    in reply to: GlyphLineView #5870

    frederik
    Keymaster

    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

    in reply to: popup menu #5866

    frederik
    Keymaster

    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())
    
    in reply to: GlyphLineView #5862

    frederik
    Keymaster

    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()
    
    in reply to: Bitmap error #5860

    frederik
    Keymaster

    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

    in reply to: GlyphLineView #5858

    frederik
    Keymaster

    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")
    
Viewing 15 posts - 121 through 135 (of 531 total)