Skip to content

Commit

Permalink
some more fixes and clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
schriftgestalt committed Jan 4, 2012
1 parent df4c254 commit ca3c5d1
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 17 deletions.
7 changes: 3 additions & 4 deletions Import SVG.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
Copyright (c) 2010 schriftgestaltung.de. All rights reserved.
"""
from objectsGS import *
from GlyphsApp import GetFile
from vanilla.dialogs import getFile
from xml.dom import minidom

Bounds = None
Expand Down Expand Up @@ -217,10 +217,9 @@ def main():
print g
pen = g.getPen()

path = GetFile("Please select a .svg", ["svg"], False, True)
# print path
path = getFile(title="Please select a .svg", fileTypes=["svg"])
if path:
dom = minidom.parse(path)
dom = minidom.parse(path[0])
SVG = dom.getElementsByTagName("svg")[0]
Bounds = SVG.getAttribute('viewBox').split(" ")
if (len(Bounds) == 4):
Expand Down
3 changes: 1 addition & 2 deletions Import SVGs2Glyphs.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,9 +212,8 @@ def drawSVGNode(pen, node):

def main():
global Bounds
paths = getFile(title="Please select .svg files", allowsMultipleSelection=True fileTypes=["svg"])

paths = GetFile("Please select a .svg", True, ["svg"])

if paths is None:
return
for path in paths:
Expand Down
13 changes: 2 additions & 11 deletions MakeProdunctionFont.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,30 +15,23 @@
def main():
Doc = Glyphs.currentDocument
Font = Doc.font
print "Font", Font
Font.setDisablesNiceNames_(True)
FontMaster = Font.fontMasters()[0]
removeOverlapFilter = NSClassFromString("GlyphsFilterRemoveOverlap").alloc().init()
Font.disableUpdateInterface()
for Glyph in Font.glyphs:
if not Glyph.keep():
if not Glyph.export:
continue
Glyph.undoManager().beginUndoGrouping()
Layer = Glyph.layerForKey_(FontMaster.id)
Components = Layer.components
for i in range(2):
for Component in Components:
#Component = Layer.components[i]

if not Component.component:
print Glyph.name, " > Component", Component, Component.component
ComponentGlyph = Font.glyphs[Component.componentName]
ComponentLayer = ComponentGlyph.layerForKey_(FontMaster.id)
if (Glyph.name == "Ncaron"):
print "__ComponentGlyph:", Glyph.name, " > ", ComponentGlyph.name, ComponentLayer.components
if (ComponentGlyph and not ComponentGlyph.keep()) or len(Layer.paths) > 0 or len(ComponentLayer.components) > 0:
if (Glyph.name == "Ncaron"):
print "__Component.decompose()", Component
if (ComponentGlyph and not ComponentGlyph.export) or len(Layer.paths) > 0 or len(ComponentLayer.components) > 0:
Component.decompose()
if Glyph.leftKerningGroup:
Glyph.leftKerningGroup = Glyph.leftKerningGroup.replace("-", "")
Expand Down Expand Up @@ -66,8 +59,6 @@ def main():
Glyph.undoManager().endUndoGrouping()

Font.enableUpdateInterface()

print "Doc", Doc

if __name__ == '__main__':
main()
Expand Down

0 comments on commit ca3c5d1

Please sign in to comment.