� ��g����dZddlmZddlmZmZmZddlZddl m Z m Z m Z m Z ddlmZmZmZddlmZdd�Zdd�Zdd�Zdd�Zd d�ZdS)!zFExtra methods for DesignSpaceDocument to generate its STAT table data.�)� annotations)�Dict�List�UnionN)�AxisLabelDescriptor�DesignSpaceDocument�DesignSpaceDocumentError�LocationLabelDescriptor)�Region�getVFUserRegion�locationInRegion)�TTFont�ttFontr�docr�vfName�str�return�Nonec��|���D]}|j|krn�td|�����t||��}t d�t |�d��dd��D����}tjj � |t||��t||��|j �|j nd|���S) a�Build the STAT table for the variable font identified by its name in the given document. Knowing which variable we're building STAT data for is needed to subset the STAT locations to only include what the variable font actually ships. .. versionadded:: 5.0 .. seealso:: - :func:`getStatAxes()` - :func:`getStatLocations()` - :func:`fontTools.otlLib.builder.buildStatTable()` z&Cannot find the variable font by name c3�,K�|]}|jdkV��dS)�N)� platformID)�.0�nrs �e/home/asafur/pinokio/api/open-webui.git/app/env/lib/python3.11/site-packages/fontTools/varLib/stat.py� <genexpr>z#buildVFStatTable.<locals>.<genexpr>,s:������!�� ����������name�names�N�)�macNames)�getVariableFontsrr r �any�getattr�get� fontTools�otlLib�builder�buildStatTable� getStatAxes�getStatLocations�elidedFallbackName)rrr�vf�regionr"s r�buildVFStatTabler0s���"�"�$�$� � �� �7�f� � � �E� �'� =�V� =� =� � � ��S�"� %� %�F����%,�V�Z�Z��-?�-?��"�%M�%M������H� � � #� 2� 2���C�� � ���f�%�%�"%�"8�"D����!�� 3� � �r� userRegionr � List[Dict]c���td�|jD��d���}g}|jD]>}|j�|�|j���$|dz }|�|���?�fd�t |j|��D��S)z�Return a list of axis dicts suitable for use as the ``axes`` argument to :func:`fontTools.otlLib.builder.buildStatTable()`. .. versionadded:: 5.0 c3�2K�|]}|j� |jV��dS)N)� axisOrdering�r�axiss rrzgetStatAxes.<locals>.<genexpr>Bs-����Q�Q�t�4�3D�3P�� �3P�3P�3P�3P�Q�Qr�����)�defaultNrc ����g|]=\�}t�jd�ji�j�|��fd��jD�������>S)�enc�f��g|]-}t�j|ji����t|����.Sr )r r� userValue�_axisLabelToStatLocation)r�labelr7r1s ��r� <listcomp>z*getStatAxes.<locals>.<listcomp>.<listcomp>QsJ�������#�T�Y���$@�*�M�M��(��/�/���r)�tagr�ordering�values)�dictrAr� labelNames� axisLabels)rrBr7r1s @�rr@zgetStatAxes.<locals>.<listcomp>Ls����� � � � �D�(� ����� �5�T�_�5�������!�_���� � � � � � r)�max�axesr5�append�zip)rr1� maxOrdering� axisOrderingsr7s ` rr+r+9s�����Q�Q�s�x�Q�Q�Q�����K��M���.�.�� � � (� � � ��!2� 3� 3� 3� 3� �1� �K� � � �� -� -� -� -� � � � �"�#�(�M�:�:� � � � rc�T����d��jD������fd��jD��S)z�Return a list of location dicts suitable for use as the ``locations`` argument to :func:`fontTools.otlLib.builder.buildStatTable()`. .. versionadded:: 5.0 c��i|] }|j|�� Sr )rr6s r� <dictcomp>z$getStatLocations.<locals>.<dictcomp>as��7�7�7�d�$�)�T�7�7�7rc ���g|]�}t|��������%td|ji|j��fd�|�������D��t |��������S)r;c�2��i|]\}}�|j|��Sr )rA)rr�value� axesByNames �rrOz/getStatLocations.<locals>.<listcomp>.<dictcomp>gs7�������D�%��4� �$�e���r)r�location�flags)r �getFullUserLocationrDrrE�items� _labelToFlags)rr?rSrr1s ���rr@z$getStatLocations.<locals>.<listcomp>bs���� � � � � �E�5�5�c�:�:�J� G� G� � ��� �7�e�&6�7�����#(�#<�#<�S�#A�#A�#G�#G�#I�#I���� ��&�&� � � � � � r)rH�locationLabels)rr1rSs``@rr,r,[sV����� 8�7�c�h�7�7�7�J� � � � � � ��'� � � � rr?�3Union[AxisLabelDescriptor, LocationLabelDescriptor]�intc�:�d}|jr|dz}|jr|dz}|S)Nrrr!)� olderSibling�elidable)r?rUs rrXrXrs3�� �E� ��� �� �� �~�� �� �� �Lrrrc��|���}d|ji|j�}t|��}|dkrt ||j|���S|dkrt ||j|j|���S|dkr;t ||j|���}|j� |j|d<|j� |j|d <|Std ���) Nr;r)rrRrU�)rrR� linkedValuerUr!)r� nominalValuerU� rangeMinValue� rangeMaxValuezUnknown STAT label format) � getFormatrrErXrDr=�linkedUserValue� userMinimum� userMaximum�NotImplementedError)r?� label_formatrrU�ress rr>r>{s����?�?�$�$�L� �%�*� 1�� 0� 1�D� �%� � �E��q�����U�_�E�B�B�B�B��q������/��-��  � � � � �q�������� � � �� � � (�#(�#4�C�� � � � (�#(�#4�C�� �� � �9� :� :�:r)rrrrrrrr)rrr1r rr2)r?rZrr[)r?rrr)�__doc__� __future__r�typingrrr�fontTools.otlLib.builderr'�fontTools.designspaceLibrrr r �fontTools.designspaceLib.typesr r r �fontTools.ttLibrr0r+r,rXr>r rr�<module>rss&��L�L�"�"�"�"�"�"�$�$�$�$�$�$�$�$�$�$����������������� U�T�T�T�T�T�T�T�T�T�"�"�"�"�"�"�$�$�$�$�N����D����.����;�;�;�;�;�;r
Memory