Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
path = "../../ali-uni/build/UFO/Ali-Uni_Samik_Regular.ufo"
path = "../sources/lots.ufo"
#path = "../sources/adobe.ufo"
mFont = Font(path)
mUnicodes = mFont.unicodeData
data = mFont.getDataForSerialization()
master = Font('../sources/font.ufo')
ufo = Font()
ufo.setDataFromSerialization({'info': data['info']})
layersDict = {}
layersColors = ('','1,0,0,1', '0,1,0,1', '0,0,1,1', '0.5,0.5,0,1', '0.5,0,0.5,1', '0,0.5,0.5,1', '0.5,0.5,0.5,1', '1,0,0,1', '1,0,0,1',
'1,0,0,1')
for nl in range(1, 9):
newLayer = ufo.layers.newLayer('background' + str(nl - 1))
newLayer.color = Color(layersColors[nl])
layersDict.update({'layer' + str(nl): newLayer})
ufo.newGlyph('.notdef')
for glf in RAWN2C:
layer = 0
glfSrc = RAWN2C[glf].split(',')
if glf == "legLG.isol":
m = 1
for g in glfSrc:
if layer == 10:
continue
try:
gCode = AGL2UV[g]
mgName = mUnicodes[gCode]
glyph = Glyph()
glyph.copyDataFromGlyph(mFont[mgName[0]])
def toQColor(color):
return QColor.fromRgbF(*Color(color))
def writeLayerColor(self):
widget = self.sender()
color = widget.color()
layer = widget.property("layer")
if color is not None:
color = Color(color.getRgbF())
layer.color = color
def getLayer(self, layer):
layerName = "BG_layer_" + str(layer)
if layerName not in self.layers.keys():
newLayer = self.UFO.layers.newLayer(layerName)
newLayer.color = Color("0,1,0,1")
self.layers.update({layerName: newLayer})
return self.layers[layerName]
def writeMarkColors(self, settings=None):
if settings is None:
settings = QSettings()
settings.beginWriteArray("misc/markColors")
# serialized in UFO form
for i in range(self.markColorWidget.topLevelItemCount()):
settings.setArrayIndex(i)
item = self.markColorWidget.topLevelItem(i)
color = self.markColorWidget.itemWidget(item, 0).color()
settings.setValue("name", item.text(1))
settings.setValue("color", str(Color(color.getRgbF())))
settings.endArray()
def writeMarkColors(markColors):
settings = QSettings()
settings.beginWriteArray("misc/markColors")
# serialized in UFO form
i = 0
for color, name in markColors:
settings.setArrayIndex(i)
settings.setValue("color", str(Color(color.getRgbF())))
settings.setValue("name", name)
i += 1
settings.endArray()
def writeMarkColor(self):
color = self.markColorWidget.color()
if color is not None:
color = Color(color.getRgbF())
self._glyph.markColor = color