Debian Codegraph @

Lib/fontFeatures/ttLib/Attachment.py

raw
1 """ttLib.Attachment: Converting Attachment rules to TrueType."""
2
3 from fontFeatures.utils import categorize_glyph
4
5
6 def lookup_type(self):
7 """Mixin to determine the GPOS lookup type of a fontFeatures.Attachment object
8
9 Returns: integer GPOS lookup type."""
10 if self.is_cursive:
11 return 3
12 # Terrible hacks
13 firstbase = list(self.bases.keys())[0]
14 if (
15 hasattr(self, "fontfeatures")
16 and self.fontfeatures.glyphclasses.get(firstbase) == "mark"
17 ):
18 return 6
19 if self.font and categorize_glyph(self.font, firstbase)[0] == "mark":
20 return 6
21 return 4