Skip to content

Commit

Permalink
Add typing to partitionByScript
Browse files Browse the repository at this point in the history
  • Loading branch information
madig committed Nov 15, 2022
1 parent b3beeca commit 7cede79
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion Lib/ufo2ft/featureWriters/kernFeatureWriter.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import logging
from dataclasses import dataclass
from types import SimpleNamespace
from typing import Iterator, Mapping

from fontTools import unicodedata
from fontTools.unicodedata import script_horizontal_direction
Expand Down Expand Up @@ -410,7 +411,10 @@ def splitKerning(pairs, glyphScripts):
return kerningPerScript


def partitionByScript(pair, glyphScripts):
def partitionByScript(
pair: KerningPair,
glyphScripts: Mapping[str, set[str]],
) -> Iterator[tuple[str, KerningPair]]:
"""Split a potentially mixed-script pair into pairs that make sense based
on the dominant script, and yield each combination with its dominant script."""

Expand Down

0 comments on commit 7cede79

Please sign in to comment.