� ��g��� ��ddlmZmZddlZddlZddlmZddlmZddl m Z ddl m Z ddlmZmZmZmZmZddl mZdd lmZdd lmZmZdd lmZdd lmZddlZddlZej e!��Z"d �Z#dZ$dZ%dZ&dZ'dZ(dod�Z)Gd�de*��Z+Gd�de+��Z,Gd�dedgd�����Z-Gd�d��Z.Gd�de+��Z/Gd�d e/��Z0Gd!�d"e/��Z1Gd#�d$e+��Z2Gd%�d&e+��Z3Gd'�d(e+��Z4Gd)�d*e+��Z5Gd+�d,e+��Z6Gd-�d.e+��Z7Gd/�d0e+��Z8Gd1�d2e+��Z9Gd3�d4e*��Z:Gd5�d6e+��Z;Gd7�d8e+��Z<d9�Z=d:�Z>d;�Z?d<�Z@dpd=�ZAd>�ZBd?�ZCd@�ZDdA�ZEdB�ZFdC�ZGdD�ZHdE�ZIdF�ZJdG�ZKdH�ZLdI�ZMdJ�ZNdK�ZOdL�ZPdqdM�ZQdN�ZRdqdO�ZSdP�ZTdQ�ZUdR�ZVdS�ZWedTdU��ZXdV�ZYdW�ZZdX�Z[dY�Z\dZ�Z]d[�Z^d\�Z_d]�Z`d^�Zad_�ZbGd`�dae*��Zcedbd��Zdedcd��Ze drde�Zfdsdf�Zgdsdg�Zhdtdh�Zi dudi�Zjdj�Zkdk�Zldl�Zmdm�Zndn�ZodS)v�)� namedtuple� OrderedDictN)� fixedToFloat)�otRound)�ttLib)�otTables)� ValueRecord�valueRecordFormatDict�OTLOffsetOverflowError� OTTableWriter�CountReference)�otBase)�STATNameStatement)�_compression_level_from_env�compact_lookup)�OpenTypeLibError)�reducec���|sdStj��} tt|��|j���|_n&#t $r}td|�d���|�d}~wwxYw|S)a Builds a coverage table. Coverage tables (as defined in the `OpenType spec <https://docs.microsoft.com/en-gb/typography/opentype/spec/chapter2#coverage-table>`__) are used in all OpenType Layout lookups apart from the Extension type, and define the glyphs involved in a layout subtable. This allows shaping engines to compare the glyph stream with the coverage table and quickly determine whether a subtable should be involved in a shaping operation. This function takes a list of glyphs and a glyphname-to-ID map, and returns a ``Coverage`` object representing the coverage table. Example:: glyphMap = font.getReverseGlyphMap() glyphs = [ "A", "B", "C" ] coverage = buildCoverage(glyphs, glyphMap) Args: glyphs: a sequence of glyph names. glyphMap: a glyph name to ID map, typically returned from ``font.getReverseGlyphMap()``. Returns: An ``otTables.Coverage`` object or ``None`` if there are no glyphs supplied. N��keyzCould not find glyph z in font)�ot�Coverage�sorted�set� __getitem__�glyphs�KeyError� ValueError)r�glyphMap�self�es �h/home/asafur/pinokio/api/open-webui.git/app/env/lib/python3.11/site-packages/fontTools/otlLib/builder.py� buildCoverager#s���8 ���t� �;�=�=�D�E��S��[�[�h�.B�C�C�C�� � �� �E�E�E��<��<�<�<�=�=�1�D�����E���� �Ks�(A� A%� A � A%�����c�����dSd��D����sdSt�fd��D����s$Jdtd��D����z���tj��}�dj|_||_�|_t|j��|_|�<|xjtzc_t|t��s J|���||_ n |jtzdks Jd|z���|S)aTurns a collection of rules into a lookup. A Lookup (as defined in the `OpenType Spec <https://docs.microsoft.com/en-gb/typography/opentype/spec/chapter2#lookupTbl>`__) wraps the individual rules in a layout operation (substitution or positioning) in a data structure expressing their overall lookup type - for example, single substitution, mark-to-base attachment, and so on - as well as the lookup flags and any mark filtering sets. You may import the following constants to express lookup flags: - ``LOOKUP_FLAG_RIGHT_TO_LEFT`` - ``LOOKUP_FLAG_IGNORE_BASE_GLYPHS`` - ``LOOKUP_FLAG_IGNORE_LIGATURES`` - ``LOOKUP_FLAG_IGNORE_MARKS`` - ``LOOKUP_FLAG_USE_MARK_FILTERING_SET`` Args: subtables: A list of layout subtable objects (e.g. ``MultipleSubst``, ``PairPos``, etc.) or ``None``. flags (int): This lookup's flags. markFilterSet: Either ``None`` if no mark filtering set is used, or an integer representing the filtering set to be used for this lookup. If a mark filtering set is provided, `LOOKUP_FLAG_USE_MARK_FILTERING_SET` will be set on the lookup's flags. Returns: An ``otTables.Lookup`` object or ``None`` if there are no subtables supplied. Nc��g|]}|�|��S�N�)�.0�sts r"� <listcomp>zbuildLookup.<locals>.<listcomp>ls��:�:�:��2�>��>�>�>�c3�D�K�|]}|j�djkV��dS�rN�� LookupType)r-�t� subtabless �r"� <genexpr>zbuildLookup.<locals>.<genexpr>osB�������45�� � �!� �/�/������r0z3all subtables must have the same LookupType; got %sc��g|] }|j�� Sr,r3)r-r5s r"r/zbuildLookup.<locals>.<listcomp>rs��)�)�)�!���)�)�)r0rz]if markFilterSet is None, flags must not set LOOKUP_FLAG_USE_MARK_FILTERING_SET; flags=0x%04x) �all�reprr�Lookupr4� LookupFlag�SubTable�len� SubTableCount�"LOOKUP_FLAG_USE_MARK_FILTERING_SET� isinstance�int�MarkFilteringSet)r6�flags� markFilterSetr s` r"� buildLookuprFLsU���<���t�:�:�i�:�:�:�I� ���t� �����9B���� � ���<�t�)�)�y�)�)�)�@�@���� � �9�;�;�D���l�-�D�O��D�O��D�M��T�]�+�+�D��� � ���=�=����-��-�-�<�<�}�<�<�-� -������"D�D��J�J�J� ?�AF� G�K�J�J� �Kr0c�Z�eZdZdZd�Zd�Zd�Zd�Zd�Zd�Z d�Z d �Z d �Z d �Z d �Zd �ZdS)� LookupBuilder�SUBTABLE_BREAKc��||_|���|_||_||c|_|_d|_d|_d|_|dvsJ�dS)Nr)�GPOS�GSUB) �font�getReverseGlyphMapr�location�table� lookup_type� lookupflagrE� lookup_index)r rMrOrPrQs r"�__init__zLookupBuilder.__init__�sc���� ��/�/�1�1�� � �� �',�k�$�� �D�$����!��� ����(�(�(�(�(�(�(r0c��t||j��o/|j|jko|j|jko|j|jkSr+)rA� __class__rPrRrE�r �others r"�equalszLookupBuilder.equals�sN�� �u�d�n� -� -� :�� �e�k�)� :���5�#3�3� :��"�e�&9�9�  r0c��iS)z?Infers glyph glasses for the GDEF table, such as {"cedilla":3}.r,�r s r"�inferGlyphClasseszLookupBuilder.inferGlyphClasses����� r0c��iS)z$Helper for building 'aalt' features.r,r[s r"�getAlternateGlyphsz LookupBuilder.getAlternateGlyphs�r]r0c�8�t||j|j��Sr+)rFrRrE�r r6s r"� buildLookup_zLookupBuilder.buildLookup_�s���9�d�o�t�7I�J�J�Jr0c��i}t|���|jj���D]#}||\}}||vrt |��||<�$|S)a{"cedilla": ("BOTTOM", ast.Anchor), ...} --> {"BOTTOM":0, "TOP":1} Helper for MarkBasePostBuilder, MarkLigPosBuilder, and MarkMarkPosBuilder. Seems to return the same numeric IDs for mark classes as the AFDKO makeotf tool. r)r�keysrM� getGlyphIDr>)r �marks�ids�mark� markClassName� _markAnchors r"�buildMarkClasses_zLookupBuilder.buildMarkClasses_�sa�����5�:�:�<�<�T�Y�-A�B�B�B� .� .�D�).�t�� &�M�;��C�'�'�%(��X�X��M�"��� r0c��t|��|_g|_t|��D]1}t ||j��}|j�|���2dSr+)r>�BacktrackGlyphCount�BacktrackCoverage�reversedr#r�append)r �prefix�subtable�p�coverages r"�setBacktrackCoverage_z#LookupBuilder.setBacktrackCoverage_�sd��'*�6�{�{��$�%'��"��&�!�!� 8� 8�A�$�Q�� �6�6�H� � &� -� -�h� 7� 7� 7� 7� 8� 8r0c��t|��|_g|_|D]1}t||j��}|j�|���2dSr+)r>�LookAheadGlyphCount�LookAheadCoverager#rrp)r �suffixrr�srts r"�setLookAheadCoverage_z#LookupBuilder.setLookAheadCoverage_�s\��'*�6�{�{��$�%'��"�� 8� 8�A�$�Q�� �6�6�H� � &� -� -�h� 7� 7� 7� 7� 8� 8r0c��t|��|_g|_|D]1}t||j��}|j�|���2dSr+)r>�InputGlyphCount� InputCoverager#rrp�r rrr�grts r"�setInputCoverage_zLookupBuilder.setInputCoverage_�s\��#&�v�;�;�� �!#���� 4� 4�A�$�Q�� �6�6�H� � "� )� )�(� 3� 3� 3� 3� 4� 4r0c��t|��|_g|_|D]1}t||j��}|j�|���2dSr+)r>� GlyphCountrr#rrprs r"� setCoverage_zLookupBuilder.setCoverage_�s\��!�&�k�k������� /� /�A�$�Q�� �6�6�H� � � $� $�X� .� .� .� .� /� /r0c���ig}|D]:}|d|jkr|�i���)|||d|<�;�fd�|D��}|S)Nr�����c�&��g|] }�|����Sr,r,)r-rz�klasss �r"r/z7LookupBuilder.build_subst_subtables.<locals>.<listcomp>�s!���5�5�5�!�U�U�1�X�X�5�5�5r0)�SUBTABLE_BREAK_rp)r �mappingr�� substitutionsrr6s ` r"�build_subst_subtablesz#LookupBuilder.build_subst_subtables�sw����� �� 6� 6�C��1�v��-�-�-��$�$�R�(�(�(�(�)0��� �b�!�#�&�&�5�5�5�5�}�5�5�5� ��r0c�V�t�td|����dS)z�Add an explicit subtable break. Args: location: A string or tuple representing the location in the original source which produced this break, or ``None`` if no location is provided. z0unsupported "subtable" statement for lookup typeN)�log�warningr�r rOs r"�add_subtable_breakz LookupBuilder.add_subtable_break�s6�� � � � �B�H� � � � � � � r0N)�__name__� __module__� __qualname__r�rTrYr\r_rbrkrur{r�r�r�r�r,r0r"rHrH�s�������&�O�)�)�)� � � �������K�K�K� � � �8�8�8�8�8�8�4�4�4�/�/�/����  �  �  �  �  r0rHc�0�eZdZdZd�Zd�Zd�Zd�Zd�ZdS)�AlternateSubstBuildera�Builds an Alternate Substitution (GSUB3) lookup. Users are expected to manually add alternate glyph substitutions to the ``alternates`` attribute after the object has been initialized, e.g.:: builder.alternates["A"] = ["A.alt1", "A.alt2"] Attributes: font (``fontTools.TTLib.TTFont``): A font object. location: A string or tuple representing the location in the original source which produced this lookup. alternates: An ordered dictionary of alternates, mapping glyph names to a list of names of alternates. lookupflag (int): The lookup's flag markFilterSet: Either ``None`` if no mark filtering set is used, or an integer representing the filtering set to be used for this lookup. If a mark filtering set is provided, `LOOKUP_FLAG_USE_MARK_FILTERING_SET` will be set on the lookup's flags. c�h�t�|||dd��t��|_dS)NrL�)rHrTr� alternates�r rMrOs r"rTzAlternateSubstBuilder.__init__�s-�����t�T�8�V�Q�?�?�?�%�-�-����r0c�X�t�||��o|j|jkSr+)rHrYr�rWs r"rYzAlternateSubstBuilder.equalss'���#�#�D�%�0�0�X�T�_��HX�5X�Xr0c�l�|�|jt��}|�|��S)z�Build the lookup. Returns: An ``otTables.Lookup`` object representing the alternate substitution lookup. )r�r��buildAlternateSubstSubtablerbras r"�buildzAlternateSubstBuilder.builds7���.�.� �O�8� � � �� � ��+�+�+r0c��|jSr+)r�r[s r"r_z(AlternateSubstBuilder.getAlternateGlyphss ����r0c�2�|j|j|j|f<dSr+)r�r�r�s r"r�z(AlternateSubstBuilder.add_subtable_breaks��<@�<P����-�x�8�9�9�9r0N� r�r�r��__doc__rTrYr�r_r�r,r0r"r�r��sq��������,(�(�(�Y�Y�Y� ,� ,� ,����Q�Q�Q�Q�Qr0r�c�$�eZdZed���ZdS)�ChainContextualRulec�,�|jtjkSr+)rqrHr�r[s r"�is_subtable_breakz%ChainContextualRule.is_subtable_breaks���{�m�;�;�;r0N)r�r�r��propertyr�r,r0r"r�r�s/�������<�<��X�<�<�<r0r�)rqrry�lookupsc�R�eZdZd�Zd�Zed���Zed���Zd�Zd�Z dS)�ChainContextualRulesetc��g|_dSr+)�rulesr[s r"rTzChainContextualRuleset.__init__"s ���� � � r0c�:�|j�|��dSr+)r�rp�r �rules r"�addRulezChainContextualRuleset.addRule%s�� � ���$�����r0c��|jD]5}t|j��dkst|j��dkrdS�6dS)NrTF)r�r>rqryr�s r"�hasPrefixOrSuffixz(ChainContextualRuleset.hasPrefixOrSuffix(sO���J� � �D��4�;���!�#�#�s�4�;�'7�'7�!�';�';��t�t�(<��ur0c��|jD]6}|j|j|jfD]}t d�|D����rdS� �7dS)Nc3�<K�|]}t|��dkV��dS)r$N�r>�r-�xs r"r7z<ChainContextualRuleset.hasAnyGlyphClasses.<locals>.<genexpr>7s,����4�4�a�s�1�v�v��z�4�4�4�4�4�4r0TF)r�rqrry�any)r r�rts r"�hasAnyGlyphClassesz)ChainContextualRuleset.hasAnyGlyphClasses1sj���J� � �D�!�[�$�+�t�{�C� � ���4�4�8�4�4�4�4�4� ��4�4�4� � ��ur0c���d\}}}g}|||fD]X}g}|jD]}|�||���|�|��}|sdS|�|���Y|S)N)rr$r%)r�rp�_classBuilderForContext) r �PREFIX�GLYPHS�SUFFIX�classDefBuilders�ix�context�r�classess r"�format2ClassDefsz'ChainContextualRuleset.format2ClassDefs;s���!(��������6�6�*� -� -�B��G��Z� &� &�����q��u�%�%�%�%��2�2�7�;�;�G�� ��t�t� � #� #�G� ,� ,� ,� ,��r0c��td���}|D]D}|D]?}t|��}|�|��sdS|�|���@�E|S)NF�� useClass0)�ClassDefBuilderr�canAdd�add)r r��classdefbuilder�position�glyphsetrs r"r�z.ChainContextualRuleset._classBuilderForContextHs~��)�E�:�:�:��� ,� ,�H�$� ,� ,���X����&�-�-�f�5�5� ��4�4�4��#�#�F�+�+�+�+�  ,� �r0N) r�r�r�rTr�r�r�r�r�r�r,r0r"r�r�!s���������� � � �����X������X��  �  �  �����r0r�c��eZdZd�Zd�Zd�Zd�Zdd�Zdd�Zdd�Z d �Z d �Z dd �Z dd �Z dd�Zdd�Zdd�Z dd�Zd�ZdS)�ChainContextualBuilderc�X�t�||��o|j|jkSr+�rHrYr�rWs r"rYzChainContextualBuilder.equalsT�&���#�#�D�%�0�0�N�T�Z�5�;�5N�Nr0c���t��g}|jD]F}|jr"|�t�����+|d�|���Gd�|D��S)Nr�c�B�g|]}t|j��dk�|��S�r)r>r�r�s r"r/z3ChainContextualBuilder.rulesets.<locals>.<listcomp>as*��7�7�7�a�c�!�'�l�l�Q�&6�&6��&6�&6�&6r0)r�r�r�rpr�)r �rulesetr�s r"�rulesetszChainContextualBuilder.rulesetsWsy��*�+�+�,���J� &� &�D��%� ����5�7�7�8�8�8�� �B�K� � �� %� %� %� %�7�7�7�7�7�7�7r0c���|sdS|�tj|����}t��}|�||j��t |�����}|S�Nr)rb�copy�deepcopyr �compilerMr>� getAllData)r r6rP�w�sizes r"�getCompiledSize_z'ChainContextualBuilder.getCompiledSize_csg��� ��1��!�!�$�-� �":�":�;�;�� �O�O�� � � �a���#�#�#��1�<�<�>�>�"�"��� r0c ��g}|���}td�|D����}|jj�d��}|s |jdkrd}|D�]g}dddgg}|jD]1}|d�|�||�����2|� ��}|r|� |||��g|d<|j s|� ||��g|d<g} d D]�} || r� |� || ��} | �| || f���D#t$r<} t�d | t#|j��| fz��Yd} ~ ��d} ~ wwxYw��| st'd |j���t)| d �� ��\} }|�|����i|�|��S)z�Build the lookup. Returns: An ``otTables.Lookup`` object representing the chained contextual positioning lookup. c3�$K�|] }|jV�� dSr+)r�)r-r�s r"r7z/ChainContextualBuilder.build.<locals>.<genexpr>xs%����I�I�W�w�0�I�I�I�I�I�Ir0z$fontTools.otlLib.builder:WRITE_GPOS7�PosTNr�r%r$)r$r%r�z*Contextual format %i at %s overflowed (%s)zAll candidates overflowedc��|dSr�r,)r�s r"�<lambda>z.ChainContextualBuilder.build.<locals>.<lambda>�s ��a��d�r0r)r�r�rM�cfg�get� subtable_typer�rp�buildFormat3Subtabler��buildFormat2Subtabler��buildFormat1Subtabler�r r�r��strrOr�min�extendrb)r r6r��chaining� write_gpos7r�� candidatesr�� classdefs�candidates_by_size�ir�r!� _min_size�winners r"r�zChainContextualBuilder.buildnsb��� ��=�=�?�?���I�I��I�I�I�I�I���i�m�'�'�(N�O�O� �� �t�1�U�:�:��H��' %�' %�G���d�B�/�J�� � P� P���1� �$�$�T�%>�%>�t�X�%N�%N�O�O�O�O� �0�0�2�2�I�� ��-�-�g�y�(�K�K�!� �1� ��-� O�!%�!:�!:�7�H�!M�!M� N� �1� �!#� �� I� I���a�=� I�I�#�4�4�Z��]�C�C��+�1�1�4��A��2G�H�H�H�H�� 2����� � �H� �#�d�m�"4�"4�a�8�9����������������� I�&� S�&�'B�D�M�R�R�R� #�$6�N�N� K� K� K� �I�v� � � �V� $� $� $� $�� � ��+�+�+s�D<�< F�2E=�=FTc �8�|�|���}d|_|���t��}i}|�d|���}|jD�]G}|�d|���}|r�t|j��|_ t|j ��|_ d�t|j��D��|_ d�|j D��|_t|j��|_nt|j��|_d�|jdd�D��|_|�||��t)|jd��d} | |vr|�| ��g|| <|| �|����It/||j��|_g} |jjD]l} |�d|���} t7| ||| ��t7| |�d�t|| ����| �| ���mt7||�d|���| ��t7||�d|���dzt| ����|S) N�r�r$��formatr�c�8�g|]}t|��d��Sr���listr�s r"r/z?ChainContextualBuilder.buildFormat1Subtable.<locals>.<listcomp>�s"��+V�+V�+V�1�D��G�G�A�J�+V�+V�+Vr0c�8�g|]}t|��d��Sr�r�r�s r"r/z?ChainContextualBuilder.buildFormat1Subtable.<locals>.<listcomp>�s"��+L�+L�+L�1�D��G�G�A�J�+L�+L�+Lr0c�8�g|]}t|��d��Sr�r�r�s r"r/z?ChainContextualBuilder.buildFormat1Subtable.<locals>.<listcomp>�s"��#H�#H�#H�1�D��G�G�A�J�#H�#H�#Hr0r�Count)� newSubtable_�Format�populateDefaultsr� ruleAttr_r��newRule_r>rqrmryrwro� Backtrack� LookAheadrr}r��Input�buildLookupListr�r�rpr#rr� newRuleSet_�setattr� ruleSetAttr_) r r�r�r.rt�rulesetsByFirstGlyph�ruleAttrr��ruleAsSubtable� firstGlyph�ruleSetsr��ruleSets r"r�z+ChainContextualBuilder.buildFormat1Subtable�s��� � � �� � 1� 1���� � �������5�5��!���>�>��X�>�>�>���M� D� D�D�!�]�]�!�h�]�G�G�N�� =�58���5E�5E��2�58���5E�5E��2�+V�+V����@U�@U�+V�+V�+V��(�+L�+L�� �+L�+L�+L��(�14�T�[�1A�1A��.�.�,/�� �,<�,<��)�#H�#H�� �A�B�B��#H�#H�#H�N� � � � ��~� 6� 6� 6��d�k�!�n�-�-�a�0�J��!5�5�5�� � �Z�(�(�(�35�$�Z�0� �� ,� 3� 3�N� C� C� C� C�#�H�d�m�<�<�� �����#� %� %�A��&�&�a�(�&�C�C�G� �G�X�';�A�'>� ?� ?� ?� �G��/�/�/��5I�!�5L�1M�1M� N� N� N� �O�O�G� $� $� $� $���D�%�%�Q��%�B�B�H�M�M�M�� ��!�!��X�!�>�>��H�#�h�-�-� � � �� r0c ����|�|����d�_����|r d�|D��\�_�_�_n|d����_|d���}g}|D].}|� d|���}|� |���/t��}|� d|���} |j D�]�} |�d|���} |r�t| j��| _t| j��| _�fd�t)| j��D��| _�fd�| jD��| _t| j��| _�fd�| jdd�D��| _|�jjt7| jd ��d } not| j��| _�fd �| jdd�D��| _|�jjt7| jd ��d } |�| | ��|t| jd ��z}t?| | ��� | ��tA| | �d �t?| | �d ���dz�����tC|��D]\} }t?|| ��sd|| <�tA�|�"d|���|��tA�|�"d|���d zt|����tG||j$���_%�S) Nr�r%c�6�g|]}|�����Sr,)r��r-�cs r"r/z?ChainContextualBuilder.buildFormat2Subtable.<locals>.<listcomp>�s ��.�.�.�q������.�.�.r0r$r�c�Z��g|]'}�jjt|��d��(Sr�)�BacktrackClassDef� classDefsr��r-r�r.s �r"r/z?ChainContextualBuilder.buildFormat2Subtable.<locals>.<listcomp>s>���,�,�,���(�2�4��7�7�1�:�>�,�,�,r0c�Z��g|]'}�jjt|��d��(Sr�)�LookAheadClassDefrr�rs �r"r/z?ChainContextualBuilder.buildFormat2Subtable.<locals>.<listcomp>s;���,�,�,�CD�B�(�2�4��7�7�1�:�>�,�,�,r0c�Z��g|]'}�jjt|��d��(Sr�)� InputClassDefrr�rs �r"r/z?ChainContextualBuilder.buildFormat2Subtable.<locals>.<listcomp> s;���(�(�(�?@�B�$�.�t�A�w�w�q�z�:�(�(�(r0rc�Z��g|]'}�jjt|��d��(Sr�)�ClassDefrr�rs �r"r/z?ChainContextualBuilder.buildFormat2Subtable.<locals>.<listcomp>s:���(�(�(�:;�B�K�)�$�q�'�'�!�*�5�(�(�(r0r)&rrrrrrr�r r�r rprrr�rr>rqrmryrwrorrrr}rrr�r��Classr �getattrr � enumerater r#rr)r r�r�r�� inClasses� classSets�_�classSetrt� classRuleAttrr�r�setForThisRuler�r.s @r"r�z+ChainContextualBuilder.buildFormat2Subtable�s���� � � �� � 1� 1���� � ������ � /� /�.�I�.�.�.�  ��$�� ��$�$�$�A�,�,�,�.�.�B�K��a�L�(�(�*�*� �� �� '� '�A��'�'�q�8�'�D�D�H� � � �X� &� &� &� &��5�5�����a�(��C�C� ��M�( �( �D�!�]�]�!�h�]�G�G�N�� �58���5E�5E��2�58���5E�5E��2�,�,�,�,�%�d�k�2�2�,�,�,��(�,�,�,�,�HL� �,�,�,��(�25�T�[�1A�1A��.�(�(�(�(�DH�K�PQ�PR�PR�O�(�(�(��$�"+��$�.�t�D�K��N�/C�/C�A�/F�G�"���-0�� �,<�,<��)�(�(�(�(�?C�{�1�2�2��(�(�(��$�"+��K�)�$�t�{�1�~�*>�*>�q�*A�B�"�� � � ��~� 6� 6� 6� ��D�K��N�+�+� +�H� �N�M� 2� 2� 9� 9�.� I� I� I� �� �'�'�'���=�(?�(?�(?�@�@�1�D� � � � � %�Y�/�/� $� $�K�A�x��8�]�3�3� $�#� �!� ����D�%�%�Q��%�B�B�I�N�N�N�� ��!�!��X�!�>�>��H�#�i�.�.� � � �$�H�d�m�<�<�� �� r0c�J�|�|���}d|_|rR|�|j|��|�|j|��|�|j|��n|�|j|��|� ||��|S)Nr�r�) rrrurqr{ryr�rr�r )r r�r�r.s r"r�z+ChainContextualBuilder.buildFormat3Subtable/s��� � � �� � 1� 1���� � � /� � &� &�t�{�B� 7� 7� 7� � &� &�t�{�B� 7� 7� 7� � "� "�4�;�� 3� 3� 3� 3� � � �d�k�2� .� .� .� ���T�2�&�&�&�� r0c�<�t|j��D]�\}}|�t|t��s|g}|D]d}|j�3t|t ��rd}nd}t d|�d�|j���|�|��}||_ |j|_ �e��dS)N� substitution� positioningz2Missing index of the specified lookup, might be a z lookup) r#r�rAr�rS�ChainContextPosBuilderrrO�newLookupRecord_� SequenceIndex�LookupListIndex)r r�r.� sequenceIndex� lookupList�lrX�recs r"r z&ChainContextualBuilder.buildLookupList;s���)2�4�<�)@�)@� 9� 9� %�M�:��%�!�*�d�3�3�.�",��J�#� 9� 9�A��~�-�%�d�,B�C�C�2�$2�E�E�$1�E�.�A�27�A�A�A� �M���� �/�/��3�3�C�(5�C�%�*+�.�C�'�'��% 9� 9r0c��|j�t|j|j|j|jg����dSr+)r�rpr�r�r�s r"r�z)ChainContextualBuilder.add_subtable_breakPsN�� � ��� ��$��$��$��%�&�  � � � � � � r0c���d|j��}|rd|z}tt|����}t||j�d�d��t||j�d�g��|S)N�Context�Chainrr� LookupRecord)r�r"rr )r r�� subtablenamer.s r"rz#ChainContextualBuilder.newSubtable_Zs|��5��!3�5�5� � � 2�"�\�1�L� &�W�R�� &� &� (� (����t�)�0�0�0�!�4�4�4���t�)�7�7�7��<�<�<�� r0r$c�~�|dkrd}n|dkrd}nt|���|jdd��|�d�}|rd|z}|S) Nr$�Ruler%r!rr��Setr9��AssertionErrorr��r r�r�� formatTyper;s r"r z#ChainContextualBuilder.ruleSetAttr_msg�� �Q�;�;��J�J� �q�[�[� �J�J� ��,�,� ,��,�Q�q�S�1�B�:�B�B�B� � � 2�"�\�1�L��r0c�~�|dkrd}n|dkrd}nt|���|jdd��|�d�}|rd|z}|S) Nr$�r%r!rr�r=r9r?rAs r"rz ChainContextualBuilder.ruleAttr_ysg�� �Q�;�;��J�J� �q�[�[� �J�J� ��,�,� ,��,�Q�q�S�1�C�:�C�C�C� � � 2�"�\�1�L��r0c��tt|�||������}|���|Sr+)r"rr r�r r�r�r.s r"r z"ChainContextualBuilder.newRuleSet_�sM�� �W� ��!�!�&�(�3�3� � � � �� ������� r0c��tt|�||������}|���|Sr+)r"rrrrFs r"rzChainContextualBuilder.newRule_�sK�� �W� ����v�x�0�0� � � � �� ������� r0NFc��|r d|z}d|z}t||��s"t||d��t||g��|r|}ntt|����}t||t||��dz��|r%t||���||��n#t||���|��|S)Nr9rr$)�hasattrr r"r�insertrp)r r.� subtable_name� count_name�existing�indexr�� new_subtables r"�attachSubtableWithCount_z/ChainContextualBuilder.attachSubtableWithCount_�s��� � .�#�m�3�M� �:�-�J��r�:�&�&� +� �B� �A� &� &� &� �B� �r� *� *� *� � 8�#�L�L�6�7�2�}�5�5�7�7�L���J���J� 7� 7�!� ;�<�<�<� � <� �B� � &� &� -� -�e�\� B� B� B� B� �B� � &� &� -� -�l� ;� ;� ;��r0c�T�|�||j�d�|j�d�d���S)Nr:rFr�)rPr��r r.s r"r/z'ChainContextualBuilder.newLookupRecord_�sC���,�,� ��!� /� /� /��!� (� (� (�� -� � � r0)T)r$T)NNF)r�r�r�rYr�r�r�r�r�r�r r�rr rr rrPr/r,r0r"r�r�SsE������O�O�O� 8� 8� 8� � � �E,�E,�E,�N,�,�,�,�\J�J�J�J�X � � � �9�9�9�* � � �����& � � � � � � � ���������RW�����4 � � � � r0r�c��eZdZdZd�Zd�ZdS)r.a>Builds a Chained Contextual Positioning (GPOS8) lookup. Users are expected to manually add rules to the ``rules`` attribute after the object has been initialized, e.g.:: # pos [A B] [C D] x' lookup lu1 y' z' lookup lu2 E; prefix = [ ["A", "B"], ["C", "D"] ] suffix = [ ["E"] ] glyphs = [ ["x"], ["y"], ["z"] ] lookups = [ [lu1], None, [lu2] ] builder.rules.append( (prefix, glyphs, suffix, lookups) ) Attributes: font (``fontTools.TTLib.TTFont``): A font object. location: A string or tuple representing the location in the original source which produced this lookup. rules: A list of tuples representing the rules in this lookup. lookupflag (int): The lookup's flag markFilterSet: Either ``None`` if no mark filtering set is used, or an integer representing the filtering set to be used for this lookup. If a mark filtering set is provided, `LOOKUP_FLAG_USE_MARK_FILTERING_SET` will be set on the lookup's flags. c�^�t�|||dd��g|_d|_dS)NrKr'r��rHrTr�r�r�s r"rTzChainContextPosBuilder.__init__�s3�����t�T�8�V�Q�?�?�?��� �"����r0c����d}|ddd�D]D��|jkr|cSt�t��rt��fd�|D����r�}�E|S)z$Helper for add_single_pos_chained_()Nr�c3�D�K�|]}��|���V��dSr+)�can_add)r-�glyph�lookup�values ��r"r7zCChainContextPosBuilder.find_chainable_single_pos.<locals>.<genexpr>�sB�����<�<�16����u�e�,�,�<�<�<�<�<�<r0)r�rA�SinglePosBuilderr9)r r�rr[�resrZs ` @r"�find_chainable_single_posz0ChainContextPosBuilder.find_chainable_single_pos�s��������d�d��d�m� � �F���-�-�-�� � � ��&�"2�3�3� ��<�<�<�<�<�:@�<�<�<�9�9� ����� r0N)r�r�r�r�rTr^r,r0r"r.r.�s<��������4#�#�#� � � � � r0r.c�*�eZdZdZd�Zd�Zd�Zd�ZdS)�ChainContextSubstBuildera?Builds a Chained Contextual Substitution (GSUB6) lookup. Users are expected to manually add rules to the ``rules`` attribute after the object has been initialized, e.g.:: # sub [A B] [C D] x' lookup lu1 y' z' lookup lu2 E; prefix = [ ["A", "B"], ["C", "D"] ] suffix = [ ["E"] ] glyphs = [ ["x"], ["y"], ["z"] ] lookups = [ [lu1], None, [lu2] ] builder.rules.append( (prefix, glyphs, suffix, lookups) ) Attributes: font (``fontTools.TTLib.TTFont``): A font object. location: A string or tuple representing the location in the original source which produced this lookup. rules: A list of tuples representing the rules in this lookup. lookupflag (int): The lookup's flag markFilterSet: Either ``None`` if no mark filtering set is used, or an integer representing the filtering set to be used for this lookup. If a mark filtering set is provided, `LOOKUP_FLAG_USE_MARK_FILTERING_SET` will be set on the lookup's flags. c�^�t�|||dd��g|_d|_dS)NrL��SubstrUr�s r"rTz!ChainContextSubstBuilder.__init__�s3�����t�T�8�V�Q�?�?�?��� �$����r0c�L��i}|jD]�}|jr� |jD]�}t|t��s|g}|D]i}|�e|���}|���D]<\}}|�|g������fd�|D�����=�j����|S)Nc3�$�K�|] }|�v�|V�� dSr+r,)r-r��alts_for_glyphs �r"r7z>ChainContextSubstBuilder.getAlternateGlyphs.<locals>.<genexpr>s6�����2�2�&'�1�N�;R�;R��;R�;R�;R�;R�2�2r0) r�r�r�rAr�r_�items� setdefaultr�) r �resultr�r�rZ�altsrY� replacementsrfs @r"r_z+ChainContextSubstBuilder.getAlternateGlyphss�������J� � �D��%� ���<� � ��!�'�4�0�0�(�&�i�G�%���F��)�%�8�8�:�:��37�:�:�<�<���/�E�<�-3�->�->�u�b�-I�-I�N�*�1�1�2�2�2�2�+7�2�2�2������ � �� r0c�����d}|jddd�D]J}|jr|cS|jD]5�t�|��r#t ��fd��jD����s�}�6�K|S)z.Helper for add_{single,multi}_subst_chained_()Nr�c3�N�K�|]}|�vo�|�j|kV�� dSr+)r�)r-r�r��subs ��r"r7z@ChainContextSubstBuilder.find_chainable_subst.<locals>.<genexpr>sL�����>�>�FG�A��L�A�W�Q�Z�3�;�q�>�%A�>�>�>�>�>�>r0)r�r�r�rAr�r�)r r�� builder_classr]r�rns ` @r"�find_chainable_substz-ChainContextSubstBuilder.find_chainable_substs��������J�t�t��t�$� � �D��%� �� � � ��|� � ���c�=�1�1��#�>�>�>�>�>�KN�;�>�>�>�;�;���C��  � � r0c�����d}|jddd�D]W}|jr|cS|jD]B�t�t��s�t ��fd�t j|�D����r�}�C�X|S)z(Helper for add_ligature_subst_chained_()Nr�c3�V�K�|]#}�j�|����kV��$dSr+)� ligaturesr�)r-�seq� replacementrns ��r"r7zIChainContextSubstBuilder.find_chainable_ligature_subst.<locals>.<genexpr>+sN���������M�%�%�c�;�7�7�;�F������r0)r�r�r�rA�LigatureSubstBuilderr9� itertools�product)r rrur]r�rns ` @r"�find_chainable_ligature_substz6ChainContextSubstBuilder.find_chainable_ligature_subst"s��������J�t�t��t�$� � �D��%� �� � � ��|� � ��!�#�';�<�<���������(�0�&�9��������C�� �� r0N)r�r�r�r�rTr_rpryr,r0r"r`r`�sZ��������4%�%�%� ���$ � � �����r0r`c�*�eZdZdZd�Zd�Zd�Zd�ZdS)rva�Builds a Ligature Substitution (GSUB4) lookup. Users are expected to manually add ligatures to the ``ligatures`` attribute after the object has been initialized, e.g.:: # sub f i by f_i; builder.ligatures[("f","f","i")] = "f_f_i" Attributes: font (``fontTools.TTLib.TTFont``): A font object. location: A string or tuple representing the location in the original source which produced this lookup. ligatures: An ordered dictionary mapping a tuple of glyph names to the ligature glyphname. lookupflag (int): The lookup's flag markFilterSet: Either ``None`` if no mark filtering set is used, or an integer representing the filtering set to be used for this lookup. If a mark filtering set is provided, `LOOKUP_FLAG_USE_MARK_FILTERING_SET` will be set on the lookup's flags. c�h�t�|||dd��t��|_dS)NrLr&)rHrTrrsr�s r"rTzLigatureSubstBuilder.__init__Js-�����t�T�8�V�Q�?�?�?�$������r0c�X�t�||��o|j|jkSr+)rHrYrsrWs r"rYzLigatureSubstBuilder.equalsNs&���#�#�D�%�0�0�V�T�^�u��5V�Vr0c�l�|�|jt��}|�|��S)z�Build the lookup. Returns: An ``otTables.Lookup`` object representing the ligature substitution lookup. )r�rs�buildLigatureSubstSubtablerbras r"r�zLigatureSubstBuilder.buildQs7���.�.� �N�6� � � �� � ��+�+�+r0c�2�|j|j|j|f<dSr+)r�rsr�s r"r�z'LigatureSubstBuilder.add_subtable_break]s��;?�;O����,�h�7�8�8�8r0N�r�r�r�r�rTrYr�r�r,r0r"rvrv3sb��������,'�'�'�W�W�W� ,� ,� ,�P�P�P�P�Pr0rvc�*�eZdZdZd�Zd�Zd�Zd�ZdS)�MultipleSubstBuildera�Builds a Multiple Substitution (GSUB2) lookup. Users are expected to manually add substitutions to the ``mapping`` attribute after the object has been initialized, e.g.:: # sub uni06C0 by uni06D5.fina hamza.above; builder.mapping["uni06C0"] = [ "uni06D5.fina", "hamza.above"] Attributes: font (``fontTools.TTLib.TTFont``): A font object. location: A string or tuple representing the location in the original source which produced this lookup. mapping: An ordered dictionary mapping a glyph name to a list of substituted glyph names. lookupflag (int): The lookup's flag markFilterSet: Either ``None`` if no mark filtering set is used, or an integer representing the filtering set to be used for this lookup. If a mark filtering set is provided, `LOOKUP_FLAG_USE_MARK_FILTERING_SET` will be set on the lookup's flags. c�h�t�|||dd��t��|_dS)NrLr%�rHrTrr�r�s r"rTzMultipleSubstBuilder.__init__x�-�����t�T�8�V�Q�?�?�?�"�}�}�� � � r0c�X�t�||��o|j|jkSr+�rHrYr�rWs r"rYzMultipleSubstBuilder.equals|�&���#�#�D�%�0�0�R�T�\�U�]�5R�Rr0c�l�|�|jt��}|�|��Sr+)r�r��buildMultipleSubstSubtablerbras r"r�zMultipleSubstBuilder.builds.���.�.�t�|�=W�X�X� �� � ��+�+�+r0c�2�|j|j|j|f<dSr+�r�r�r�s r"r�z'MultipleSubstBuilder.add_subtable_break����9=�9M�� �d�*�H�5�6�6�6r0Nr�r,r0r"r�r�asb��������,%�%�%�S�S�S�,�,�,�N�N�N�N�Nr0r�c�*�eZdZdZd�Zd�Zd�Zd�ZdS)�CursivePosBuildera�Builds a Cursive Positioning (GPOS3) lookup. Attributes: font (``fontTools.TTLib.TTFont``): A font object. location: A string or tuple representing the location in the original source which produced this lookup. attachments: An ordered dictionary mapping a glyph name to a two-element tuple of ``otTables.Anchor`` objects. lookupflag (int): The lookup's flag markFilterSet: Either ``None`` if no mark filtering set is used, or an integer representing the filtering set to be used for this lookup. If a mark filtering set is provided, `LOOKUP_FLAG_USE_MARK_FILTERING_SET` will be set on the lookup's flags. c�P�t�|||dd��i|_dS)NrKr�)rHrT� attachmentsr�s r"rTzCursivePosBuilder.__init__�s,�����t�T�8�V�Q�?�?�?�����r0c�X�t�||��o|j|jkSr+)rHrYr�rWs r"rYzCursivePosBuilder.equals�s*�� � � ��u� -� -� W�$�2B�e�FW�2W� r0c�(�|D]}||f|j|<�dS)akAdds attachment information to the cursive positioning lookup. Args: location: A string or tuple representing the location in the original source which produced this lookup. (Unused.) glyphs: A list of glyph names sharing these entry and exit anchor locations. entryAnchor: A ``otTables.Anchor`` object representing the entry anchor, or ``None`` if no entry anchor is present. exitAnchor: A ``otTables.Anchor`` object representing the exit anchor, or ``None`` if no exit anchor is present. N)r�)r rOr� entryAnchor� exitAnchorrYs r"�add_attachmentz CursivePosBuilder.add_attachment�s6��� @� @�E�'2�J�&?�D� �U� #� #� @� @r0c�b�t|j|j��}|�|g��S)z�Build the lookup. Returns: An ``otTables.Lookup`` object representing the cursive positioning lookup. )�buildCursivePosSubtabler�rrbrRs r"r�zCursivePosBuilder.build�s.��%�T�%5�t�}� E� E��� � �"��&�&�&r0N)r�r�r�r�rTrYr�r�r,r0r"r�r��s]�������� ��� � � � @�@�@� '�'�'�'�'r0r�c�*�eZdZdZd�Zd�Zd�Zd�ZdS)�MarkBasePosBuildera�Builds a Mark-To-Base Positioning (GPOS4) lookup. Users are expected to manually add marks and bases to the ``marks`` and ``bases`` attributes after the object has been initialized, e.g.:: builder.marks["acute"] = (0, a1) builder.marks["grave"] = (0, a1) builder.marks["cedilla"] = (1, a2) builder.bases["a"] = {0: a3, 1: a5} builder.bases["b"] = {0: a4, 1: a5} Attributes: font (``fontTools.TTLib.TTFont``): A font object. location: A string or tuple representing the location in the original source which produced this lookup. marks: An dictionary mapping a glyph name to a two-element tuple containing a mark class ID and ``otTables.Anchor`` object. bases: An dictionary mapping a glyph name to a dictionary of mark class IDs and ``otTables.Anchor`` object. lookupflag (int): The lookup's flag markFilterSet: Either ``None`` if no mark filtering set is used, or an integer representing the filtering set to be used for this lookup. If a mark filtering set is provided, `LOOKUP_FLAG_USE_MARK_FILTERING_SET` will be set on the lookup's flags. c�^�t�|||dd��i|_i|_dS)NrKr&)rHrTrf�basesr�s r"rTzMarkBasePosBuilder.__init__�s0�����t�T�8�V�Q�?�?�?��� ��� � � r0c�x�t�||��o|j|jko|j|jkSr+)rHrYrfr�rWs r"rYzMarkBasePosBuilder.equals�s<�� � � ��u� -� -� *�� �e�k�)� *�� �e�k�)� r0c�p�d�|jD��}|�d�|jD����|S)Nc��i|]}|d��S)r$r,�r-rYs r"� <dictcomp>z8MarkBasePosBuilder.inferGlyphClasses.<locals>.<dictcomp>�s��3�3�3�u�%��3�3�3r0c��i|]}|d��S�r�r,r�s r"r�z8MarkBasePosBuilder.inferGlyphClasses.<locals>.<dictcomp>����8�8�8�E�u�a�8�8�8r0)r��updaterf�r ris r"r\z$MarkBasePosBuilder.inferGlyphClasses�s?��3�3�� �3�3�3��� � �8�8�T�Z�8�8�8�9�9�9�� r0c���|�|j��}i}|j���D].\}\}}||vrtd|�d|�����|||f||<�/i}|j���D]N\}}i||<|���D]/\}}||vrtd|�d|�����|||||<�0�Ot |||j��} |�| ��S)z�Build the lookup. Returns: An ``otTables.Lookup`` object representing the mark-to-base positioning lookup. z Mark class z not found for mark glyph z not found for base glyph )rkrfrgrr��buildMarkBasePosrrb) r � markClassesrfrh�mc�anchorr�rY�anchorsr6s r"r�zMarkBasePosBuilder.build�sC���,�,�T�Z�8�8� ���"&�*�"2�"2�"4�"4� 4� 4� �D�,�2�v���$�$� �j�CE�2�2�t�t�L����'�r�?�F�3�E�$�K�K���"�j�.�.�0�0� 7� 7�N�E�7��E�%�L�%�m�m�o�o� 7� 7� ��F��[�(�(�$�*�GI�r�r�5�5�Q����17��e� �[��_�-�-�  7� %�U�E�4�=�A�A� �� � ��+�+�+r0N�r�r�r�r�rTrYr\r�r,r0r"r�r��sZ��������6���  � � ���� ,�,�,�,�,r0r�c�*�eZdZdZd�Zd�Zd�Zd�ZdS)�MarkLigPosBuilderacBuilds a Mark-To-Ligature Positioning (GPOS5) lookup. Users are expected to manually add marks and bases to the ``marks`` and ``ligatures`` attributes after the object has been initialized, e.g.:: builder.marks["acute"] = (0, a1) builder.marks["grave"] = (0, a1) builder.marks["cedilla"] = (1, a2) builder.ligatures["f_i"] = [ { 0: a3, 1: a5 }, # f { 0: a4, 1: a5 } # i ] Attributes: font (``fontTools.TTLib.TTFont``): A font object. location: A string or tuple representing the location in the original source which produced this lookup. marks: An dictionary mapping a glyph name to a two-element tuple containing a mark class ID and ``otTables.Anchor`` object. ligatures: An dictionary mapping a glyph name to an array with one element for each ligature component. Each array element should be a dictionary mapping mark class IDs to ``otTables.Anchor`` objects. lookupflag (int): The lookup's flag markFilterSet: Either ``None`` if no mark filtering set is used, or an integer representing the filtering set to be used for this lookup. If a mark filtering set is provided, `LOOKUP_FLAG_USE_MARK_FILTERING_SET` will be set on the lookup's flags. c�^�t�|||dd��i|_i|_dS)NrK�)rHrTrfrsr�s r"rTzMarkLigPosBuilder.__init__$�0�����t�T�8�V�Q�?�?�?��� �����r0c�x�t�||��o|j|jko|j|jkSr+)rHrYrfrsrWs r"rYzMarkLigPosBuilder.equals)�<�� � � ��u� -� -� 2�� �e�k�)� 2���%�/�1� r0c�p�d�|jD��}|�d�|jD����|S)Nc��i|]}|d��S)r%r,r�s r"r�z7MarkLigPosBuilder.inferGlyphClasses.<locals>.<dictcomp>1���7�7�7�u�%��7�7�7r0c��i|]}|d��Sr�r,r�s r"r�z7MarkLigPosBuilder.inferGlyphClasses.<locals>.<dictcomp>2r�r0)rsr�rfr�s r"r\z#MarkLigPosBuilder.inferGlyphClasses0�?��7�7���7�7�7��� � �8�8�T�Z�8�8�8�9�9�9�� r0c���|�|j����fd�|j���D��}i}|j���D]H\}}g||<|D];}||��fd�|���D�����<�It |||j��}|�|��S)z�Build the lookup. Returns: An ``otTables.Lookup`` object representing the mark-to-ligature positioning lookup. c�2��i|]\}\}}|�||f��Sr,r,�r-rhr�r�r�s �r"r�z+MarkLigPosBuilder.build.<locals>.<dictcomp>=�9��� � � �0B��l�r�6�D�;�r�?�F�+� � � r0c�(��i|]\}}�||��Sr,r,)r-r��ar�s �r"r�z+MarkLigPosBuilder.build.<locals>.<dictcomp>Ds#���!L�!L�!L���Q�+�b�/�1�!L�!L�!Lr0)rkrfrgrsrp�buildMarkLigPosrrb)r rf�ligs�lig� componentsrr6r�s @r"r�zMarkLigPosBuilder.build5s�����,�,�T�Z�8�8� � � � � �FJ�j�FV�FV�FX�FX� � � ����#�~�3�3�5�5� N� N�O�C���D��I�� N� N���S� � � �!L�!L�!L�!L�!�'�'�)�)�!L�!L�!L�M�M�M�M� N�#�E�4���?�?� �� � ��+�+�+r0Nr�r,r0r"r�r�sZ��������<���  � � ���� ,�,�,�,�,r0r�c�*�eZdZdZd�Zd�Zd�Zd�ZdS)�MarkMarkPosBuildera�Builds a Mark-To-Mark Positioning (GPOS6) lookup. Users are expected to manually add marks and bases to the ``marks`` and ``baseMarks`` attributes after the object has been initialized, e.g.:: builder.marks["acute"] = (0, a1) builder.marks["grave"] = (0, a1) builder.marks["cedilla"] = (1, a2) builder.baseMarks["acute"] = {0: a3} Attributes: font (``fontTools.TTLib.TTFont``): A font object. location: A string or tuple representing the location in the original source which produced this lookup. marks: An dictionary mapping a glyph name to a two-element tuple containing a mark class ID and ``otTables.Anchor`` object. baseMarks: An dictionary mapping a glyph name to a dictionary containing one item: a mark class ID and a ``otTables.Anchor`` object. lookupflag (int): The lookup's flag markFilterSet: Either ``None`` if no mark filtering set is used, or an integer representing the filtering set to be used for this lookup. If a mark filtering set is provided, `LOOKUP_FLAG_USE_MARK_FILTERING_SET` will be set on the lookup's flags. c�^�t�|||dd��i|_i|_dS)NrKrb)rHrTrf� baseMarksr�s r"rTzMarkMarkPosBuilder.__init__dr�r0c�x�t�||��o|j|jko|j|jkSr+)rHrYrfr�rWs r"rYzMarkMarkPosBuilder.equalsir�r0c�p�d�|jD��}|�d�|jD����|S)Nc��i|]}|d��Sr�r,r�s r"r�z8MarkMarkPosBuilder.inferGlyphClasses.<locals>.<dictcomp>qr�r0c��i|]}|d��Sr�r,r�s r"r�z8MarkMarkPosBuilder.inferGlyphClasses.<locals>.<dictcomp>rr�r0)r�r�rfr�s r"r\z$MarkMarkPosBuilder.inferGlyphClassespr�r0c�&�������j���t�����j���}�fd��j���D��}t j��}d|_t���|_ t|�j ��|_ t�j�j ��|_t!|�j ��|_t j��|_t|jj��|j_g|j_|jjD]=���fd�|D��}|jj�t/|�����>��|g��S)z�Build the lookup. Returns: An ``otTables.Lookup`` object representing the mark-to-mark positioning lookup. rc�2��i|]\}\}}|�||f��Sr,r,r�s �r"r�z,MarkMarkPosBuilder.build.<locals>.<dictcomp>~r�r0r$c�P��g|]"}�j��|����#Sr,)r�r�)r-r��baser s ��r"r/z,MarkMarkPosBuilder.build.<locals>.<listcomp>�s.���L�L�L��t�~�d�+�/�/��3�3�L�L�Lr0)rkrfrrdr�rgr� MarkMarkPosrr>� ClassCountr#r� Mark1Coverager�� Mark2Coverage�buildMarkArray� Mark1Array� Mark2Arrayr� Mark2Count� Mark2Recordrp�buildMark2Recordrb)r � markClassListrfr.r�r�r�s` @@r"r�zMarkMarkPosBuilder.buildusq������,�,�T�Z�8�8� ��{�/�/�1�1�{��G�G�G� � � � � �FJ�j�FV�FV�FX�FX� � � ���^� � ���� ��K�(�(�� �(��� �>�>���(�����G�G���&�u�d�m�<�<�� �� ���� �#&�r�'7�'>�#?�#?�� � �$&�� �!��$�+� H� H�D�L�L�L�L�L�m�L�L�L�G� �M� %� ,� ,�-=�g�-F�-F� G� G� G� G�� � �"��&�&�&r0Nr�r,r0r"r�r�IsZ��������4���  � � ���� '�'�'�'�'r0r�c�*�eZdZdZd�Zd�Zd�Zd�ZdS)�ReverseChainSingleSubstBuildera[Builds a Reverse Chaining Contextual Single Substitution (GSUB8) lookup. Users are expected to manually add substitutions to the ``substitutions`` attribute after the object has been initialized, e.g.:: # reversesub [a e n] d' by d.alt; prefix = [ ["a", "e", "n"] ] suffix = [] mapping = { "d": "d.alt" } builder.substitutions.append( (prefix, suffix, mapping) ) Attributes: font (``fontTools.TTLib.TTFont``): A font object. location: A string or tuple representing the location in the original source which produced this lookup. substitutions: A three-element tuple consisting of a prefix sequence, a suffix sequence, and a dictionary of single substitutions. lookupflag (int): The lookup's flag markFilterSet: Either ``None`` if no mark filtering set is used, or an integer representing the filtering set to be used for this lookup. If a mark filtering set is provided, `LOOKUP_FLAG_USE_MARK_FILTERING_SET` will be set on the lookup's flags. c�P�t�|||dd��g|_dS)NrLr')rHrTr�r�s r"rTz'ReverseChainSingleSubstBuilder.__init__�s)�����t�T�8�V�Q�?�?�?��� � � r0c�X�t�||��o|j|jkSr+r�rWs r"rYz%ReverseChainSingleSubstBuilder.equals�r�r0c���g}|jD]�\}}�tj��}d|_|�||��|�||��t ����|j��|_ t���|_ �fd�|j j D��|_ |�|����|�|��S)z�Build the lookup. Returns: An ``otTables.Lookup`` object representing the chained contextual substitution lookup. r$c� ��g|] }�|�� Sr,r,)r-r�r�s �r"r/z8ReverseChainSingleSubstBuilder.build.<locals>.<listcomp>�s���D�D�D�A�W�Q�Z�D�D�Dr0)r�r�ReverseChainSingleSubstrrur{r#rdrrr>r�r� Substituterprb)r r6rqryr.r�s @r"r�z$ReverseChainSingleSubstBuilder.build�s����� �'+�z� !� !� #�F�F�G��+�-�-�B��B�I� � &� &�v�r� 2� 2� 2� � &� &�v�r� 2� 2� 2�'�� � ���� �F�F�B�K���L�L�B�M�D�D�D�D���1C�D�D�D�B�M� � � �R� � � � �� � ��+�+�+r0c��dSr+r,r�s r"r�z1ReverseChainSingleSubstBuilder.add_subtable_break�s�� �r0Nr�r,r0r"r�r��s]��������2���O�O�O�,�,�,�& � � � � r0r�c�0�eZdZdZd�Zd�Zd�Zd�Zd�ZdS)�SingleSubstBuilderadBuilds a Single Substitution (GSUB1) lookup. Users are expected to manually add substitutions to the ``mapping`` attribute after the object has been initialized, e.g.:: # sub x by y; builder.mapping["x"] = "y" Attributes: font (``fontTools.TTLib.TTFont``): A font object. location: A string or tuple representing the location in the original source which produced this lookup. mapping: A dictionary mapping a single glyph name to another glyph name. lookupflag (int): The lookup's flag markFilterSet: Either ``None`` if no mark filtering set is used, or an integer representing the filtering set to be used for this lookup. If a mark filtering set is provided, `LOOKUP_FLAG_USE_MARK_FILTERING_SET` will be set on the lookup's flags. c�h�t�|||dd��t��|_dS)NrLr$r�r�s r"rTzSingleSubstBuilder.__init__�r�r0c�X�t�||��o|j|jkSr+r�rWs r"rYzSingleSubstBuilder.equals�r�r0c�l�|�|jt��}|�|��S)z�Build the lookup. Returns: An ``otTables.Lookup`` object representing the multiple substitution lookup. )r�r��buildSingleSubstSubtablerbras r"r�zSingleSubstBuilder.build�s0���.�.�t�|�=U�V�V� �� � ��+�+�+r0c�H�d�|j���D��S)Nc��i|] \}}||g�� Sr,r,)r-rY�repls r"r�z9SingleSubstBuilder.getAlternateGlyphs.<locals>.<dictcomp>�s ��F�F�F�+�%����v�F�F�Fr0)r�rgr[s r"r_z%SingleSubstBuilder.getAlternateGlyphs�s$��F�F���1C�1C�1E�1E�F�F�F�Fr0c�2�|j|j|j|f<dSr+r�r�s r"r�z%SingleSubstBuilder.add_subtable_break�r�r0Nr�r,r0r"r�r��st��������*%�%�%�S�S�S�,�,�,�G�G�G�N�N�N�N�Nr0r�c�0�eZdZdZd�Zd�Zd�Zd�Zd�ZdS)�ClassPairPosSubtableBuilderaSBuilds class-based Pair Positioning (GPOS2 format 2) subtables. Note that this does *not* build a GPOS2 ``otTables.Lookup`` directly, but builds a list of ``otTables.PairPos`` subtables. It is used by the :class:`PairPosBuilder` below. Attributes: builder (PairPosBuilder): A pair positioning lookup builder. c�\�||_d\|_|_i|_d|_g|_dS)N�NNF)�builder_� classDef1_� classDef2_�values_�forceSubtableBreak_� subtables_)r �builders r"rTz$ClassPairPosSubtableBuilder.__init__s1���� �+5�(������� �#(�� �����r0c��|j oE|jduo<|j�|��o"|jduo|j�|��}|sE|���t d���|_t d���|_i|_|j�|��|j�|��||f|j||f<dS)a~Add a pair positioning rule. Args: gc1: A set of glyph names for the "left" glyph value1: An ``otTables.ValueRecord`` object for the left glyph's positioning. gc2: A set of glyph names for the "right" glyph value2: An ``otTables.ValueRecord`` object for the right glyph's positioning. NTr�F)r�r�r�r��flush_r�r�r�)r �gc1�value1�gc2�value2� mergeables r"�addPairz#ClassPairPosSubtableBuilder.addPair s����(� (� ,���t�+� ,���&�&�s�+�+� ,���t�+� ,���&�&�s�+�+� �� � �K�K�M�M�M�-��=�=�=�D�O�-��>�>�>�D�O��D�L� ����C� � � � ����C� � � �$*�F�#3�� �c�3�Z� � � r0c��d|_dS)z-Add an explicit subtable break at this point.TN)r�r[s r"�addSubtableBreakz,ClassPairPosSubtableBuilder.addSubtableBreak%s��#'�� � � r0c�8�|���|jS)z>Return the list of ``otTables.PairPos`` subtables constructed.)r�r�r[s r"r6z%ClassPairPosSubtableBuilder.subtables)s�� � � � � � ���r0c��|j�|j�dSt|j|jj��}|j�dS|j�|��d|_ dS)NF) r�r��buildPairPosClassesSubtabler�r�rrr�rpr�rRs r"r�z"ClassPairPosSubtableBuilder.flush_.s]�� �?� "�d�o�&=� �F� (���t�}�7M� N� N�� �;� � �F� ����r�"�"�"�#(�� � � r0N) r�r�r�r�rTrrr6r�r,r0r"r�r��si�����������4�4�4�6(�(�(���� )�)�)�)�)r0r�c�6�eZdZdZd�Zd�Zd�Zd�Zd�Zd�Z dS) �PairPosBuildera�Builds a Pair Positioning (GPOS2) lookup. Attributes: font (``fontTools.TTLib.TTFont``): A font object. location: A string or tuple representing the location in the original source which produced this lookup. pairs: An array of class-based pair positioning tuples. Usually manipulated with the :meth:`addClassPair` method below. glyphPairs: A dictionary mapping a tuple of glyph names to a tuple of ``otTables.ValueRecord`` objects. Usually manipulated with the :meth:`addGlyphPair` method below. lookupflag (int): The lookup's flag markFilterSet: Either ``None`` if no mark filtering set is used, or an integer representing the filtering set to be used for this lookup. If a mark filtering set is provided, `LOOKUP_FLAG_USE_MARK_FILTERING_SET` will be set on the lookup's flags. c�l�t�|||dd��g|_i|_i|_dS)NrKr%)rHrT�pairs� glyphPairs� locationsr�s r"rTzPairPosBuilder.__init__Ls7�����t�T�8�V�Q�?�?�?��� ��������r0c�B�|j�||||f��dS)aAdd a class pair positioning rule to the current lookup. Args: location: A string or tuple representing the location in the original source which produced this rule. Unused. glyphclass1: A set of glyph names for the "left" glyph in the pair. value1: A ``otTables.ValueRecord`` for positioning the left glyph. glyphclass2: A set of glyph names for the "right" glyph in the pair. value2: A ``otTables.ValueRecord`` for positioning the right glyph. N)r rp)r rO� glyphclass1r�� glyphclass2r�s r"� addClassPairzPairPosBuilder.addClassPairRs)�� � ���;�� �V�D�E�E�E�E�Er0c���||f}|j�|d��}|�,|j|}t�d|||��dS||f|j|<||j|<dS)a�Add a glyph pair positioning rule to the current lookup. Args: location: A string or tuple representing the location in the original source which produced this rule. glyph1: A glyph name for the "left" glyph in the pair. value1: A ``otTables.ValueRecord`` for positioning the left glyph. glyph2: A glyph name for the "right" glyph in the pair. value2: A ``otTables.ValueRecord`` for positioning the right glyph. NzGAlready defined position for pair %s %s at %s; choosing the first value)r r�r r��debug) r rO�glyph1r��glyph2r�r�oldValue�otherLocs r"� addGlyphPairzPairPosBuilder.addGlyphPair_s����v����?�&�&�s�D�1�1�� � ��~�c�*�H� �I�I�+����  � � � � �%+�F�#3�D�O�C� �"*�D�N�3� � � r0c�j�|j�|j|j|j|jf��dSr+)r rpr�r�s r"r�z!PairPosBuilder.add_subtable_break{sC�� � ����$��$��$��$�  � � � � � r0c�x�t�||��o|j|jko|j|jkSr+)rHrYr r rWs r"rYzPairPosBuilder.equals�s=�� � � ��u� -� -� *���5�#3�3� *�� �e�k�)� r0c�\�i}t|��}|jD]=\}}}}||jur|����%|�||||���>g}|jr-|�t|j|j����|�|� ����|� |��}|j j � dt�����} | dkr0t�d��t#|j | |��|S)z�Build the lookup. Returns: An ``otTables.Lookup`` object representing the pair positioning lookup. z0fontTools.otlLib.optimize.gpos:COMPRESSION_LEVEL)�defaultrzCompacting GPOS...)r�r r�rrr r��buildPairPosGlyphsrr6rbrMr�r�rr��infor) r �buildersr�r r�rr�r6rZ�levels r"r�zPairPosBuilder.build�s9����-�d�3�3��8<� � F� F� 4�K���f��d�2�2�2��(�(�*�*�*�� �O�O�K���f� E� E� E� E�� � �?� Q� � � �/�����O�O� P� P� P�����*�*�,�,�-�-�-��"�"�9�-�-�� � � �!�!� >�/�1�1�"� � �� �A�:�:� �H�H�)� *� *� *� �4�9�e�V� 4� 4� 4�� r0N) r�r�r�r�rTrrr�rYr�r,r0r"rr8s{��������&��� F� F� F�+�+�+�8 � � � � � � � � � � r0rc�0�eZdZdZd�Zd�Zd�Zd�Zd�ZdS)r\a�Builds a Single Positioning (GPOS1) lookup. Attributes: font (``fontTools.TTLib.TTFont``): A font object. location: A string or tuple representing the location in the original source which produced this lookup. mapping: A dictionary mapping a glyph name to a ``otTables.ValueRecord`` objects. Usually manipulated with the :meth:`add_pos` method below. lookupflag (int): The lookup's flag markFilterSet: Either ``None`` if no mark filtering set is used, or an integer representing the filtering set to be used for this lookup. If a mark filtering set is provided, `LOOKUP_FLAG_USE_MARK_FILTERING_SET` will be set on the lookup's flags. c�^�t�|||dd��i|_i|_dS)NrKr$)rHrTr r�r�s r"rTzSinglePosBuilder.__init__�s0�����t�T�8�V�Q�?�?�?������ � � r0c��|�||��s#|j|}td|�d|��|���|r ||j|<||j|<dS)a?Add a single positioning rule. Args: location: A string or tuple representing the location in the original source which produced this lookup. glyph: A glyph name. otValueRection: A ``otTables.ValueRecord`` used to position the glyph. z.Already defined different position for glyph "z" at N)rXr rr�)r rOrY� otValueRecordrs r"�add_poszSinglePosBuilder.add_pos�sv���|�|�E�=�1�1� ��~�e�,�H�"�"��5�5�(�(�$���� � � 0�"/�D�L�� � (���u���r0c�x�t|t��sJ�|j�|��}|dup||kSr+)rAr r�r�)r rYr[�curValues r"rXzSinglePosBuilder.can_add�sB���%��-�-�-�-�-��<�#�#�E�*�*���4��4�8�u�#4�4r0c�X�t�||��o|j|jkSr+r�rWs r"rYzSinglePosBuilder.equals�r�r0c�`�t|j|j��}|�|��S)z�Build the lookup. Returns: An ``otTables.Lookup`` object representing the single positioning lookup. )�buildSinglePosr�rrbras r"r�zSinglePosBuilder.build�s+��#�4�<���?�?� �� � ��+�+�+r0N) r�r�r�r�rTr#rXrYr�r,r0r"r\r\�sl�������� ��� )�)�)�*5�5�5� S�S�S�,�,�,�,�,r0r\c�\�|sdStj��}t|��|_|S)a�Builds a single substitution (GSUB1) subtable. Note that if you are implementing a layout compiler, you may find it more flexible to use :py:class:`fontTools.otlLib.lookupBuilders.SingleSubstBuilder` instead. Args: mapping: A dictionary mapping input glyph names to output glyph names. Returns: An ``otTables.SingleSubst`` object, or ``None`` if the mapping dictionary is empty. N)r� SingleSubst�dictr��r�r s r"r�r��s0�� ���t� �>� � �D���=�=�D�L� �Kr0c�\�|sdStj��}t|��|_|S)a�Builds a multiple substitution (GSUB2) subtable. Note that if you are implementing a layout compiler, you may find it more flexible to use :py:class:`fontTools.otlLib.lookupBuilders.MultipleSubstBuilder` instead. Example:: # sub uni06C0 by uni06D5.fina hamza.above # sub uni06C2 by uni06C1.fina hamza.above; subtable = buildMultipleSubstSubtable({ "uni06C0": [ "uni06D5.fina", "hamza.above"], "uni06C2": [ "uni06D1.fina", "hamza.above"] }) Args: mapping: A dictionary mapping input glyph names to a list of output glyph names. Returns: An ``otTables.MultipleSubst`` object or ``None`` if the mapping dictionary is empty. N)r� MultipleSubstr+r�r,s r"r�r�s1��2 ���t� � � � �D���=�=�D�L� �Kr0c�\�|sdStj��}t|��|_|S)a�Builds an alternate substitution (GSUB3) subtable. Note that if you are implementing a layout compiler, you may find it more flexible to use :py:class:`fontTools.otlLib.lookupBuilders.AlternateSubstBuilder` instead. Args: mapping: A dictionary mapping input glyph names to a list of output glyph names. Returns: An ``otTables.AlternateSubst`` object or ``None`` if the mapping dictionary is empty. N)r�AlternateSubstr+r�r,s r"r�r�%s1�� ���t� � � � �D��7�m�m�D�O� �Kr0c��|sdStj��}i|_t|���|j���D]�}tj��}|dd�|_t|j��dz|_ |||_ |d}|j� |g��� |����|S)a�Builds a ligature substitution (GSUB4) subtable. Note that if you are implementing a layout compiler, you may find it more flexible to use :py:class:`fontTools.otlLib.lookupBuilders.LigatureSubstBuilder` instead. Example:: # sub f f i by f_f_i; # sub f i by f_i; subtable = buildLigatureSubstSubtable({ ("f", "f", "i"): "f_f_i", ("f", "i"): "f_i", }) Args: mapping: A dictionary mapping tuples of glyph names to output glyph names. Returns: An ``otTables.LigatureSubst`` object or ``None`` if the mapping dictionary is empty. Nrr$r) r� LigatureSubstrsrrd�_getLigatureSortKey�Ligature� Componentr>� CompCount�LigGlyphrhrp)r�r r��ligaturers r"r~r~;s���4 ���t� � � � �D��D�N��W�\�\�^�^��1I�J�J�J�C�C� ��;�=�=��'����^��� ��!3�4�4�q�8���#�J�/�����]� � ��!�!�*�b�1�1�8�8��B�B�B�B� �Kr0c���tj��}||c|_|_d|_|�||_d|_|�|�*|jdks Jd���||_||_d|_|S)a�Builds an Anchor table. This determines the appropriate anchor format based on the passed parameters. Args: x (int): X coordinate. y (int): Y coordinate. point (int): Index of glyph contour point, if provided. deviceX (``otTables.Device``): X coordinate device table, if provided. deviceY (``otTables.Device``): Y coordinate device table, if provided. Returns: An ``otTables.Anchor`` object. r$Nr%z7Either point, or both of deviceX/deviceY, must be None.r�)r�Anchor� XCoordinate� YCoordinater� AnchorPoint� XDeviceTable� YDeviceTable)r��y�point�deviceX�deviceYr s r"� buildAnchorrDis��� �9�;�;�D�)*�A�&�D��d�&��D�K� �� ����� ���g�1� �K�1� � � � D� � � �#���#����� � �Kr0c�4��tj��}g|_t||j���D]L}||��fd�t |��D��}|j�t|�����Mt|j��|_ |S)a�Builds a base array record. As part of building mark-to-base positioning rules, you will need to define a ``BaseArray`` record, which "defines for each base glyph an array of anchors, one for each mark class." This function builds the base array subtable. Example:: bases = {"a": {0: a3, 1: a5}, "b": {0: a4, 1: a5}} basearray = buildBaseArray(bases, 2, font.getReverseGlyphMap()) Args: bases (dict): A dictionary mapping anchors to glyphs; the keys being glyph names, and the values being dictionaries mapping mark class ID to the appropriate ``otTables.Anchor`` object used for attaching marks of that class. numMarkClasses (int): The total number of mark classes for which anchors are defined. glyphMap: a glyph name to ID map, typically returned from ``font.getReverseGlyphMap()``. Returns: An ``otTables.BaseArray`` object. rc�:��g|]}��|����Sr,�r�)r-� markClass�bs �r"r/z"buildBaseArray.<locals>.<listcomp>�s%���K�K�K� �1�5�5��#�#�K�K�Kr0) r� BaseArray� BaseRecordrr�rangerp�buildBaseRecordr>� BaseCount)r��numMarkClassesrr r�r�rIs @r"�buildBaseArrayrP�s����4 �<�>�>�D��D�O��u�(�"6�7�7�7�9�9�� �$�K��K�K�K�K�U�>�5J�5J�K�K�K�� �����w�7�7�8�8�8�8����)�)�D�N� �Kr0c�:�tj��}||_|Sr+)rrK� BaseAnchor�r�r s r"rMrM�s�� �=�?�?�D��D�O� �Kr0c�B�|sdStj��}||_|S)a Builds a component record. As part of building mark-to-ligature positioning rules, you will need to define ``ComponentRecord`` objects, which contain "an array of offsets... to the Anchor tables that define all the attachment points used to attach marks to the component." This function builds the component record. Args: anchors: A list of ``otTables.Anchor`` objects or ``None``. Returns: A ``otTables.ComponentRecord`` object or ``None`` if no anchors are supplied. N)r�ComponentRecord�LigatureAnchorrSs r"�buildComponentRecordrW�s,�� ���t� � � � �D�!�D�� �Kr0c�z�|sdStj��}d|_t|���|��|_g|_|jjD]H}||\}}tj��}||_||_ |j� |���It|j��|_ |S)ayBuilds a cursive positioning (GPOS3) subtable. Cursive positioning lookups are made up of a coverage table of glyphs, and a set of ``EntryExitRecord`` records containing the anchors for each glyph. This function builds the cursive positioning subtable. Example:: subtable = buildCursivePosSubtable({ "AlifIni": (None, buildAnchor(0, 50)), "BehMed": (buildAnchor(500,250), buildAnchor(0,50)), # ... }, font.getReverseGlyphMap()) Args: attach (dict): A mapping between glyph names and a tuple of two ``otTables.Anchor`` objects representing entry and exit anchors. glyphMap: a glyph name to ID map, typically returned from ``font.getReverseGlyphMap()``. Returns: An ``otTables.CursivePos`` object, or ``None`` if the attachment dictionary was empty. Nr$) r� CursivePosrr#rdr�EntryExitRecordr� EntryAnchor� ExitAnchorrpr>�EntryExitCount)�attachrr rYr�r�r5s r"r�r��s���2 ���t� �=�?�?�D��D�K�!�&�+�+�-�-��:�:�D�M��D����%�)�)��"(��-�� �Z�� �"�"��%���#��� ��#�#�C�(�(�(�(��d�2�3�3�D�� �Kr0c�����sdStj��}����}t|��x|_}t |��x|_}d|cxkr|ksnJ��fd�t||dz��D��x|_}t |��}t|��}|dkr|dksJ�|dkr|dkrd|_ n|d kr|d krd|_ nd |_ |S) a�Builds a Device record as part of a ValueRecord or Anchor. Device tables specify size-specific adjustments to value records and anchors to reflect changes based on the resolution of the output. For example, one could specify that an anchor's Y position should be increased by 1 pixel when displayed at 8 pixels per em. This routine builds device records. Args: deltas: A dictionary mapping pixels-per-em sizes to the delta adjustment in pixels when the font is displayed at that size. Returns: An ``otTables.Device`` object if any deltas were supplied, or ``None`` otherwise. Nrc�<��g|]}��|d����Sr�rG)r-r��deltass �r"r/zbuildDevice.<locals>.<listcomp> s4���%�%�%� $�� � �4����%�%�%r0r$i���������r%i����r'r�) r�Devicerdr�� StartSize�max�EndSizerL� DeltaValue� DeltaFormat)rar rd� startSize�endSize� deltaValues�maxDelta�minDeltas` r"� buildDevicero�s)���" ���t� �9�;�;�D� �;�;�=�=�D�!$�T���*�D�N�Y� ��Y�Y�&�D�L�7� � � $� $� $� $�W� $� $� $� $� $� $�%�%�%�%�(-�i��1��(E�(E�%�%�%��D�O�k��;���H��;���H� �d�?�?�x�#�~�~�~� -��"�}�}��A������� �B���8�a�<�<�������� �Kr0c�d��tj��}g|_t||j���D]d}g}||D]0�|��fd�t |��D�����1|j�t|�����et|j��|_ |S)a6Builds a LigatureArray subtable. As part of building a mark-to-ligature lookup, you will need to define the set of anchors (for each mark class) on each component of the ligature where marks can be attached. For example, for an Arabic divine name ligature (lam lam heh), you may want to specify mark attachment positioning for superior marks (fatha, etc.) and inferior marks (kasra, etc.) on each glyph of the ligature. This routine builds the ligature array record. Example:: buildLigatureArray({ "lam-lam-heh": [ { 0: superiorAnchor1, 1: inferiorAnchor1 }, # attach points for lam1 { 0: superiorAnchor2, 1: inferiorAnchor2 }, # attach points for lam2 { 0: superiorAnchor3, 1: inferiorAnchor3 }, # attach points for heh ] }, 2, font.getReverseGlyphMap()) Args: ligs (dict): A mapping of ligature names to an array of dictionaries: for each component glyph in the ligature, an dictionary mapping mark class IDs to anchors. numMarkClasses (int): The number of mark classes. glyphMap: a glyph name to ID map, typically returned from ``font.getReverseGlyphMap()``. Returns: An ``otTables.LigatureArray`` object if deltas were supplied. rc�:��g|]}��|����Sr,rG)r-r�� components �r"r/z&buildLigatureArray.<locals>.<listcomp>=s%���N�N�N�"�I�M�M�"�-�-�N�N�Nr0) r� LigatureArray�LigatureAttachrrrprL�buildLigatureAttachr>� LigatureCount)r�rOrr r�r�rrs @r"�buildLigatureArrayrws����> � � � �D��D���d�� 4�5�5�5�A�A�����c�� P� P�I� �N�N�N�N�N�N��n�8M�8M�N�N�N� O� O� O� O� ��"�"�#6�w�#?�#?�@�@�@�@��T�0�1�1�D�� �Kr0c��tj��}d�|D��|_t|j��|_|S)Nc�,�g|]}t|����Sr,)rWrs r"r/z'buildLigatureAttach.<locals>.<listcomp>Fs!��H�H�H��0��3�3�H�H�Hr0)rrtrUr>�ComponentCount)r�r s r"ruruCs>�� � � � �D�H�H�Z�H�H�H�D���d�2�3�3�D�� �Kr0c�,�tj��}g|_t|���|j���D]7}||\}}t ||��}|j�|���8t|j��|_ |S)a[Builds a mark array subtable. As part of building mark-to-* positioning rules, you will need to define a MarkArray subtable, which "defines the class and the anchor point for a mark glyph." This function builds the mark array subtable. Example:: mark = { "acute": (0, buildAnchor(300,712)), # ... } markarray = buildMarkArray(marks, font.getReverseGlyphMap()) Args: marks (dict): A dictionary mapping anchors to glyphs; the keys being glyph names, and the values being a tuple of mark class number and an ``otTables.Anchor`` object representing the mark's attachment point. glyphMap: a glyph name to ID map, typically returned from ``font.getReverseGlyphMap()``. Returns: An ``otTables.MarkArray`` object. r) r� MarkArray� MarkRecordrrdr�buildMarkRecordrpr>� MarkCount)rfrr rhrHr��markrecs r"r�r�Ks���4 �<�>�>�D��D�O��u�z�z�|�|��)=�>�>�>�(�(��!�$�K�� �6�!�)�V�4�4�� ����w�'�'�'�'����)�)�D�N� �Kr0c�&�t|||��gS)auBuild a list of MarkBasePos (GPOS4) subtables. This routine turns a set of marks and bases into a list of mark-to-base positioning subtables. Currently the list will contain a single subtable containing all marks and bases, although at a later date it may return the optimal list of subtables subsetting the marks and bases into groups which save space. See :func:`buildMarkBasePosSubtable` below. Note that if you are implementing a layout compiler, you may find it more flexible to use :py:class:`fontTools.otlLib.lookupBuilders.MarkBasePosBuilder` instead. Example:: # a1, a2, a3, a4, a5 = buildAnchor(500, 100), ... marks = {"acute": (0, a1), "grave": (0, a1), "cedilla": (1, a2)} bases = {"a": {0: a3, 1: a5}, "b": {0: a4, 1: a5}} markbaseposes = buildMarkBasePos(marks, bases, font.getReverseGlyphMap()) Args: marks (dict): A dictionary mapping anchors to glyphs; the keys being glyph names, and the values being a tuple of mark class number and an ``otTables.Anchor`` object representing the mark's attachment point. (See :func:`buildMarkArray`.) bases (dict): A dictionary mapping anchors to glyphs; the keys being glyph names, and the values being dictionaries mapping mark class ID to the appropriate ``otTables.Anchor`` object used for attaching marks of that class. (See :func:`buildBaseArray`.) glyphMap: a glyph name to ID map, typically returned from ``font.getReverseGlyphMap()``. Returns: A list of ``otTables.MarkBasePos`` objects. )�buildMarkBasePosSubtable)rfr�rs r"r�r�os��^ %�U�E�8� <� <� =�=r0c�T�tj��}d|_t||��|_t ||��|_td�|���D����dz|_ t||��|_ t||j |��|_ |S)a�Build a single MarkBasePos (GPOS4) subtable. This builds a mark-to-base lookup subtable containing all of the referenced marks and bases. See :func:`buildMarkBasePos`. Args: marks (dict): A dictionary mapping anchors to glyphs; the keys being glyph names, and the values being a tuple of mark class number and an ``otTables.Anchor`` object representing the mark's attachment point. (See :func:`buildMarkArray`.) bases (dict): A dictionary mapping anchors to glyphs; the keys being glyph names, and the values being dictionaries mapping mark class ID to the appropriate ``otTables.Anchor`` object used for attaching marks of that class. (See :func:`buildBaseArray`.) glyphMap: a glyph name to ID map, typically returned from ``font.getReverseGlyphMap()``. Returns: A ``otTables.MarkBasePos`` object. r$c��g|]\}}|��Sr,r,�r-r�r&s r"r/z,buildMarkBasePosSubtable.<locals>.<listcomp>����:�:�:�%�"�a�2�:�:�:r0) r� MarkBasePosrr#� MarkCoverager�r|rf�valuesr�� BaseCoveragerPrJ)rfr�rr s r"r�r��s���* �>� � �D��D�K�%�e�X�6�6�D��#�E�8�4�4�D�N��:�:�5�<�<�>�>�:�:�:�;�;�a�?�D�O�%�e�X�6�6�D��#�E�4�?�H�E�E�D�N� �Kr0c�&�t|||��gS)a�Build a list of MarkLigPos (GPOS5) subtables. This routine turns a set of marks and ligatures into a list of mark-to-ligature positioning subtables. Currently the list will contain a single subtable containing all marks and ligatures, although at a later date it may return the optimal list of subtables subsetting the marks and ligatures into groups which save space. See :func:`buildMarkLigPosSubtable` below. Note that if you are implementing a layout compiler, you may find it more flexible to use :py:class:`fontTools.otlLib.lookupBuilders.MarkLigPosBuilder` instead. Example:: # a1, a2, a3, a4, a5 = buildAnchor(500, 100), ... marks = { "acute": (0, a1), "grave": (0, a1), "cedilla": (1, a2) } ligs = { "f_i": [ { 0: a3, 1: a5 }, # f { 0: a4, 1: a5 } # i ], # "c_t": [{...}, {...}] } markligposes = buildMarkLigPos(marks, ligs, font.getReverseGlyphMap()) Args: marks (dict): A dictionary mapping anchors to glyphs; the keys being glyph names, and the values being a tuple of mark class number and an ``otTables.Anchor`` object representing the mark's attachment point. (See :func:`buildMarkArray`.) ligs (dict): A mapping of ligature names to an array of dictionaries: for each component glyph in the ligature, an dictionary mapping mark class IDs to anchors. (See :func:`buildLigatureArray`.) glyphMap: a glyph name to ID map, typically returned from ``font.getReverseGlyphMap()``. Returns: A list of ``otTables.MarkLigPos`` objects. )�buildMarkLigPosSubtable)rfr�rs r"r�r��s��d $�E�4�� :� :� ;�;r0c�T�tj��}d|_t||��|_t ||��|_td�|���D����dz|_ t||��|_ t||j |��|_ |S)a`Build a single MarkLigPos (GPOS5) subtable. This builds a mark-to-base lookup subtable containing all of the referenced marks and bases. See :func:`buildMarkLigPos`. Args: marks (dict): A dictionary mapping anchors to glyphs; the keys being glyph names, and the values being a tuple of mark class number and an ``otTables.Anchor`` object representing the mark's attachment point. (See :func:`buildMarkArray`.) ligs (dict): A mapping of ligature names to an array of dictionaries: for each component glyph in the ligature, an dictionary mapping mark class IDs to anchors. (See :func:`buildLigatureArray`.) glyphMap: a glyph name to ID map, typically returned from ``font.getReverseGlyphMap()``. Returns: A ``otTables.MarkLigPos`` object. r$c��g|]\}}|��Sr,r,r�s r"r/z+buildMarkLigPosSubtable.<locals>.<listcomp> r�r0) r� MarkLigPosrr#r�r�r|rfr�r��LigatureCoveragerwrs)rfr�rr s r"r�r��s���( �=�?�?�D��D�K�%�e�X�6�6�D��#�E�8�4�4�D�N��:�:�5�<�<�>�>�:�:�:�;�;�a�?�D�O�)�$��9�9�D��+�D�$�/�8�L�L�D�� �Kr0c��t|t��sJ�t|tj��sJ�tj��}||_||_|Sr+)rArBrr:r}r!� MarkAnchor)�classIDr�r s r"r~r~sN�� �g�s� #� #�#�#� #� �f�b�i� (� (�(�(� (� �=�?�?�D��D�J��D�O� �Kr0c�:�tj��}||_|Sr+)rr�� Mark2AnchorrSs r"r�r�s�� �>� � �D��D�� �Kr0c�j�|�|Sd}|D])}|�%||�|||���z}�*|Sr��� getFormat)�fr�r��maskr[s r"�_getValueFormatr�#sO���}��� �D��)�)�� � ��q��!5� �E�!�H�&�&�(�(� (�D�� �Kr0c��t��}td���}td���}t|��D]D\}}|�|��|�|��|�|���Et j��} d| _t||� ��d��x}| _ t||� ��d��x}| _ t||��| _ |���| _|���| _|���} |���} g| _| D]�} t j��} g| _| j�| ��| D]~}t j��}|�| |fd��\}}|rt-||���nd |_|rt-||���nd |_| j�|�����t3| j��| _t3| ��| _| S) a�Builds a class pair adjustment (GPOS2 format 2) subtable. Kerning tables are generally expressed as pair positioning tables using class-based pair adjustments. This routine builds format 2 PairPos subtables. Note that if you are implementing a layout compiler, you may find it more flexible to use :py:class:`fontTools.otlLib.lookupBuilders.ClassPairPosSubtableBuilder` instead, as this takes care of ensuring that the supplied pairs can be formed into non-overlapping classes and emitting individual subtables whenever the non-overlapping requirement means that a new subtable is required. Example:: pairs = {} pairs[( [ "K", "X" ], [ "W", "V" ] )] = ( buildValue(xAdvance=+5), buildValue() ) # pairs[(... , ...)] = (..., ...) pairpos = buildPairPosClassesSubtable(pairs, font.getReverseGlyphMap()) Args: pairs (dict): Pair positioning data; the keys being a two-element tuple of lists of glyphnames, and the values being a two-element tuple of ``otTables.ValueRecord`` objects. glyphMap: a glyph name to ID map, typically returned from ``font.getReverseGlyphMap()``. valueFormat1: Force the "left" value records to the given format. valueFormat2: Force the "right" value records to the given format. Returns: A ``otTables.PairPos`` object. Tr�Fr%rr$r���src� valueFormatN)rr�rr�r�r�PairPosrr�r�� ValueFormat1� ValueFormat2r#rr�� ClassDef1� ClassDef2r�� Class1Record� Class2Recordrpr�r �Value1�Value2r>� Class1Count� Class2Count)r r� valueFormat1� valueFormat2rt� classDef1� classDef2r�r�r �classes1�classes2�c1�rec1�c2�rec2�val1�val2s r"rr.s:��N�u�u�H��$�/�/�/�I��%�0�0�0�I��5�M�M�����S��������� � �c����� � �c����� �:�<�<�D��D�K�'6�|�U�\�\�^�^�UV�'W�'W�W�L�4�$�'6�|�U�\�\�^�^�UV�'W�'W�W�L�4�$�!�(�H�5�5�D�M��_�_�&�&�D�N��_�_�&�&�D�N�� � �"�"�H�� � �"�"�H��D���+�+���� � ����� �� � ��&�&�&�� +� +�B��?�$�$�D����B��8�\�:�:�J�D�$� �� ��,�?�?�?�?�� �K� �� ��,�?�?�?�?�� �K� � � $� $�T� *� *� *� *� +��4�,�-�-�D���8�}�}�D�� �Kr0c�D��i}|���D]\\\}}\}}|�|���nd}|�|���nd}|�||fi��} ||f| ||f<�]�fd�t|�����D��S)a�Builds a list of glyph-based pair adjustment (GPOS2 format 1) subtables. This organises a list of pair positioning adjustments into subtables based on common value record formats. Note that if you are implementing a layout compiler, you may find it more flexible to use :py:class:`fontTools.otlLib.lookupBuilders.PairPosBuilder` instead. Example:: pairs = { ("K", "W"): ( buildValue(xAdvance=+5), buildValue() ), ("K", "V"): ( buildValue(xAdvance=+5), buildValue() ), # ... } subtables = buildPairPosGlyphs(pairs, font.getReverseGlyphMap()) Args: pairs (dict): Pair positioning data; the keys being a two-element tuple of glyphnames, and the values being a two-element tuple of ``otTables.ValueRecord`` objects. glyphMap: a glyph name to ID map, typically returned from ``font.getReverseGlyphMap()``. Returns: A list of ``otTables.PairPos`` objects. Nrc�@��g|]\\}}}t|�||����Sr,)�buildPairPosGlyphsSubtable)r-�formatA�formatB�posrs �r"r/z&buildPairPosGlyphs.<locals>.<listcomp>�s@��� � � � %� �g�w�� #�3��'�7�C�C� � � r0)rgr�rhr) r rrs�glyphA�glyphB�valA�valBr�r�r�s ` r"rr}s����@ �A�*/�+�+�-�-�-�-�&����,�4��&*�&6�$�.�.�"�"�"�A��&*�&6�$�.�.�"�"�"�A���l�l�G�W�-�r�2�2��!%�t� ��V�V� ��� � � � �)/���� � �):�):� � � �r0c����tj��}d|_t||���d��x}|_t||���d��x}|_i}|���D]7\\}}\}} |�|g��� ||| f���8td�|� ��D�����|_ g|_ |j jD]�} tj ��} g| _|j � | ��t!|| �fd����D]n\} } }tj��}| |_|rt%| |���nd|_|rt%||���nd|_| j� |���ot+| j��| _��t+|j ��|_|S)a�Builds a single glyph-based pair adjustment (GPOS2 format 1) subtable. This builds a PairPos subtable from a dictionary of glyph pairs and their positioning adjustments. See also :func:`buildPairPosGlyphs`. Note that if you are implementing a layout compiler, you may find it more flexible to use :py:class:`fontTools.otlLib.lookupBuilders.PairPosBuilder` instead. Example:: pairs = { ("K", "W"): ( buildValue(xAdvance=+5), buildValue() ), ("K", "V"): ( buildValue(xAdvance=+5), buildValue() ), # ... } pairpos = buildPairPosGlyphsSubtable(pairs, font.getReverseGlyphMap()) Args: pairs (dict): Pair positioning data; the keys being a two-element tuple of glyphnames, and the values being a two-element tuple of ``otTables.ValueRecord`` objects. glyphMap: a glyph name to ID map, typically returned from ``font.getReverseGlyphMap()``. valueFormat1: Force the "left" value records to the given format. valueFormat2: Force the "right" value records to the given format. Returns: A ``otTables.PairPos`` object. r$rc��h|]\}}|��Sr,r,)r-r�r&s r"� <setcomp>z-buildPairPosGlyphsSubtable.<locals>.<setcomp>�s��">�">�">���A�1�">�">�">r0c� ���|dSr�r,)r�rs �r"r�z,buildPairPosGlyphsSubtable.<locals>.<lambda>�s����!�A�$��r0rr�N)rr�rr�r�r�r�rgrhrpr#rdr�PairSetr�PairValueRecordr� SecondGlyphr r�r�r>�PairValueCount� PairSetCount)r rr�r�r rsr�r�r�r�rY�psrr�r��pvrs ` r"r�r��s����@ �:�<�<�D��D�K�'6�|�U�\�\�^�^�UV�'W�'W�W�L�4�$�'6�|�U�\�\�^�^�UV�'W�'W�W�L�4�$� �A�*/�+�+�-�-�>�>�&����,�4�� � � �V�R� � �'�'���t�(<�=�=�=�=�!�">�">������">�">�">��I�I�D�M��D�L���%�4�4�� �Z�\�\����� � ���B����"(��5��7O�7O�7O�7O�"P�"P�"P� +� +� �F�D�$��$�&�&�C�$�C�O� �� ��,�?�?�?�?�� �J� �� ��,�?�?�?�?�� �J� � � %� %�c� *� *� *� *��� 2�3�3�����D�L�)�)�D�� �Kr0c�j������gt��c}�iiic}}�|���D]q\}}t|���|��g���|��|��dg������|��<�r|���D]o\�}t |��t ���zdkrG��fd�|D��}|�t|�����������p|���D]�\} } �fd�| D��} t | ��dkrgi} | D]*�| � ��fd�|�D�����+|�t| ������� | ����|���D];\�}��vr2|D]} t| ��i���}�|�|���<|� �fd����|S) a�Builds a list of single adjustment (GPOS1) subtables. This builds a list of SinglePos subtables from a dictionary of glyph names and their positioning adjustments. The format of the subtables are determined to optimize the size of the resulting subtables. See also :func:`buildSinglePosSubtable`. Note that if you are implementing a layout compiler, you may find it more flexible to use :py:class:`fontTools.otlLib.lookupBuilders.SinglePosBuilder` instead. Example:: mapping = { "V": buildValue({ "xAdvance" : +5 }), # ... } subtables = buildSinglePos(pairs, font.getReverseGlyphMap()) Args: mapping (dict): A mapping between glyphnames and ``otTables.ValueRecord`` objects. glyphMap: a glyph name to ID map, typically returned from ``font.getReverseGlyphMap()``. Returns: A list of ``otTables.SinglePos`` objects. rr�c�"��i|] }|���� Sr,r,)r-r�rr�s ��r"r�z"buildSinglePos.<locals>.<dictcomp> s���=�=�=��a����=�=�=r0c���g|]}|�v�|�� Sr,r,)r-�k�handleds �r"r/z"buildSinglePos.<locals>.<listcomp> s#��� 2� 2� 2�A��'�!1�!1�a�!1�!1�!1r0r$c3�,�K�|]}|��fV��dSr+r,)r-r�r�r�s ��r"r7z!buildSinglePos.<locals>.<genexpr># s+�����%K�%K��q�&��)�n�%K�%K�%K�%K�%K�%Kr0c�$��t|���Sr+)�_getSinglePosTableKey)r5rs �r"r�z buildSinglePos.<locals>.<lambda>7 s���3�A�x�@�@�r0r) rrg�_getSinglePosValueKeyrhrpr>�_getSinglePosValueSize�buildSinglePosSubtabler�r��sort)r�rri� coverages�masksrYr[r�format1Mappingr�rd�f2�format2Mappingr�r.r�r�rr�s ` @@@@r"r(r(�s�������<�#�%�%�O�F�G� "�2�r��I�u�f�� � ����� ��u�#�E�*�*�����S�"�%�%�,�,�U�3�3�3� ����Q���$�$�+�+�C�0�0�0���s� � �!���(�(��� ��V� �v�;�;�/��4�4� 4�q� 8� 8�=�=�=�=�=�f�=�=�=�N� �M�M�0���J�J� K� K� K� �K�K�� � � �� #�[�[�]�]���� �T� 2� 2� 2� 2�� 2� 2� 2�� �r�7�7�Q�;�;��N�� L� L���%�%�%K�%K�%K�%K�%K�i��l�%K�%K�%K�K�K�K�K� �M�M�0���J�J� K� K� K� �N�N�2� � � ��!���(�(��� ��V� �g� � �� H� H��+�Q��s� �,<�h�G�G��� �M�M�"� � � �� �K�K�@�@�@�@�K�A�A�A� �Mr0c�����tj��}t����|��|_t t jd�����D��d��x�|_ ��fd�|jj D���t�fd��D����r(d|_ |j dkr�d|_ n/d|_ n'd|_ �|_ t|j ��|_|S)a�Builds a single adjustment (GPOS1) subtable. This builds a list of SinglePos subtables from a dictionary of glyph names and their positioning adjustments. The format of the subtable is determined to optimize the size of the output. See also :func:`buildSinglePos`. Note that if you are implementing a layout compiler, you may find it more flexible to use :py:class:`fontTools.otlLib.lookupBuilders.SinglePosBuilder` instead. Example:: mapping = { "V": buildValue({ "xAdvance" : +5 }), # ... } subtable = buildSinglePos(pairs, font.getReverseGlyphMap()) Args: mapping (dict): A mapping between glyphnames and ``otTables.ValueRecord`` objects. glyphMap: a glyph name to ID map, typically returned from ``font.getReverseGlyphMap()``. Returns: A ``otTables.SinglePos`` object. c�6�g|]}|�����Sr,r��r-�vs r"r/z*buildSinglePosSubtable.<locals>.<listcomp>\ s ��<�<�<�q�Q�[�[�]�]�<�<�<r0rc�>��g|]}t�|������S)r�)r )r-r�r�r�s ��r"r/z*buildSinglePosSubtable.<locals>.<listcomp>^ s:������ � ��q� �{�;�;�;���r0c3�0�K�|]}|�dkV��dSr2r,)r-r�� valueRecordss �r"r7z)buildSinglePosSubtable.<locals>.<genexpr>b s,����� 6� 6�A�1� �Q�� � 6� 6� 6� 6� 6� 6r0r$Nr%)r� SinglePosr#rdrrrB�__or__r�� ValueFormatrr9r�Valuer>� ValueCount)r�rr r�r�s` @@r"r�r�; s �����< �<�>�>�D�!�&�+�+�-�-��:�:�D�M�%+� � �<�<�F�M�M�O�O�<�<�<�a�&�&��K�$�"��������%����L� � 6� 6� 6� 6�� 6� 6� 6�6�6� *��� � � �q� � �%�a��D�J�J��D�J�J��� �!�� ��d�j�/�/��� �Kr0c��t|tj��s J|���|jj}t |�� ||dfSr�)rArr�rrr>)rrrrs r"r�r�o sI�� �h�� � -� -�7�7�x�7�7� -� � � %�F� ��[�[�L�(�6�!�9�-� .�.r0c���t|t��s J|���dg}}|j���D]q\}}t|tj��r%|�|t|��f��n|�||f��|t|dz}�r|� ��|� d|��t|��Sr�) rAr �__dict__rgrrdrp�_makeDeviceTupler r�rJ�tuple)� valueRecordr�ri�namer[s r"r�r�u s��� �k�;� /� /�<�<��<�<� /��R��K�"�+�1�1�3�3�6�6� ��e� �e�R�Y� '� '� )� �M�M�4�!1�%�!8�!8�9� :� :� :� :� �M�M�4��-� (� (� (��,�T�2�1�5�5� � � �K�K�M�M�M� �M�M�!�[�!�!�!� ��=�=�r0� _DeviceTuplez(DeltaFormat StartSize EndSize DeltaValuec��t|j|j|j|jdzrdnt |j����S)Ni�r,)r�rirergr�rh)�devices r"r�r�� sD�� �������� �6�)�G���u�V�5F�/G�/G�  � �r0c��d}|dd�D]:\}}t|t��r|t|j��dzz }�5|dz }�;|S)Nrr$r�)rAr�r>rh)�valueKey�countr&r�s r"r�r�� s_�� �E����� �����1� �a�� &� &� � �S���&�&��*� *�E�E� �Q�J�E�E� �Lr0c�x�t��}|���D]\}}t|||���|S)a�Builds a positioning value record. Value records are used to specify coordinates and adjustments for positioning and attaching glyphs. Many of the positioning functions in this library take ``otTables.ValueRecord`` objects as arguments. This function builds value records from dictionaries. Args: value (dict): A dictionary with zero or more of the following keys: - ``xPlacement`` - ``yPlacement`` - ``xAdvance`` - ``yAdvance`` - ``xPlaDevice`` - ``yPlaDevice`` - ``xAdvDevice`` - ``yAdvDevice`` Returns: An ``otTables.ValueRecord`` object. )r rgr )r[r r�r�s r"� buildValuer�� sB��, �=�=�D�� � � � �����1���a������ �Kr0c�����sdStj��}t����|��|_�fd�|jjD��|_t|j��|_|S)a�Builds an AttachList subtable. A GDEF table may contain an Attachment Point List table (AttachList) which stores the contour indices of attachment points for glyphs with attachment points. This routine builds AttachList subtables. Args: attachPoints (dict): A mapping between glyph names and a list of contour indices. Returns: An ``otTables.AttachList`` object if attachment points are supplied, or ``None`` otherwise. Nc�:��g|]}t�|����Sr,)�buildAttachPoint)r-r�� attachPointss �r"r/z#buildAttachList.<locals>.<listcomp>� s&���X�X�X�a�(��a��9�9�X�X�Xr0) r� AttachListr#rdrr� AttachPointr>r�)r�rr s` r"�buildAttachListr�� sr��� ���t� �=�?�?�D�!�,�"3�"3�"5�"5�x�@�@�D�M�X�X�X�X�4�=�CW�X�X�X�D���$�*�+�+�D�O� �Kr0c��|sdStj��}tt|����|_t |j��|_|Sr+)rr�rr� PointIndexr>� PointCount)�pointsr s r"r�r�� sI�� ���t� �>� � �D��S��[�[�)�)�D�O��$�/�*�*�D�O� �Kr0c��tj��}t|t��rd|_|\|_|_nd|_||_|S)Nr�r$)r� CaretValuerAr�r� Coordinate� DeviceTable)�coordr s r"�buildCaretValueForCoordr� sM�� �=�?�?�D��%���� ��� �,1�)����)�)��� ���� �Kr0c�H�tj��}d|_||_|S)Nr%)rrr�CaretValuePoint)rAr s r"�buildCaretValueForPointr � s!�� �=�?�?�D��D�K� �D�� �Kr0c������r!t������n t��}�r'|���������fd�|D���d�����D����sdSt j��}t ����|��|_�fd�|jjD��|_ t|j ��|_ |S)a�Builds a ligature caret list table. Ligatures appear as a single glyph representing multiple characters; however when, for example, editing text containing a ``f_i`` ligature, the user may want to place the cursor between the ``f`` and the ``i``. The ligature caret list in the GDEF table specifies the position to display the "caret" (the character insertion indicator, typically a flashing vertical bar) "inside" the ligature to represent an insertion point. The insertion positions may be specified either by coordinate or by contour point. Example:: coords = { "f_f_i": [300, 600] # f|fi cursor at 300 units, ff|i cursor at 600. } points = { "c_t": [28] # c|t cursor appears at coordinate of contour point 28. } ligcaretlist = buildLigCaretList(coords, points, font.getReverseGlyphMap()) Args: coords: A mapping between glyph names and a list of coordinates for the insertion point of each ligature component after the first one. points: A mapping between glyph names and a list of contour points for the insertion point of each ligature component after the first one. glyphMap: a glyph name to ID map, typically returned from ``font.getReverseGlyphMap()``. Returns: A ``otTables.LigCaretList`` object if any carets are present, or ``None`` otherwise.c �~��i|]9}|t��|����|������:Sr,)� buildLigGlyphr�)r-r��coordsrs ��r"r�z%buildLigCaretList.<locals>.<dictcomp> s9��� M� M� M��a��v�z�z�!�}�}�f�j�j��m�m�<�<� M� M� Mr0c��i|] \}}|�||�� Sr+r,)r-r�rs r"r�z%buildLigCaretList.<locals>.<dictcomp> s�� ?� ?� ?�t�q�!���a����r0Nc� ��g|] }�|�� Sr,r,)r-r��caretss �r"r/z%buildLigCaretList.<locals>.<listcomp> s���=�=�=�1�V�A�Y�=�=�=r0) rrdr�rgr� LigCaretListr#rrr7r>� LigGlyphCount)rrrrr rs`` @r"�buildLigCaretListr� s������@$*� 4�S������ � � �s�u�u�F� �%�� � �f�k�k�m�m�$�$�$� M� M� M� M� M�f� M� M� M�F� ?� ?�v�|�|�~�~� ?� ?� ?�F� ���t� �?� � �D�!�&�+�+�-�-��:�:�D�M�=�=�=�=�� �(<�=�=�=�D�M��T�]�+�+�D�� �Kr0c�:�g}|r1t|d����}|�d�|D����|r,|�d�t|��D����|sdStj��}||_t |j��|_|S)Nc�@�t|t��r|dn|Sr�)rAr�)rs r"r�zbuildLigGlyph.<locals>.<lambda>% s��j��E�6J�6J�.Q�a��d�d�PQ�r0rc�,�g|]}t|����Sr,)rrs r"r/z!buildLigGlyph.<locals>.<listcomp>& s!��B�B�B�a�.�q�1�1�B�B�Br0c�,�g|]}t|����Sr,)r )r-rss r"r/z!buildLigGlyph.<locals>.<listcomp>( s!��J�J�J�a�.�q�1�1�J�J�Jr0)rr�rr7rr>� CaretCount)rrrr s r"rr! s��� �F� �D���$Q�$Q�R�R�R��� � �B�B�6�B�B�B�C�C�C� �L�� � �J�J�6�&�>�>�J�J�J�K�K�K� ���t� �;�=�=�D��D�O��$�/�*�*�D�O� �Kr0c���|sdStj��}d|_�fd�|D��|_t |j��|_|S)aBuilds a mark glyph sets definition table. OpenType Layout lookups may choose to use mark filtering sets to consider or ignore particular combinations of marks. These sets are specified by setting a flag on the lookup, but the mark filtering sets are defined in the ``GDEF`` table. This routine builds the subtable containing the mark glyph set definitions. Example:: set0 = set("acute", "grave") set1 = set("caron", "grave") markglyphsets = buildMarkGlyphSetsDef([set0, set1], font.getReverseGlyphMap()) Args: markSets: A list of sets of glyphnames. glyphMap: a glyph name to ID map, typically returned from ``font.getReverseGlyphMap()``. Returns An ``otTables.MarkGlyphSetsDef`` object. Nr$c�0��g|]}t|�����Sr,)r#)r-�mrs �r"r/z)buildMarkGlyphSetsDef.<locals>.<listcomp>N s#���B�B�B�A�]�1�h�/�/�B�B�Br0)r�MarkGlyphSetsDef�MarkSetTableFormatrr>� MarkSetCount)�markSetsrr s ` r"�buildMarkGlyphSetsDefr"1 sZ���2 ���t� � � � �D��D��B�B�B�B��B�B�B�D�M��D�M�*�*�D�� �Kr0c�0�eZdZdZd�Zd�Zd�Zd�Zd�ZdS)r�z$Helper for building ClassDef tables.c�H�t��|_i|_||_dSr+)r�classes_�glyphs_� useClass0_)r r�s r"rTzClassDefBuilder.__init__V s������ ��� �#����r0c��t|ttf��rt|��}t |��}||jvrdS|D]}||jvrdS�dS)NTF)rAr� frozensetrr�r%r&�r rrYs r"r�zClassDefBuilder.canAdd[ sn�� �f�s�I�.� /� /� $��F�^�^�F��v���� �T�]� "� "��4�� � �E��� �$�$��u�u�%��tr0c��t|ttf��rt|��}t |��}||jvrdS|j�|��|D])}||jvrtd|�d�d���||j|<�*dS)NzGlyph z is already present in class.) rArr)rr�r%r�r&rr*s r"r�zClassDefBuilder.addf s��� �f�s�I�.� /� /� $��F�^�^�F��v���� �T�]� "� "� �F� � ���&�!�!�!�� )� )�E��� �$�$�&�A�U�A�A�A�4����#)�D�L�� � �  )� )r0c��t|jd����}|js"|�dt ����|S)Nc�&�t|�� |fSr+r�)rzs r"r�z)ClassDefBuilder.classes.<locals>.<lambda>� s��s�1�v�v�g�q�\�r0rr)rr%r'rJr)r�s r"r�zClassDefBuilder.classest sC���� �+A�+A�B�B�B���� *� �M�M�!�Y�[�[� )� )� )�� r0c��i}t|�����D]\}}|dkr� |D]}|||<��tj��}||_|Sr�)r#r�rr r)r � glyphClassesr�rrY�classDefs r"r�zClassDefBuilder.build� so��� �(������8�8� .� .�O�G�V��!�|�|��� .� .��&-� �U�#�#� .��;�=�=��)����r0N) r�r�r�r�rTr�r�r�r�r,r0r"r�r�S se������.�.�$�$�$� � � � )� )� )����$ � � � � r0r�i�i���Tc�h�tjd��|d<tj��x}|d_t ||||���|_t||||���\}}|sd|_n d|_t|||||���} | |z}|dj � ��tj ��} || _ d|_| |_t!|��|_d|_d |_|r7tj��} || _| |_t!|��|_d Sd S) a� Add a 'STAT' table to 'ttFont'. 'axes' is a list of dictionaries describing axes and their values. Example:: axes = [ dict( tag="wght", name="Weight", ordering=0, # optional values=[ dict(value=100, name='Thin'), dict(value=300, name='Light'), dict(value=400, name='Regular', flags=0x2), dict(value=900, name='Black'), ], ) ] Each axis dict must have 'tag' and 'name' items. 'tag' maps to the 'AxisTag' field. 'name' can be a name ID (int), a string, or a dictionary containing multilingual names (see the addMultilingualName() name table method), and will translate to the AxisNameID field. An axis dict may contain an 'ordering' item that maps to the AxisOrdering field. If omitted, the order of the axes list is used to calculate AxisOrdering fields. The axis dict may contain a 'values' item, which is a list of dictionaries describing AxisValue records belonging to this axis. Each value dict must have a 'name' item, which can be a name ID (int), a string, or a dictionary containing multilingual names, like the axis name. It translates to the ValueNameID field. Optionally the value dict can contain a 'flags' item. It maps to the AxisValue Flags field, and will be 0 when omitted. The format of the AxisValue is determined by the remaining contents of the value dictionary: If the value dict contains a 'value' item, an AxisValue record Format 1 is created. If in addition to the 'value' item it contains a 'linkedValue' item, an AxisValue record Format 3 is built. If the value dict contains a 'nominalValue' item, an AxisValue record Format 2 is built. Optionally it may contain 'rangeMinValue' and 'rangeMaxValue' items. These map to -Infinity and +Infinity respectively if omitted. You cannot specify Format 4 AxisValue tables this way, as they are not tied to a single axis, and specify a name for a location that is defined by multiple axes values. Instead, you need to supply the 'locations' argument. The optional 'locations' argument specifies AxisValue Format 4 tables. It should be a list of dicts, where each dict has a 'name' item, which works just like the value dicts above, an optional 'flags' item (defaulting to 0x0), and a 'location' dict. A location dict key is an axis tag, and the associated value is the location on the specified axis. They map to the AxisIndex and Value fields of the AxisValueRecord. Example:: locations = [ dict(name='Regular ABCD', location=dict(wght=300, ABCD=100)), dict(name='Bold ABCD XYZ', location=dict(wght=600, ABCD=200)), ] The optional 'elidedFallbackName' argument can be a name ID (int), a string, a dictionary containing multilingual names, or a list of STATNameStatements. It translates to the ElidedFallbackNameID field. The 'ttFont' argument must be a TTFont instance that already has a 'name' table. If a 'STAT' table already exists, it will be overwritten by the newly created one. �STAT��windows�mac)� windowsNames�macNamesiir�r'rN)r�newTablerr2rP�_addName�ElidedFallbackNameID�_buildAxisRecords�Version�_buildAxisValuesFormat4�namesr��AxisRecordArray�Axis�DesignAxisRecordSize�DesignAxisRecordr>�DesignAxisCount�AxisValueCount�AxisValueArray� AxisValue) �ttFont�axesr �elidedFallbackNamer6r7� statTable� axisRecords� axisValues�multiAxisValues�axisRecordArray�axisValueArrays r"�buildStatTablerP� sc��h�^�F�+�+�F�6�N�')�w�y�y�0�I��v��$�%-��"�L�h�&�&�&�I�"� 0� �f�<�(�����K�� � 2�&� ���'� ��1� �t�V�,�� � � ��%�z�1� � �6�N��������(�*�*�O�&�O��%&�I�"�!0�I�� #�K� 0� 0�I�� �I��#�I���3��*�,�,��#-�� �#1� � �#&�z�?�?� � � � � 3�3r0c�X�g}g}t|��D�]�\}}tj��}|d|_t ||dd||���|_|�d|��|_|�|��|�dd��D�]} tj ��} || _ | �dd ��| _ t || d||���| _ d | vr.| d | _ d | vrd | _| d | _npd | _nhd| vrUd| _| d| _| �dt"��| _| �dt&��| _nt+d���|�| �������||fS)N�tagr��r3�orderingr�r,rDrr[� linkedValuer�r$� nominalValuer%� rangeMinValue� rangeMaxValuez$Can't determine format for AxisValue)r#r� AxisRecord�AxisTagr9� AxisNameIDr�� AxisOrderingrprF� AxisIndex�Flags� ValueNameIDr�r� LinkedValue� NominalValue�AXIS_VALUE_NEGATIVE_INFINITY� RangeMinValue�AXIS_VALUE_POSITIVE_INFINITY� RangeMaxValuer) rHrGr6r7rKrL�axisRecordIndex�axisDict�axis�axisVal� axisValRecs r"r;r; s����K��J�%.�t�_�_�$*�$*�!����}�������� �"� �H�V�$�c�<�X� � � ���%�L�L��_�E�E������4� � � ��|�|�H�b�1�1� *� *�G�����J�#2�J� �&�{�{�7�A�6�6�J� �%-������8�&�&�&�J� "��'�!�!�#*�7�#3� � � �G�+�+�()�J�%�-4�]�-C�J�*�*�()�J�%�%��7�*�*�$%� �!�*1�.�*A� �'�+2�;�;�#�%A�,�,� �(�,3�;�;�#�%A�,�,� �(�(�!�!G�H�H�H� � � �j� )� )� )� )�7 *�8 � � "�"r0c�H�i}t|��D]\}}|||d<�g}|D]�} tj��} d| _t || d||���| _| �dd��| _g} | d���D]A\} } tj ��}|| |_ | |_ | � |���B| � d�� ��t| ��| _| | _ |� | ����|S) NrRr&r�r3rDrrOc��|jSr+)r])�avrs r"r�z)_buildAxisValuesFormat4.<locals>.<lambda>P s��c�m�r0r)r#rrFrr9r_r�r^rg�AxisValueRecordr]r�rpr�r>� AxisCount)r rHrGr6r7�axisTagToIndexrfrgrL�axisLocationDictrj�axisValueRecordsrRr[rms r"r=r== sM���N�%.�t�_�_�:�:�!���*9��x���'�'��J�%�&�&���\�^�^� �� ��!)� �$�V�,�l��" �" �" � ��,�/�/���;�;� ����*�:�6�<�<�>�>� )� )�J�C���$�&�&�C�*�3�/�C�M��C�I� � #� #�C� (� (� (� (����";�";��<�<�<�"�#3�4�4� ��%5� �"����*�%�%�%�%� �r0c��|d}t|t��r|St|t��rt|���}n�t|t��r|}n�t|t��rl|���}|D]S}t|t ��r.|�|j||j |j |j ���Etd���|Std���|� |||||���S)Nr�)�enz*value must be a list of STATNameStatementsz$value must be int, str, dict or list)rGr4r5� minNameID)rArBr�r+r��_findUnusedNameIDr�setName�string� platformID� platEncID�langID� TypeError�addMultilingualName) rGr[rur4r5� nameTabler>�nameID� nameRecords r"r9r9W s,���v��I��%������ ��%����@�������� �E�4� � �@���� �E�4� � �@��,�,�.�.��� N� N�J��*�&7�8�8� N��!�!��%���)��(��%� ���� � L�M�M�M�� ��>�?�?�?� � (� (� �f�g�3�)� )� � �r0c �T�|���} tjd��x|d<} tj��x| _} d| _| ���t|��| _ t| ||||��| _ t| |||| | ��| _ dS)a, Add a 'MATH' table to 'ttFont'. 'constants' is a dictionary of math constants. The keys are the constant names from the MATH table specification (with capital first letter), and the values are the constant values as numbers. 'italicsCorrections' is a dictionary of italic corrections. The keys are the glyph names, and the values are the italic corrections as numbers. 'topAccentAttachments' is a dictionary of top accent attachments. The keys are the glyph names, and the values are the top accent horizontal positions as numbers. 'extendedShapes' is a set of extended shape glyphs. 'mathKerns' is a dictionary of math kerns. The keys are the glyph names, and the values are dictionaries. The keys of these dictionaries are the side names ('TopRight', 'TopLeft', 'BottomRight', 'BottomLeft'), and the values are tuples of two lists. The first list contains the correction heights as numbers, and the second list contains the kern values as numbers. 'minConnectorOverlap' is the minimum connector overlap as a number. 'vertGlyphVariants' is a dictionary of vertical glyph variants. The keys are the glyph names, and the values are tuples of glyph name and full advance height. 'horizGlyphVariants' is a dictionary of horizontal glyph variants. The keys are the glyph names, and the values are tuples of glyph name and full advance width. 'vertGlyphAssembly' is a dictionary of vertical glyph assemblies. The keys are the glyph names, and the values are tuples of assembly parts and italics correction. The assembly parts are tuples of glyph name, flags, start connector length, end connector length, and full advance height. 'horizGlyphAssembly' is a dictionary of horizontal glyph assemblies. The keys are the glyph names, and the values are tuples of assembly parts and italics correction. The assembly parts are tuples of glyph name, flags, start connector length, end connector length, and full advance width. Where a number is expected, an integer or a float can be used. The floats will be rounded. Example:: constants = { "ScriptPercentScaleDown": 70, "ScriptScriptPercentScaleDown": 50, "DelimitedSubFormulaMinHeight": 24, "DisplayOperatorMinHeight": 60, ... } italicsCorrections = { "fitalic-math": 100, "fbolditalic-math": 120, ... } topAccentAttachments = { "circumflexcomb": 500, "acutecomb": 400, "A": 300, "B": 340, ... } extendedShapes = {"parenleft", "parenright", ...} mathKerns = { "A": { "TopRight": ([-50, -100], [10, 20, 30]), "TopLeft": ([50, 100], [10, 20, 30]), ... }, ... } vertGlyphVariants = { "parenleft": [("parenleft", 700), ("parenleft.size1", 1000), ...], "parenright": [("parenright", 700), ("parenright.size1", 1000), ...], ... } vertGlyphAssembly = { "braceleft": [ ( ("braceleft.bottom", 0, 0, 200, 500), ("braceleft.extender", 1, 200, 200, 200)), ("braceleft.middle", 0, 100, 100, 700), ("braceleft.extender", 1, 200, 200, 200), ("braceleft.top", 0, 200, 0, 500), ), 100, ], ... } �MATHiN)rNrr8rr�rPr<r�_buildMathConstants� MathConstants�_buildMathGlyphInfo� MathGlyphInfo�_buildMathVariants� MathVariants)rG� constants�italicsCorrections�topAccentAttachments�extendedShapes� mathKerns�minConnectorOverlap�vertGlyphVariants�horizGlyphVariants�vertGlyphAssembly�horizGlyphAssemblyr�mathrPs r"�buildMathTabler�u s���T�(�(�*�*�H�!�N�6�2�2�2�F�6�N�T�����"�D�J���E�M� ������-�i�8�8�E��-������ ��E��,������� ��E���r0c�L�|sdStj��}|���D]w}t|�|jd����}|jr0t|jtj��sJ�t|��}t||j|���x|Sr�) rr�� getConvertersrr�r�� tableClass� issubclass�MathValueRecord�_mathValueRecordr )r�� mathConstants�convr[s r"r�r�� s��� ���t��$�&�&�M��+�+�-�-�1�1��� � � �d�i��3�3�4�4�� �?� ,��d�o�r�/A�B�B� B� B�B�$�U�+�+�E�� �t�y�%�0�0�0�0� �r0c�^���t|��|g��sdStj��}|����r�t ����|��}tj��|_||j_t|j ��|j_ �fd�|j D��|j_ �r�t ����|��}tj ��|_ ||j _ t|j ��|j _�fd�|j D��|j _|rt ||��|_|�rNt |���|��}tj��|_||j_t|j ��|j_g|j_|j D]�}tj��}dD]�} | ||vr�||| \} } t| ��t| ��dz ksJ�tj��} t| ��| _d�| D��| _d�| D��| _t5|| �d�| ����|jj�|����|S)Nc�:��g|]}t�|����Sr,�r�)r-�nr�s �r"r/z'_buildMathGlyphInfo.<locals>.<listcomp> s5���< �< �< �89� �/��2� 3� 3�< �< �< r0c�:��g|]}t�|����Sr,r�)r-r�r�s �r"r/z'_buildMathGlyphInfo.<locals>.<listcomp>! s5���< �< �< �:;� �1�!�4� 5� 5�< �< �< r0>�TopLeft�TopRight� BottomLeft� BottomRightr$c�,�g|]}t|����Sr,r�)r-�hs r"r/z'_buildMathGlyphInfo.<locals>.<listcomp>6 s.��-�-�-�01�(��+�+�-�-�-r0c�,�g|]}t|����Sr,r�r�s r"r/z'_buildMathGlyphInfo.<locals>.<listcomp>9 s!��%N�%N�%N�a�&6�q�&9�&9�%N�%N�%Nr0�MathKern)r�rr�rr#rd�MathItalicsCorrectionInforr>r�ItalicsCorrectionCount�ItalicsCorrection�MathTopAccentAttachment�TopAccentCoverage�TopAccentAttachmentCount�TopAccentAttachment�ExtendedShapeCoverage� MathKernInfo�MathKernCoverage� MathKernCount�MathKernInfoRecords�MathKernInfoRecordr�� HeightCount�CorrectionHeight� KernValuer rp) rr�r�r�r�rrtrY�record�side�correctionHeights� kernValues�kerns `` r"r�r� s����� �� 2�4H�)�T� U� U���t� � � � �D�������� � �!3�!8�!8�!:�!:�H�E�E��)+�)E�)G�)G��&�2:��&�/�@C�H�O�@T�@T��&�=�< �< �< �< �=E�_�< �< �< ��&�8�� � �!5�!:�!:�!<�!<�h�G�G��')�'A�'C�'C��$�9A��$�6�@C�H�O�@T�@T��$�=�< �< �< �< �?G��< �< �< ��$�8��M�%2�>�8�%L�%L��"��A� ����!1�!1�8�<�<���O�-�-���-5���*�*-�h�o�*>�*>���'�02���-��_� A� A�E��*�,�,�F�L� =� =���9�U�+�+�+�4=�e�4D�T�4J�1�%�z��0�1�1�S��_�_�q�5H�H�H�H�H��;�=�=�D�'*�+<�'=�'=�D�$�-�-�5F�-�-�-�D�)�&O�%N�:�%N�%N�%N�D�N��F�t�$5�$5�$5�t�<�<�<�� � � 1� 8� 8�� @� @� @� @� �Kr0c��t||||g��sdStj��}|���||_|s|rt |||��\|_|_|s|rt |||��\|_|_ |Sr+) r�rr�r�MinConnectorOverlap�_buildMathGlyphConstruction�VertGlyphCoverage�VertGlyphConstruction�HorizGlyphCoverage�HorizGlyphConstruction)rr�r�r�r�r��variantss r"r�r�@ s��� � �.�0A�CU�V� � ���t��� � �H� ������#6�H� �� �-� � '��!�!� � � C��"�H�$B�� �/� � '��"�"� � � E��#�X�%D� �Or0c�r�t��}|r'|�|�����|r'|�|�����t||��}g}|jD�]�}t j��}|���|r{||vrwt||��|_ g|_ ||D]M\}} t j ��} || _ t| ��| _ |j �| ���N|r�||vr�||\} } t j��|_t!| ��|j_t| ��|j_g|j_| D]�} | \}}}}} t j��} || _t-|��| _t|��| _t|��| _t| ��| _|jj�| ����|�|�����||fSr+)rr�rdr#rr�MathGlyphConstructionrr>� VariantCount�MathGlyphVariantRecord� VariantGlyphr�AdvanceMeasurementrp� GlyphAssemblyr�r�� PartCount� PartRecords�GlyphPartRecordrYrB� PartFlags�StartConnectorLength�EndConnectorLength� FullAdvance)rr�� assembliesrrt� constructions� glyphName� construction� variantName�advancer��parts�ic�part� part_namerD�start�ends r"r�r�g s1�� �U�U�F��'�� � �h�m�m�o�o�&�&�&��)�� � �j�o�o�'�'�(�(�(��V�X�.�.�H��M��_�+�+� ��/�1�1� ��%�%�'�'�'� � C� �X�-�-�(+�H�Y�,?�(@�(@�L� %�24�L� /�(0��(;� C� C�$� �W��2�4�4��&1��#�,3�G�,<�,<��)��3�:�:�6�B�B�B�B� � F�)�z�1�1�"�9�-�I�E�2�)+�)9�);�);�L� &�;K�B�;O�;O�L� &� 8�36�u�:�:�L� &� 0�57�L� &� 2�� F� F��8<�5� �5�%��g��+�-�-��(�� �#&�u�:�:�� �.5�e�n�n��+�,3�C�L�L��)�%,�W�%5�%5��"��*�6�=�=�f�E�E�E�E����\�*�*�*�*� �]� "�"r0c�T�tj��}t|��|_|Sr+)rr�rr�)r[� value_records r"r�r�� s$���%�'�'�L� ����L�� �r0r2)NNNr�)Nr%TT)TT)rTT) NNNNNrNNNN)p� collectionsrrrw�os�fontTools.misc.fixedToolsr�fontTools.misc.roundToolsr� fontToolsr�fontTools.ttLib.tablesrr�fontTools.ttLib.tables.otBaser r r r r r�fontTools.feaLib.astr�fontTools.otlLib.optimize.gposrr�fontTools.otlLib.errorr� functoolsr�loggingr�� getLoggerr�r�r#�LOOKUP_FLAG_RIGHT_TO_LEFT�LOOKUP_FLAG_IGNORE_BASE_GLYPHS�LOOKUP_FLAG_IGNORE_LIGATURES�LOOKUP_FLAG_IGNORE_MARKSr@rF�objectrHr�r�r�r�r.r`rvr�r�r�r�r�r�r�r�rr\r�r�r�r~rDrPrMrWr�rorwrur�r�r�r�r�r~r�r�rrr�r(r�r�r�r�r�r�r�r�r�rr rrr"r�rbrdrPr;r=r9r�r�r�r�r�r�r,r0r"�<module>r�s���/�/�/�/�/�/�/�/����� � � � �2�2�2�2�2�2�-�-�-�-�-�-�������1�1�1�1�1�1���������������*�)�)�)�)�)�2�2�2�2�2�2���������4�3�3�3�3�3����������� � � � ��g���!�!��$�$�$�N#��!'��%��!��%+�"�6�6�6�6�r` �` �` �` �` �F�` �` �` �F.Q�.Q�.Q�.Q�.Q�M�.Q�.Q�.Q�b<�<�<�<�<��J�$�&O�&O�&O�P�P�<�<�<�/�/�/�/�/�/�/�/�d` �` �` �` �` �]�` �` �` �F *�*�*�*�*�3�*�*�*�ZM�M�M�M�M�5�M�M�M�`+P�+P�+P�+P�+P�=�+P�+P�+P�\#N�#N�#N�#N�#N�=�#N�#N�#N�L2'�2'�2'�2'�2'� �2'�2'�2'�jF,�F,�F,�F,�F,��F,�F,�F,�RA,�A,�A,�A,�A,� �A,�A,�A,�HE'�E'�E'�E'�E'��E'�E'�E'�P6 �6 �6 �6 �6 �]�6 �6 �6 �r+N�+N�+N�+N�+N��+N�+N�+N�\=)�=)�=)�=)�=)�&�=)�=)�=)�@t�t�t�t�t�]�t�t�t�n;,�;,�;,�;,�;,�}�;,�;,�;,�B���*���@���,(�(�(�\����>!�!�!�H������,&�&�&�R$�$�$�N'�'�'�T���!�!�!�H/>�/>�/>�d���>2<�2<�2<�j���<���������L�L�L�L�^)�)�)�X=�=�=�=�@O�O�O�d1�1�1�h/�/�/� � � ��z�.�*T�U�U� ����������>���0��� � � ����+�+�+�\ � � � ���D<�<�<�<�<�f�<�<�<�~ ,�|�K��<�<��+�|�J��;�;��UY�y3�y3�y3�y3�x(#�(#�(#�(#�V����4����@����������@�@�@�@�F � � �7�7�7�t$�$�$�N(#�(#�(#�V����r0
Memory