o
    h                     @   s,   	dddZ edkrd dlZe  dS dS )    Nc                 C   s  | |v r||  S |dur|dusJ |dur|dusJ |du rJi }i }|  D ]!\}}|dr;|D ]}|||< q3q(|drI|D ]}|||< qBq(| \}	}
d }}|	dr\|	}d}	n||	}|
drk|
}d}
n||
}|	|
f|	|f||
f||fg}|D ]} | |v r||    S q|S )a  
    Note: This expects kerning to be a flat dictionary
    of kerning pairs, not the nested structure used
    in kerning.plist.

    >>> groups = {
    ...     "public.kern1.O" : ["O", "D", "Q"],
    ...     "public.kern2.E" : ["E", "F"]
    ... }
    >>> kerning = {
    ...     ("public.kern1.O", "public.kern2.E") : -100,
    ...     ("public.kern1.O", "F") : -200,
    ...     ("D", "F") : -300
    ... }
    >>> lookupKerningValue(("D", "F"), kerning, groups)
    -300
    >>> lookupKerningValue(("O", "F"), kerning, groups)
    -200
    >>> lookupKerningValue(("O", "E"), kerning, groups)
    -100
    >>> lookupKerningValue(("O", "O"), kerning, groups)
    0
    >>> lookupKerningValue(("E", "E"), kerning, groups)
    0
    >>> lookupKerningValue(("E", "O"), kerning, groups)
    0
    >>> lookupKerningValue(("X", "X"), kerning, groups)
    0
    >>> lookupKerningValue(("public.kern1.O", "public.kern2.E"),
    ...     kerning, groups)
    -100
    >>> lookupKerningValue(("public.kern1.O", "F"), kerning, groups)
    -200
    >>> lookupKerningValue(("O", "public.kern2.E"), kerning, groups)
    -100
    >>> lookupKerningValue(("public.kern1.X", "public.kern2.X"), kerning, groups)
    0
    Nzpublic.kern1.zpublic.kern2.)items
startswithget)pairkerninggroupsfallbackglyphToFirstGroupglyphToSecondGroupgroupgroupMembersglyphfirstsecond
firstGroupsecondGrouppairs r   l/var/www/html/construction_image-detection-poc/venv/lib/python3.10/site-packages/fontTools/ufoLib/kerning.pylookupKerningValue   sL   *







r   __main__)r   NN)r   __name__doctesttestmodr   r   r   r   <module>   s   
W