File: Attachment.py

package info (click to toggle)
python-fontfeatures 1.9.0%2Bds-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,096 kB
  • sloc: python: 9,112; makefile: 22
file content (21 lines) | stat: -rw-r--r-- 613 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
"""ttLib.Attachment: Converting Attachment rules to TrueType."""

from fontFeatures.utils import categorize_glyph


def lookup_type(self):
    """Mixin to determine the GPOS lookup type of a fontFeatures.Attachment object

    Returns: integer GPOS lookup type."""
    if self.is_cursive:
        return 3
    # Terrible hacks
    firstbase = list(self.bases.keys())[0]
    if (
        hasattr(self, "fontfeatures")
        and self.fontfeatures.glyphclasses.get(firstbase) == "mark"
    ):
        return 6
    if self.font and categorize_glyph(self.font, firstbase)[0] == "mark":
        return 6
    return 4