
    Ng                     F    	 ddZ edk    rd dlZ ej                     dS dS )    Nc                    | |v r||          S ||J ||J |]i }i }|                                 D ]D\  }}|                    d          r|D ]}|||<   %|                    d          r
|D ]}|||<   E| \  }	}
dx}}|	                    d          r|	}d}	n|                    |	          }|
                    d          r|
}d}
n|                    |
          }|	|
f|	|f||
f||fg}|D ]} | |v r
||          c S |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pairss                 T/var/www/html/ai-engine/env/lib/python3.11/site-packages/fontTools/ufoLib/kerning.pylookupKerningValuer      s   T wt}$!---% ,,, #)<<>> 	6 	6E<00 6) 5 5E/4%e,,5!!/22 6) 6 6E05&u--ME6##J(( 2
&**511
)) 5(,,V44 
		V	[!	E  ! !7??4=     O    __main__)r   NN)r   __name__doctesttestmod r   r   <module>r      sU   RVT T T Tn zNNNGO r   