� ��gm#����dZddlmZddlmZddlmZmZmZm Z ddl Z ddl m Z m Z mZmZmZmZmZe je��ZeZddd d d �ZeGd �d ����Zdd�Zdd�Zdd�Zd d�ZdS)!a-Compute name information for a given location in user-space coordinates using STAT data. This can be used to fill-in automatically the names of an instance: .. code:: python instance = doc.instances[0] names = getStatNames(doc, instance.getFullUserLocation(doc)) print(names.styleNames) �)� annotations)� dataclass)�Dict�Optional�Tuple�UnionN)�AxisDescriptor�AxisLabelDescriptor�DesignSpaceDocument�DesignSpaceDocumentError�DiscreteAxisDescriptor�SimpleLocationDict�SourceDescriptor�regular�italic�boldz bold italic))FF)FT)TF)TTc�F�eZdZUdZded<ded<ded<ded<ded <d S) � StatNamesz4Name data generated from the STAT table information.zDict[str, str]� familyNames� styleNamesz Optional[str]�postScriptFontName�styleMapFamilyNameszOptional[RibbiStyle]�styleMapStyleNameN)�__name__� __module__� __qualname__�__doc__�__annotations__���r/home/asafur/pinokio/api/open-webui.git/app/env/lib/python3.11/site-packages/fontTools/designspaceLib/statNames.pyrr)sT�������>�>���������%�%�%�%�'�'�'�'�+�+�+�+�+�+r r�docr � userLocationr�returnc�P��i}|���}|�t�d��n2|j�t�d��nd|ji|j�}i}|�|��}|�d|ji|j�}n�t|j |��}|ritd�|D����}|� d��|D]8�d� �fd�|D����}|s|j �|j }||�<�9d|vsd|vrt||did���S|d�d |d���dd ��} t!||��\} } |} | |krt#|| ��} | j} i}t|���|�����D]W�|��|d��}| ��| d��}|dz|z���|�<�Xt||| || ���S) aqCompute the family, style, PostScript names of the given ``userLocation`` using the document's STAT information. Also computes localizations. If not enough STAT data is available for a given name, either its dict of localized names will be empty (family and style names), or the name will be None (PostScript name). .. versionadded:: 5.0 Nz7Cannot determine default source to look up family name.zTCannot look up family name, assign the 'familyname' attribute to the default source.�enc3�.K�|]}|jD]}|V���dS�N)� labelNames��.0�label�languages r!� <genexpr>zgetStatNames.<locals>.<genexpr>\sJ������"�U�=M���19��������r � c3�f�K�|]+}|j� |j��|j��V��,dSr()�elidabler)�get� defaultNamer*s �r!r.zgetStatNames.<locals>.<genexpr>asU�����%�%�� �>�%��$�(�(��5�3D�E�E�%�%�%�%�%�%r )rrrrr�-�)� findDefault�LOGGER�warning� familyName�localisedFamilyName�labelForUserLocation�namer)�_getAxisLabelsForUserLocation�axes�set�add�join�elidedFallbackNamer�replace�_getRibbiStyle� getStatNamesr�union�keysr2�strip)r"r#r� defaultSourcerr,�labels� languages� styleNamerr�regularUserLocation�styleNamesForStyleMap�regularStatNamesrr9r-s @r!rErE4s����#%�K�03���0A�0A�M������P�Q�Q�Q�Q� � !� )���� b� � � � � �-�*� ��/� � � "$�J� � $� $�\� 2� 2�E� ���E�J�;�%�*:�;� � � /�s�x��F�F�� � 1����&,������I� �M�M�$� � � �%� 1� 1���H�H�%�%�%�%�!'�%�%�%��� � !�7�S�%;�%G� #� 6�I�'0� �8�$�$� �;���$�j�"8�"8��#�!�#� "�"�  � � � �(��-�B�B� �4�0@�B�B�J�J�3�PR�S�S��-;�C��-N�-N�*��*�&���l�*�*�'��-@�A�A�� 0� ;����� �$�$�*�*�:�?�?�+<�+<�=�=�O�O�� �_�_�X�{�4�/@�A�A� �)�-�-�h�8M�d�8S�T�T� �)3�c�)9�I�)E�(L�(L�(N�(N��H�%�%� ���-�/�+�  � � �r r>�3list[Union[AxisDescriptor, DiscreteAxisDescriptor]]�$Dict[str, list[AxisLabelDescriptor]]c��td�|D��d����}d�|D��}|D]}|j�|j||j<�|S)zbReturns axis labels sorted by their ordering, with unordered ones appended as they are listed.c3�(K�|] }|j� |V��dSr(�� axisOrdering�r+�axiss r!r.z'_getSortedAxisLabels.<locals>.<genexpr>�s*����@�@�$�$�"3�"?��"?�"?�"?�"?�@�@r c��|jSr(rT)�as r!�<lambda>z&_getSortedAxisLabels.<locals>.<lambda>�s��a�n�r )�keyc�(�i|]}|j|j��Sr)r<� axisLabelsrVs r!� <dictcomp>z(_getSortedAxisLabels.<locals>.<dictcomp>�s+��:�:�:�'+�� �4�?�:�:�:r )�sortedrUr]r<)r>� sortedAxes� sortedLabelsrWs r!�_getSortedAxisLabelsrb�s|���@�@�$�@�@�@� $� $����J�:�:�/9�:�:�:�L� �6�6�� � � $�&*�o�L��� #�� �r �list[AxisLabelDescriptor]c����g}t|��}|���|���krEt�d|����d|����d���|���D]b\}}||�t �fd�|D��d��}|�"t�d|�d��d����M|�|���c|S)Nz Mismatch between user location 'z' and available labels for 'z'.c3��K�|]9}|j�ks(|j�%|j�|j�cxkr |jk�2nn|V��:dSr()� userValue� userMinimum� userMaximum)r+�lrfs �r!r.z0_getAxisLabelsForUserLocation.<locals>.<genexpr>�su����� � ���;�)�+�+��M�-�� �1�� ��C�C�C�C�a�m�C�C�C�C�C� � D�C�C�C� � r z!Document needs a label for axis 'z', user value ')rbrGr7r8�items�next�debug�append)r>r#rJ� allAxisLabels�axisNamer]r,rfs @r!r=r=�sE���)+�F�(��.�.�M������|�0�0�2�2�2�2���� 4�|�/@�/@�/B�/B� 4� 4�(�-�-�/�/� 4� 4� 4� � � � !.� 3� 3� 5� 5�!�!���*� ��*� �/3� � � � �#� � � � � 0 � 0 �� �=� �L�L�Z�H�Z�Z�Y�Z�Z�Z� � � � � �M�M�%� � � � � �Mr �self�%Tuple[RibbiStyle, SimpleLocationDict]c� �i}d�|jD��}d}d}|�d��}|�C|jD];}|j||jkr#|j|jkr|j||j<d}n�<|�d��p|�d��}|�]|jD]U}|j||jkr=t |j��t |j��kr|j||j<d}n�Vt||fi|�|�fS)z�Compute the RIBBI style name of the given user location, return the location of the matching Regular in the RIBBI group. .. versionadded:: 5.0 c��i|] }|j|�� Sr)�tagrVs r!r^z"_getRibbiStyle.<locals>.<dictcomp>�s��8�8�8�d�4�8�T�8�8�8r F�wghtNT�ital�slnt)r>r2r]�linkedUserValuer<rf�abs�BOLD_ITALIC_TO_RIBBI_STYLE) rpr#rM� axes_by_tagrrrW� regular_label� upright_labels r!rDrD�sK����8�8�d�i�8�8�8�K��D��F� �?�?�6� "� "�D� ��!�_� � �M��-��d�i�1H�H�H� "�+�m�.K�K�K�1>�1H�#�D�I�.������ �?�?�6� "� "� =�k�o�o�f�&=�&=�D� ��!�_� � �M��-��d�i�1H�H�H�� �/�0�0�3�}�7T�3U�3U�U�U�1>�1H�#�D�I�.������ %�d�F�l� 3�6� �6� �6� �r )r"r r#rr$r)r>rPr$rQ)r>rPr#rr$rc)rpr r#rr$rq)r� __future__r� dataclassesr�typingrrrr�logging�fontTools.designspaceLibr r r r r rr� getLoggerrr7�str� RibbiStylerzrrErbr=rDrr r!�<module>r�s��� � �#�"�"�"�"�"�!�!�!�!�!�!�/�/�/�/�/�/�/�/�/�/�/�/����������������������� �� �8� $� $��� ����� ��� �,�,�,�,�,�,�,� ��,�U�U�U�U�p����0#�#�#�#�L3�3�3�3�3�3r
Memory