コード例 #1
0
def parseAttachList(lines, font):
	points = {}
	with lines.between('attachment list'):
		for line in lines:
			glyph = makeGlyph(line[0])
			assert glyph not in points, glyph
			points[glyph] = [int(i) for i in line[1:]]
	return otl.buildAttachList(points, font.getReverseGlyphMap())
コード例 #2
0
def parseAttachList(lines, font):
	points = {}
	with lines.between('attachment list'):
		for line in lines:
			glyph = makeGlyph(line[0])
			assert glyph not in points, glyph
			points[glyph] = [int(i) for i in line[1:]]
	return otl.buildAttachList(points, font.getReverseGlyphMap())
コード例 #3
0
ファイル: builder.py プロジェクト: jamesgk/fonttools
 def buildGDEF(self):
     gdef = otTables.GDEF()
     gdef.GlyphClassDef = self.buildGDEFGlyphClassDef_()
     gdef.AttachList = otl.buildAttachList(self.attachPoints_, self.glyphMap)
     gdef.LigCaretList = otl.buildLigCaretList(self.ligCaretCoords_, self.ligCaretPoints_, self.glyphMap)
     gdef.MarkAttachClassDef = self.buildGDEFMarkAttachClassDef_()
     gdef.MarkGlyphSetsDef = self.buildGDEFMarkGlyphSetsDef_()
     gdef.Version = 0x00010002 if gdef.MarkGlyphSetsDef else 1.0
     if any(
         (gdef.GlyphClassDef, gdef.AttachList, gdef.LigCaretList, gdef.MarkAttachClassDef, gdef.MarkGlyphSetsDef)
     ):
         result = getTableClass("GDEF")()
         result.table = gdef
         return result
     else:
         return None
コード例 #4
0
ファイル: builder.py プロジェクト: shannonyu/fonttools
 def buildGDEF(self):
     gdef = otTables.GDEF()
     gdef.GlyphClassDef = self.buildGDEFGlyphClassDef_()
     gdef.AttachList = \
         otl.buildAttachList(self.attachPoints_, self.glyphMap)
     gdef.LigCaretList = \
         otl.buildLigCaretList(self.ligCaretCoords_, self.ligCaretPoints_,
                               self.glyphMap)
     gdef.MarkAttachClassDef = self.buildGDEFMarkAttachClassDef_()
     gdef.MarkGlyphSetsDef = self.buildGDEFMarkGlyphSetsDef_()
     gdef.Version = 0x00010002 if gdef.MarkGlyphSetsDef else 1.0
     if any((gdef.GlyphClassDef, gdef.AttachList, gdef.LigCaretList,
             gdef.MarkAttachClassDef, gdef.MarkGlyphSetsDef)):
         result = getTableClass("GDEF")()
         result.table = gdef
         return result
     else:
         return None
コード例 #5
0
ファイル: builder_test.py プロジェクト: graphicore/fonttools
 def test_buildAttachList(self):
     attachList = builder.buildAttachList({
         "zero": [23, 7], "one": [1],
     }, self.GLYPHMAP)
     self.assertEqual(getXML(attachList.toXML),
                      '<AttachList>'
                      '  <Coverage>'
                      '    <Glyph value="zero"/>'
                      '    <Glyph value="one"/>'
                      '  </Coverage>'
                      '  <!-- GlyphCount=2 -->'
                      '  <AttachPoint index="0">'
                      '    <!-- PointCount=2 -->'
                      '    <PointIndex index="0" value="7"/>'
                      '    <PointIndex index="1" value="23"/>'
                      '  </AttachPoint>'
                      '  <AttachPoint index="1">'
                      '    <!-- PointCount=1 -->'
                      '    <PointIndex index="0" value="1"/>'
                      '  </AttachPoint>'
                      '</AttachList>')
コード例 #6
0
 def test_buildAttachList(self):
     attachList = builder.buildAttachList({
         "zero": [23, 7], "one": [1],
     }, self.GLYPHMAP)
     self.assertEqual(getXML(attachList.toXML),
                      '<AttachList>'
                      '  <Coverage>'
                      '    <Glyph value="zero"/>'
                      '    <Glyph value="one"/>'
                      '  </Coverage>'
                      '  <!-- GlyphCount=2 -->'
                      '  <AttachPoint index="0">'
                      '    <!-- PointCount=2 -->'
                      '    <PointIndex index="0" value="7"/>'
                      '    <PointIndex index="1" value="23"/>'
                      '  </AttachPoint>'
                      '  <AttachPoint index="1">'
                      '    <!-- PointCount=1 -->'
                      '    <PointIndex index="0" value="1"/>'
                      '  </AttachPoint>'
                      '</AttachList>')
コード例 #7
0
 def test_buildAttachList(self):
     attachList = builder.buildAttachList({
         "zero": [23, 7],
         "one": [1]
     }, self.GLYPHMAP)
     assert getXML(attachList.toXML) == [
         "<AttachList>",
         "  <Coverage>",
         '    <Glyph value="zero"/>',
         '    <Glyph value="one"/>',
         "  </Coverage>",
         "  <!-- GlyphCount=2 -->",
         '  <AttachPoint index="0">',
         "    <!-- PointCount=2 -->",
         '    <PointIndex index="0" value="7"/>',
         '    <PointIndex index="1" value="23"/>',
         "  </AttachPoint>",
         '  <AttachPoint index="1">',
         "    <!-- PointCount=1 -->",
         '    <PointIndex index="0" value="1"/>',
         "  </AttachPoint>",
         "</AttachList>",
     ]
コード例 #8
0
 def test_buildAttachList_empty(self):
     assert builder.buildAttachList({}, self.GLYPHMAP) is None
コード例 #9
0
ファイル: builder_test.py プロジェクト: graphicore/fonttools
 def test_buildAttachList_empty(self):
     self.assertIsNone(builder.buildAttachList({}, self.GLYPHMAP))
コード例 #10
0
 def test_buildAttachList_empty(self):
     self.assertIsNone(builder.buildAttachList({}, self.GLYPHMAP))