These have been renamed.
git-svn-id: http://svn.robofab.com/trunk@83 b5fa9d6c-a76f-4ffd-b3cb-f825fc41095c
This commit is contained in:
parent
34ef397f91
commit
d7bd6f0ace
@ -1,39 +0,0 @@
|
|||||||
#FLM: Glyph to Glif, not in UFO
|
|
||||||
|
|
||||||
"""
|
|
||||||
Dump the selected glyph to a Glif as a seperate, individual file.
|
|
||||||
This is not saved through a GlyphSet and any contents.plist in the
|
|
||||||
same directory will not be updated. If that's what you need use
|
|
||||||
DumpOneGlyphToUFO.py
|
|
||||||
|
|
||||||
"""
|
|
||||||
|
|
||||||
|
|
||||||
from robofab.glifLib import writeGlyphToString
|
|
||||||
from robofab.world import CurrentFont, CurrentGlyph
|
|
||||||
from robofab.interface.all.dialogs import PutFile
|
|
||||||
from robofab.tools.glyphNameSchemes import glyphNameToShortFileName
|
|
||||||
import os
|
|
||||||
|
|
||||||
f = CurrentFont()
|
|
||||||
g = CurrentGlyph()
|
|
||||||
|
|
||||||
if g is not None:
|
|
||||||
todo = [g.name]
|
|
||||||
else:
|
|
||||||
todo = f.selection
|
|
||||||
for c in todo:
|
|
||||||
g = f[c]
|
|
||||||
result = True
|
|
||||||
data = writeGlyphToString(g.name, g, g.drawPoints)
|
|
||||||
filename = glyphNameToShortFileName(g.name, None)
|
|
||||||
file = PutFile("Save this glif as:")
|
|
||||||
if file is not None:
|
|
||||||
path = os.path.join(os.path.dirname(file), filename)
|
|
||||||
print "saving to", path
|
|
||||||
f = open(path, "w")
|
|
||||||
f.write(data)
|
|
||||||
f.close()
|
|
||||||
|
|
||||||
|
|
||||||
print 'done'
|
|
@ -1,48 +0,0 @@
|
|||||||
#FLM: Export Selected Glyph to UFO
|
|
||||||
|
|
||||||
|
|
||||||
"""
|
|
||||||
Dump the selected glyph to a .glif as part of a UFO.
|
|
||||||
It saves the .glif through a GlyphSet and updates the contents.plist.
|
|
||||||
|
|
||||||
"""
|
|
||||||
|
|
||||||
|
|
||||||
from robofab.glifLib import GlyphSet
|
|
||||||
from robofab.world import CurrentFont, CurrentGlyph
|
|
||||||
from robofab.interface.all.dialogs import Message, GetFolder
|
|
||||||
from robofab.tools.glyphNameSchemes import glyphNameToShortFileName
|
|
||||||
import os
|
|
||||||
|
|
||||||
|
|
||||||
if os.name == "mac":
|
|
||||||
LOCAL_ENCODING = "macroman"
|
|
||||||
else:
|
|
||||||
LOCAL_ENCODING = "latin-1"
|
|
||||||
|
|
||||||
|
|
||||||
f = CurrentFont()
|
|
||||||
g = CurrentGlyph()
|
|
||||||
|
|
||||||
if g is not None:
|
|
||||||
todo = [g.name]
|
|
||||||
else:
|
|
||||||
todo = f.selection
|
|
||||||
for c in todo:
|
|
||||||
if f is None:
|
|
||||||
continue
|
|
||||||
g = f[c]
|
|
||||||
result = True
|
|
||||||
file = GetFolder("Select a UFO to save the GLIF in:")
|
|
||||||
if file is None:
|
|
||||||
continue
|
|
||||||
if file.find(".ufo") == -1:
|
|
||||||
Message("You need to select an UFO. Quitting.")
|
|
||||||
else:
|
|
||||||
path = os.path.join(os.path.dirname(file), os.path.basename(file), "glyphs")
|
|
||||||
print "saving glyph %s in %s"%(g.name.encode(LOCAL_ENCODING), path)
|
|
||||||
gs = GlyphSet(path, glyphNameToFileNameFunc=glyphNameToShortFileName)
|
|
||||||
gs.writeGlyph(g.name, g, g.drawPoints)
|
|
||||||
gs.writeContents()
|
|
||||||
|
|
||||||
print 'done'
|
|
Loading…
x
Reference in New Issue
Block a user