� ��g���X�dZddlmZmZmZmZddlmZmZm Z m Z ddl m Z ddl Z ddlZeje��Zd�Zd�Zd�Zd �Zd �Zd �Zd �Zd �Zd�ZdgdzZdegzedd�<degzedd�<degzedd�<degzedd�<eed<ee��dksJ�edd�Zeed<eed<edd�Zeed<eed<eed<gd�Zd�e e��D��Z!dZ"d�Z#gd�Z$d�Z%e%d��Z&e%d ��Z'e%d!��Z(e j)fd"�Z*ed��ed#��zZ+d$�Z,Gd%�d&e-��Z.Gd'�d(e/��Z0gd)�Z1Gd*�d+e0��Z2Gd,�d-e2��Z3Gd.�d/e3��Z4Gd0�d1e/��Z5Gd2�d3e5��Z6Gd4�d5e/��Z7d6�Z8dS)7zwpsCharStrings.py -- module implementing various kinds of CharStrings: CFF dictionary data and Type1/Type2 CharStrings. �)� fixedToFloat� floatToFixed�floatToFixedToStr�strToFixedToFloat)�bytechr�byteord� bytesjoin�strjoin)� BoundsPenNc���|dkr|t||��f}|dz}n|} |j|}n#t$rd|fcYSwxYw|�|��}||fS)N� �)r� operators�KeyError�handle_operator)�self�b0�data�index�op�operator�values �l/home/asafur/pinokio/api/open-webui.git/app/env/lib/python3.11/site-packages/fontTools/misc/psCharStrings.py� read_operatorrs��� �R�x�x��'�$�u�+�&�&� '���� ��� ����>�"�%���� �����U�{�������� � � �� *� *�E� �%�<�s� 5�A�Ac��|dz |fS)N���rrrrs r� read_byter"s�� ��8�U�?��c�R�t||��}|dz dz|zdz|dzfS)N����lr�r�rrrr�b1s r�read_smallInt1r(&s5�� ��e�� � �B� ��H�� �b� �3� &��� � 1�1r c�T�t||��}|dz dz|z dz |dzfS)N��r#r$rr%r&s r�read_smallInt2r++s7�� ��e�� � �B� �#�X�;�� �r� !�C� '���� 2�2r c�T�tjd|||dz���\}||dzfS)N�>h���struct�unpack�rrrrrs r� read_shortIntr30�2���}�T�4���� �(9�#:�;�;�H�U� �%�!�)� �r c�T�tjd|||dz���\}||dzfS)N�>l�r/r2s r� read_longIntr85r4r c�r�tjd|||dz���\}t|d���|dzfS)Nr6r7��� precisionBits)r0r1rr2s r�read_fixed1616r=:s?���}�T�4���� �(9�#:�;�;�H�U� ��R� 0� 0� 0�%�!�)� ;�;r c�&�tsJ�t|fS�N)�NotImplementedError�NotImplementedrs r� read_reservedrB?s�� ��� � �5� � r c���d} t||��}|dz}|dzdz }|dz}|dkrn(|t|z}|dkrn|t|z}�Vt|��|fS)N�Tr��r7�)r� realNibbles�float)rrrr�number�b�nibble0�nibble1s r�read_realNumberrMDs��� �F� /� �D��K� � ���� ���t�8��/���d�(�� �c�>�>� ��+�g�.�.�� �c�>�>� ��+�g�.�.�� /� ��=�=�%� �r r#� ��r"r7r*�����)�0�1�2�3�4�5�6�7�8�9�.�E�E-N�-c��i|]\}}||�� Srr)�.0�i�vs r� <dictcomp>rfws��;�;�;�D�A�q�1�a�;�;�;r ��c� �i}i}|D]y}t|��dkr|d||d<n|dd�||d<t|dt��r|d||d<�g|df||d<�z||fS)Nr.rr)�len� isinstance�tuple)� operatorList�oper�opc�items r�buildOperatorDictrp|s��� �D� �C��&�&�� �t�9�9��>�>� ��G�D��a��M�M� ����H�D��a��M� �d�1�g�u� %� %� &���7�C��Q��L�L� ��G�:�C��Q��L�L� ��9�r )4�r�hstem���vstem�r7�vmoveto���rlineto���hlineto���vlineto��� rrcurveto�� �callsubr�� �return���endchar)rF�vsindex)r:�blend)��hstemhm)��hintmask)��cntrmask���rmoveto���hmoveto)��vstemhm)�� rcurveline)�� rlinecurve)�� vvcurveto)�� hhcurveto)rR� callgsubr�rS� vhcurveto��� hvcurveto)�r r�ignore))r rt�and))r r7�or))r ry�not))r r��store))r � �abs))r r��add))r r��sub�)r r �div))r � �load))r r��neg))r rF�eq))r r��drop))r r��put))r r��get))r r��ifelse))r r��random))r r��mul))r r��sqrt))r r��dup))r rQ�exch))r rRr))r rS�roll))r �"�hflex))r �#�flex))r �$�hflex1))r �%�flex1c���|dkrtd��}td��}n1|dkrd}td��}n|dksJ�td��}d}|ttjtj|fd�}|S)N�cffrQrR�t1rP�t2c���d|cxkrdkrnn||dz��}n�d|cxkrdkr)nn&|dz }||dz dz��||dz��z}n�d |cxkrd kr*nn'| dz }||dz d z��||dz��z}nf|� d |cxkrd krnn||d|��z}nD|�3t�d��|d��|d|��z}n||d|��z}|S)Ni�����krr$�kr�r"rPi����i����r*i���i�r-zk4-byte T2 number got passed to the IntType handler. This should happen only when reading in old XML files. r6)�log�warning)r� fourByteOpr�packr1� twoByteOp�codes r� encodeIntz getIntEncoder.<locals>.encodeInt�s��� �5� � � � �C� � � � � ��7�5�3�;�'�'�D�D� �E� !� !� !� !�T� !� !� !� !� !��C�K�E��7�E�Q�J�#�-�.�.������1F�1F�F�D�D� �e� #� #� #� #�t� #� #� #� #� #��F�S�L�E��7�E�Q�J�#�-�.�.������1F�1F�F�D�D� � "�v��'?�'?�'?�'?�%�'?�'?�'?�'?�'?��t�t�D�%�0�0�0�D�D� � � �K�K�#� � � � �7�3�<�<�$�$�t�U�"3�"3�3�D�D����T�5� 1� 1�1�D�� r )rr0r�r1)�formatr�r�r�s r� getIntEncoderr��s��� �����B�K�K� ��R�[�[� � � �4���� ��S�\�\� � ���~�~�~�~��B�K�K� �� ��� �[��}�� #�#�#�#�J �r r�r�r�c�x�t|d���}|dzdkrt|dz ��Sd|d|��zS)z For T2 onlyr:r;i��r��r6)r� encodeIntT2)�fr�rs r� encodeFixedr��sL�� ��"� -� -� -�E� �v�~�����5�B�;�'�'�'����d�E�*�*�*�*r rFc�6�|dkrtSd|z}|dd�dkr |dd�}n�|dd�dkrd|dd�z}n�|�d ��r:|�d ��}d |t|��t|��z fz}n�|�d ��}|�d ��}|dkr_|dkrY|d|�}||dz|�}t ||dzd���}|t|��z }|dkr|�|�d �}nd|||fz}|�d��rA|�d d��\} }d| |�d ��t|��fz}g} |r�|d} |dd�}| d krL|dd�} | dkr |dd�}d} n| dkr |dd�}|�d ��r |dd�}| � t| ��|��| � d��t| ��dzr| � d��td��} tdt| ��d��D])}| t| |dz| |dzz��z} �*| S)Ngz%.8Gr.z0.rrtz-0.ra�000rTz%sE%dr^r_�����z%s%sE%d)z.0z-.0z%s%sE-%drr`�+rFrSr7) � realZeroBytes�endswith�rstripri�find�int� startswith�split�lstrip�append�realNibblesDictr�range)r��s�significantDigits�dotIndex�eIndex� integerPart�fractionalPart�exponent� newExponent�sign�nibbles�c�c2�drds r� encodeFloatr� s����C�x�x��� �� �A���!��u��}�}� �a�b�b�E��� �2�A�2��%��� �!�A�B�B�%�K��� ���E� � �K��H�H�S�M�M�� �(�#�a�&�&�3�7H�3I�3I�*I�J� J����6�6�#�;�;��������� �r�>�>�f��l�l��I�X�I�,�K��x�!�|�f�4�5�N��1�V�a�Z�\�\�?�+�+�H�"�S��%8�%8�8�K��a���*�{�N�N�N�;�����n�k� J�J���|�|�M�"�"�7��'�'�#�q�/�/���a� �$����� � �s�1�v�v�6� 6���G� � +� �a�D�� �a�b�b�E�� ��8�8��2�A�2��B��S�y�y��a�b�b�E������s����a�b�b�E���|�|�C� � � ��a�b�b�E������q�)�*�*�*� � +� �N�N�3���� �7�|�|�a������s������ � �A� �1�c�'�l�l�A� &� &�:�:�� ���� �a��'�!�a�%�.�8�9�9� 9��� �Hr c��eZdZdS)�CharStringCompileErrorN)�__name__� __module__� __qualname__rr rrr?s�������Dr rc� �eZdZd+d�Zd�Zd�Zd�Zd�Zd�Zd�Z d �Z d �Z d �Z d �Z d �Zd�Zd�Zd�Zd�ZeZd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Z d�Z!d �Z"d!�Z#d"�Z$d#�Z%d$�Z&d%�Z'd&�Z(d'�Z)d(�Z*d)�Z+d*�Z,dS),�SimpleT2DecompilerNc��||_t|��|_||_t|��|_||_||_|���dSr?)� localSubrs� calcSubrBias� localBias� globalSubrs� globalBias�private�blender�reset)rrr r r s r�__init__zSimpleT2Decompiler.__init__DsN��$���%�j�1�1���&���&�{�3�3����� ��� � � � � � � � � r c�Z�g|_g|_d|_d|_d|_d|_dS�Nr)� callingStack� operandStack� hintCount� hintMaskBytes� numRegions�vsIndex�rs rrzSimpleT2Decompiler.resetMs3������������������� � � r c���|j�|��|���}|r g}|j}nd�}|jj}d} |�|��\}}}|�nd||��|rKd|z} t || d��} | �| |��} | r| \} }|| ��n |���n ||����|r|�|��|jd=dS)Nc��dSr?r)�xs r�<lambda>z,SimpleT2Decompiler.execute.<locals>.<lambda>\s��d�r rT�op_r�)rr��needsDecompilationr�getToken�getattr�popall� setProgram) r� charStringr�program� pushToProgram� pushToStackr�token� isOperator� handlerName�handler�rvrs r�executezSimpleT2Decompiler.executeUs:�� �� � ��,�,�,�'�:�:�<�<�� � +��G�#�N�M�M�*�N�M��'�.� ��� #�'1�':�':�5�'A�'A� $�E�:�u��}�� �M�%� � � �� #�#�e�m� �!�$� �T�:�:���&� �����B��5�/1�,� �u�%� �m�4�4�4���K�K�M�M�M�M�� �E�"�"�"�! #�" � +� � !� !�'� *� *� *� � �b� !� !� !r c�0�|jd}|jd=|S�Nr��r�rrs r�popzSimpleT2Decompiler.popts���!�"�%�� � �b� !�� r c�<�|jdd�}g|jdd�<|Sr?r/�r�stacks rr!zSimpleT2Decompiler.popallys)���!�!�!�!�$��!���!�!�!��� r c�:�|j�|��dSr?)rr�r0s r�pushzSimpleT2Decompiler.push~s�� �� � ��'�'�'�'�'r c��|jrdSdSr?r/�rrs r� op_returnzSimpleT2Decompiler.op_return�s�� � � � �D� � r c��dSr?rr8s r� op_endcharzSimpleT2Decompiler.op_endchar���� �r c��dSr?rr8s r� op_ignorezSimpleT2Decompiler.op_ignore�r<r c��|���}|j||jz}|�|��dSr?)r1rr r,�rr� subrIndex�subrs r� op_callsubrzSimpleT2Decompiler.op_callsubr�s:���H�H�J�J� ���y�4�>�9�:�� � � �T�����r c��|���}|j||jz}|�|��dSr?)r1r r r,r@s r� op_callgsubrzSimpleT2Decompiler.op_callgsubr�s;���H�H�J�J� ��� �D�O� ;�<�� � � �T�����r c�.�|���dSr?�� countHintsr8s r�op_hstemzSimpleT2Decompiler.op_hstem���� �������r c�.�|���dSr?rGr8s r�op_vstemzSimpleT2Decompiler.op_vstem�rJr c�.�|���dSr?rGr8s r� op_hstemhmzSimpleT2Decompiler.op_hstemhm�rJr c�.�|���dSr?rGr8s r� op_vstemhmzSimpleT2Decompiler.op_vstemhm�rJr c��|js&|���|jdzdz|_|jd�||j��\}}||fS)Nrr�r�)rrHrr�getBytes)rrrs r� op_hintmaskzSimpleT2Decompiler.op_hintmask�sa���!� ;� �O�O� � � �"&�.�1�"4��!:�D� �#�0��4�=�=�e�T�EW�X�X�� �u��e�#�#r c�l�|���}|jt|��dzz|_dS�Nr.)r!rri�r�argss rrHzSimpleT2Decompiler.countHints�s+���{�{�}�}����#�d�)�)�q�.�8����r c��t�r?�r@r8s r�op_andzSimpleT2Decompiler.op_and����!�!r c��t�r?rYr8s r�op_orzSimpleT2Decompiler.op_or�r[r c��t�r?rYr8s r�op_notzSimpleT2Decompiler.op_not�r[r c��t�r?rYr8s r�op_storezSimpleT2Decompiler.op_store�r[r c��t�r?rYr8s r�op_abszSimpleT2Decompiler.op_abs�r[r c��t�r?rYr8s r�op_addzSimpleT2Decompiler.op_add�r[r c��t�r?rYr8s r�op_subzSimpleT2Decompiler.op_sub�r[r c��t�r?rYr8s r�op_divzSimpleT2Decompiler.op_div�r[r c��t�r?rYr8s r�op_loadzSimpleT2Decompiler.op_load�r[r c��t�r?rYr8s r�op_negzSimpleT2Decompiler.op_neg�r[r c��t�r?rYr8s r�op_eqzSimpleT2Decompiler.op_eq�r[r c��t�r?rYr8s r�op_dropzSimpleT2Decompiler.op_drop�r[r c��t�r?rYr8s r�op_putzSimpleT2Decompiler.op_put�r[r c��t�r?rYr8s r�op_getzSimpleT2Decompiler.op_get�r[r c��t�r?rYr8s r� op_ifelsezSimpleT2Decompiler.op_ifelse�r[r c��t�r?rYr8s r� op_randomzSimpleT2Decompiler.op_random�r[r c��t�r?rYr8s r�op_mulzSimpleT2Decompiler.op_mul�r[r c��t�r?rYr8s r�op_sqrtzSimpleT2Decompiler.op_sqrt�r[r c��t�r?rYr8s r�op_dupzSimpleT2Decompiler.op_dup�r[r c��t�r?rYr8s r�op_exchzSimpleT2Decompiler.op_exch�r[r c��t�r?rYr8s r�op_indexzSimpleT2Decompiler.op_index�r[r c��t�r?rYr8s r�op_rollzSimpleT2Decompiler.op_roll�r[r c���|jdkr|j���|_|���}||jdzz}|j�|j||z d�=dSt |j��|z }||zx}}||krV||jz}|j||�}|�|j|��} |j|xx| z cc<|}|dz }||k�Vg|j|d�<dS�Nrr)rr � getNumRegionsr1r rrir) rr� numBlends�numOps�argi�end_args�tuplei�next_ti�deltas�deltas r�op_blendzSimpleT2Decompiler.op_blend�s"�� �?�a� � �"�l�8�8�:�:�D�O��H�H�J�J� ��d�o��1�2�� �<� ��!��9�$�%�'�'�����t�(�)�)�F�2�D� $�y� 0� 0�H�v���/�/� �4�?�2���*�6�'�>�:��� � �T�\�6�:�:���!�$�'�'�'�5�0�'�'�'� ���� �� ��/�/�,.�D� �h�i�i� (� (� (r c�z�|���}||_|j�|��|_dSr?)r1rr r�r)rr�vis r� op_vsindexzSimpleT2Decompiler.op_vsindexs1�� �X�X�Z�Z���� ��,�4�4�R�8�8����r �NN)-rrrrrr,r1r!r6r9r;r>rCrErIrLrNrPrS� op_cntrmaskrHrZr]r_rarcrergrirkrmrorqrsrurwryr{r}rr�r�r�r�r�rr rrrCs��������������"�"�"�>��� ��� (�(�(���� � � � � � ���� ��� ������������$�$�$��K�9�9�9� "�"�"�"�"�"�"�"�"�"�"�"�"�"�"�"�"�"�"�"�"�"�"�"�"�"�"�"�"�"�"�"�"�"�"�"�"�"�"�"�"�"�"�"�"�"�"�"�"�"�"�"�"�"�"�"�"�"�"�"�"�"�"�"�"�"�.�.�.�*9�9�9�9�9r r)rqrsrvrxr{r~r�)r�� closepathr�r�)r��hsbwr�r�r�r�r�)r�� dotsection))r r�vstem3))r r.�hstem3))r r|�seac))r r�sbwr�))r r:� callothersubr))r �r1))r �!�setcurrentpointc�F�eZdZ d d�Zd�Zd d�Zd�Zd�Zd�Zd �Z d �Z dS) �T2WidthExtractorNc�^�t�|||||��||_||_dSr?)rr� nominalWidthX� defaultWidthX)rrr r�r�r r s rrzT2WidthExtractor.__init__+s6�� �#�#�D�*�k�7�G�T�T�T�*���*����r c�V�t�|��d|_d|_dSr)rr�gotWidth�widthrs rrzT2WidthExtractor.reset8s(��� � ��&�&�&��� ��� � � r rc���|���}|jsY|t|��dzz r1|j� Jd���|j|dz|_|dd�}n |j|_d|_|S)Nr.z5CFF2 CharStrings must not have an initial width valuerr)r!r�rir�r�r�)r�evenOddrWs r� popallWidthzT2WidthExtractor.popallWidth=s����{�{�}�}���}� ��#�d�)�)�a�-�(� 0��&�2�2�J�3�2�2�!�/�$�q�'�9�� ��A�B�B�x���!�/�� ��D�M�� r c�l�|���}|jt|��dzz|_dSrU)r�rrirVs rrHzT2WidthExtractor.countHintsLs/�����!�!����#�d�)�)�q�.�8����r c�.�|���dSr?�r�r8s r� op_rmovetozT2WidthExtractor.op_rmovetoP��� �������r c�0�|�d��dS�Nrr�r8s r� op_hmovetozT2WidthExtractor.op_hmovetoS��� ��������r c�0�|�d��dSr�r�r8s r� op_vmovetozT2WidthExtractor.op_vmovetoVr�r c�.�|���dSr?r�r8s rr;zT2WidthExtractor.op_endcharYr�r r��r) rrrrrr�rHr�r�r�r;rr rr�r�*s��������� +� +� +� +���� � � � �9�9�9��������������r r�c�V��eZdZ d6d�Zd�Z�fd�Zd�Zd�Zd�Zd�Z d �Z d �Z d �Z d �Z d �Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Z d �Z!d!�Z"d"�Z#d#�Z$d$�Z%d%�Z&d&�Z'd'�Z(d(�Z)d)�Z*d*�Z+d+�Z,d,�Z-d-�Z.d.�Z/d/�Z0d0�Z1d1�Z2d2�Z3d3�Z4d4�Z5d5�Z6�xZ7S)7�T2OutlineExtractorNc �b�t�|||||||��||_d|_dSr)r�r�pen� subrLevel)rr�rr r�r�r r s rrzT2OutlineExtractor.__init__^sE�� �!�!� � � � � � � � � � ��������r c�d�t�|��d|_d|_d|_dS)N�rrr)r�r� currentPoint� sawMoveTor�rs rrzT2OutlineExtractor.resetts0�����t�$�$�$�"����������r c����|xjdz c_t���|��|xjdzc_|jdkr|���dSdS�Nrr)r��superr,�endPath)rr#� __class__s �rr,zT2OutlineExtractor.executezs_��� ���!���� ����� �#�#�#� ���!���� �>�Q� � � �L�L�N�N�N�N�N� � r c�T�|j\}}||dz||dzf}||_|Sr�)r�)r�pointr�ys r� _nextPointzT2OutlineExtractor._nextPoint�s5��� ���1��E�!�H� �a�%��(�l�*��!���� r c�n�|j�|�|����d|_dSr�)r��moveTor�r��rr�s r�rMoveTozT2OutlineExtractor.rMoveTo�s-�� ��������.�.�/�/�/�����r c��|js|�d��|j�|�|����dS�Nr�)r�r�r��lineTor�r�s r�rLineTozT2OutlineExtractor.rLineTo�sD���~� !� �L�L�� � � � ��������.�.�/�/�/�/�/r c��|js|�d��|j}|j�||��||��||����dSr�)r�r�r�r��curveTo)r�pt1�pt2�pt3� nextPoints r�rCurveTozT2OutlineExtractor.rCurveTo�s]���~� !� �L�L�� � � ��O� � ������3�����3�����3���H�H�H�H�Hr c�T�|jr|j���d|_dSr)r�r�� closePathrs rr�zT2OutlineExtractor.closePath�s+�� �>� !� �H� � � � � �����r c�@�|jr|���dSdSr?)r�r�rs rr�zT2OutlineExtractor.endPath�s.�� �>� � �N�N� � � � � � � r c�|�|���|�|�����dSr?�r�r�r�r8s rr�zT2OutlineExtractor.op_rmoveto�s3�� � � ���� � � �T�%�%�'�'�(�(�(�(�(r c��|���|�|�d��ddf��dSr�r�r8s rr�zT2OutlineExtractor.op_hmoveto�s?�� � � ���� � � �d�&�&�q�)�)�!�,�a�0�1�1�1�1�1r c��|���|�d|�d��df��dSr�r�r8s rr�zT2OutlineExtractor.op_vmoveto�s?�� � � ���� � � �a��)�)�!�,�,�Q�/�0�1�1�1�1�1r c ��|���|���}|r[ddlm}|\}}}}||}|j�|d��||} |j�| dddd||f��dSdS)Nr��StandardEncoding�rrrrrrr)r�r��$fontTools.encodings.StandardEncodingr�r�� addComponent) rrrWr��adx�ady�bchar�achar� baseGlyph� accentGlyphs rr;zT2OutlineExtractor.op_endchar�s��� � � �������!�!�� � G� M� M� M� M� M� M�&*� "�C��e�U�(��/�I� �H� !� !�)�-?� @� @� @�*�5�1�K� �H� !� !�+��1�a��C��/E� F� F� F� F� F� G� Gr c��|���}tdt|��d��D]$}|||dz�}|�|���%dS)Nrr.)r!r�rir�)rrrWrdr�s r� op_rlinetozT2OutlineExtractor.op_rlineto�s`���{�{�}�}���q�#�d�)�)�Q�'�'� � �A���Q��U��O�E� �L�L�� � � � � � r c�0�|�d��dSr���alternatingLinetor8s r� op_hlinetozT2OutlineExtractor.op_hlineto���� ���q�!�!�!�!�!r c�0�|�d��dSrr�r8s r� op_vlinetozT2OutlineExtractor.op_vlineto�r�r c���|���}tdt|��d��D]3}|||dz�\}}}}}} |�||f||f|| f���4dS)z${dxa dya dxb dyb dxc dyc}+ rrcurvetorr|N)r!r�rir�) rrrWrd�dxa�dya�dxb�dyb�dxc�dycs r� op_rrcurvetozT2OutlineExtractor.op_rrcurveto�s����{�{�}�}���q�#�d�)�)�Q�'�'� >� >�A��Q��Q��Y�� ������� �M�M�3��*�s�C�j�3��*� =� =� =� =� >� >r c��|���}tdt|��dz d��D]3}|||dz�\}}}}}} |�||f||f|| f���4|�|dd���dS)z-{dxa dya dxb dyb dxc dyc}+ dxd dyd rcurvelinerr.r|�����N)r!r�rir�r�) rrrWrdr�r�r�r��dxd�dyds r� op_rcurvelinez T2OutlineExtractor.op_rcurveline�s����{�{�}�}���q�#�d�)�)�a�-��+�+� >� >�A�+/��A��E� �?� (�C��c�3��S� �M�M�3��*�s�C�j�3��*� =� =� =� =� � � �T�"�#�#�Y�����r c� �|���}|dd�}tdt|��d��D]"}|�|||dz����#|dd�\}}}}} } |�||f||f| | f��dS)z-{dxa dya}+ dxb dyb dxc dyc dxd dyd rlinecurveNi����rr.)r!r�rir�r�) rrrW�lineArgsrdr�r�r�r�rrs r� op_rlinecurvez T2OutlineExtractor.op_rlinecurve�s����{�{�}�}������9���q�#�h�-�-��+�+� .� .�A� �L�L��!�a�!�e�)�,� -� -� -� -�'+�B�C�C�y�$��S�#�s�C�� � � �s�C�j�3��*�s�C�j�9�9�9�9�9r c� �|���}t|��dzr|d}|dd�}nd}tdt|��d��D]3}|||dz�\}}}}|�||f||fd|f��d}�4dS)z!dx1? {dya dxb dyb dyc}+ vvcurvetor.rrNr7�r!rir�r�) rrrW�dx1rdr�r�r�r�s r� op_vvcurvetozT2OutlineExtractor.op_vvcurvetos����{�{�}�}�� �t�9�9�q�=� ��q�'�C�����8�D�D��C��q�#�d�)�)�Q�'�'� � �A�!%�a�!�a�%�i�� �C��c�3� �M�M�3��*�s�C�j�1�c�(� ;� ;� ;��C�C� � r c� �|���}t|��dzr|d}|dd�}nd}tdt|��d��D]3}|||dz�\}}}}|�||f||f|df��d}�4dS)z!dy1? {dxa dxb dyb dxc}+ hhcurvetor.rrNr7r) rrrW�dy1rdr�r�r�r�s r� op_hhcurvetozT2OutlineExtractor.op_hhcurvetos����{�{�}�}�� �t�9�9�q�=� ��q�'�C�����8�D�D��C��q�#�d�)�)�Q�'�'� � �A�!%�a�!�a�%�i�� �C��c�3� �M�M�3��*�s�C�j�3��(� ;� ;� ;��C�C� � r c��|���}|r0|�|��}|r|�|��}|�.dSdS)z�dy1 dx2 dy2 dx3 {dxa dxb dyb dyc dyd dxe dye dxf}* dyf? vhcurveto (30) {dya dxb dyb dxc dxd dxe dye dyf}+ dxf? vhcurveto N)r!�vcurveto�hcurveto�rrrWs r� op_vhcurvetozT2OutlineExtractor.op_vhcurveto�a���{�{�}�}��� +��=�=��&�&�D�� +��}�}�T�*�*��� +� +� +� +� +r c��|���}|r0|�|��}|r|�|��}|�.dSdS)zpdx1 dx2 dy2 dy3 {dya dxb dyb dxc dxd dxe dye dyf}* dxf? {dxa dxb dyb dyc dyd dxe dye dxf}+ dyf? N)r!rrrs r� op_hvcurvetozT2OutlineExtractor.op_hvcurveto%rr c���|���\}}}}}}}dx} x} x} } | } |�|| f||f|| f��|�|| f|| f|| f��dSr�r!r�)rrr �dx2�dy2�dx3�dx4�dx5�dx6r �dy3�dy4�dy6�dy5s r�op_hflexzT2OutlineExtractor.op_hflex2s���,0�K�K�M�M�)��S�#�s�C��c� !�!��!�c�!�C�#��d�� � � �s�C�j�3��*�s�C�j�9�9�9� � � �s�C�j�3��*�s�C�j�9�9�9�9�9r c ��|���\ }}}}}}}} } } } } }|�||f||f||f��|�|| f| | f| | f��dSr?r)rrr r rrrrrrrr!rr �fds r�op_flexzT2OutlineExtractor.op_flex9st��IM�����F��S�#�s�C��c�3��S�#�s�B� � � �s�C�j�3��*�s�C�j�9�9�9� � � �s�C�j�3��*�s�C�j�9�9�9�9�9r c ���|���\ }}}}}}}} } dx} } ||z| z| z| z } |�||f||f|| f��|�|| f|| f| | f��dSrr)rrr r rrrrrr!rrrr s r� op_hflex1zT2OutlineExtractor.op_hflex1>s���6:�k�k�m�m�3��S�#�s�C��c�3��� ��c��c� �C��#�%��+�,�� � � �s�C�j�3��*�s�C�j�9�9�9� � � �s�C�j�3��*�s�C�j�9�9�9�9�9r c �H�|���\ }}}}}}}} } } } ||z|z|z| z} ||z|z| z| z}t| ��t|��kr| }| }n| }| }|�||f||f||f��|�|| f| | f||f��dSr?)r!r�r�)rrr r rrrrrrrr!�d6�dx�dyrr s r�op_flex1zT2OutlineExtractor.op_flex1Fs���?C�{�{�}�}�<��S�#�s�C��c�3��S�"� �3�Y��_�s� "�S� (�� �3�Y��_�s� "�S� (�� �r�7�7�S��W�W� � ��C��#�C�C��#�C��C� � � �s�C�j�3��*�s�C�j�9�9�9� � � �s�C�j�3��*�s�C�j�9�9�9�9�9r c��t�r?rYr8s rrZzT2OutlineExtractor.op_andTr[r c��t�r?rYr8s rr]zT2OutlineExtractor.op_orWr[r c��t�r?rYr8s rr_zT2OutlineExtractor.op_notZr[r c��t�r?rYr8s rrazT2OutlineExtractor.op_store]r[r c��t�r?rYr8s rrczT2OutlineExtractor.op_abs`r[r c��t�r?rYr8s rrezT2OutlineExtractor.op_addcr[r c��t�r?rYr8s rrgzT2OutlineExtractor.op_subfr[r c���|���}|���}||z}||z }||kr|�|��dS|�|��dSr?)r1r6)rr�num2�num1�d1�d2s rrizT2OutlineExtractor.op_divis]���x�x�z�z���x�x�z�z�� �T�\�� �D�[�� ��8�8� �I�I�b�M�M�M�M�M� �I�I�b�M�M�M�M�Mr c��t�r?rYr8s rrkzT2OutlineExtractor.op_loadsr[r c��t�r?rYr8s rrmzT2OutlineExtractor.op_negvr[r c��t�r?rYr8s rrozT2OutlineExtractor.op_eqyr[r c��t�r?rYr8s rrqzT2OutlineExtractor.op_drop|r[r c��t�r?rYr8s rrszT2OutlineExtractor.op_putr[r c��t�r?rYr8s rruzT2OutlineExtractor.op_get�r[r c��t�r?rYr8s rrwzT2OutlineExtractor.op_ifelse�r[r c��t�r?rYr8s rryzT2OutlineExtractor.op_random�r[r c��t�r?rYr8s rr{zT2OutlineExtractor.op_mul�r[r c��t�r?rYr8s rr}zT2OutlineExtractor.op_sqrt�r[r c��t�r?rYr8s rrzT2OutlineExtractor.op_dup�r[r c��t�r?rYr8s rr�zT2OutlineExtractor.op_exch�r[r c��t�r?rYr8s rr�zT2OutlineExtractor.op_index�r[r c��t�r?rYr8s rr�zT2OutlineExtractor.op_roll�r[r c�~�|���}|D]%}|r|df}nd|f}|�|��| }�&dSr)r!r�)r� isHorizontalrW�argr�s rr�z$T2OutlineExtractor.alternatingLineto�s`���{�{�}�}��� ,� ,�C�� !��a�����C��� �L�L�� � � �+�+�L�L�  ,� ,r c��|dd�\}}}}|dd�}t|��dkr |d}g}nd}|�d|f||f||f��|S�Nr7rr�rir�)rrWr�r�r�r�r�s rrzT2OutlineExtractor.vcurveto�sp��!�"�1�"�X���S�#�s��A�B�B�x�� �t�9�9��>�>��q�'�C��D�D��C� � � �q�#�h��c� �S�#�J�7�7�7�� r c��|dd�\}}}}|dd�}t|��dkr |d}g}nd}|�|df||f||f��|SrKrL)rrWr�r�r�r�r�s rrzT2OutlineExtractor.hcurveto�sp��!�"�1�"�X���S�#�s��A�B�B�x�� �t�9�9��>�>��q�'�C��D�D��C� � � �s�A�h��c� �S�#�J�7�7�7�� r r�)8rrrrrr,r�r�r�r�r�r�r�r�r�r;r�r�r�r�rrr r rrr"r%r'r,rZr]r_rarcrergrirkrmrorqrsrurwryr{r}rr�r�r�r�rr� __classcell__�r�s@rr�r�]sH�������������,��� �������� ���0�0�0� I�I�I� ��� ���6)�)�)�2�2�2�2�2�2� G� G� G�" � � � "�"�"�"�"�"� >� >� >� � � �:�:�:� � � � � � �+�+�+�+�+�+�:�:�:�:�:�:� :�:�:� :� :� :�"�"�"�"�"�"�"�"�"�"�"�"�"�"�"�"�"�"�"�"�"����"�"�"�"�"�"�"�"�"�"�"�"�"�"�"�"�"�"�"�"�"�"�"�"�"�"�"�"�"�"�"�"�"�"�"�"�"�"�"�"�"�"� ,�,�,� � � � � � � � � � r r�c��eZdZd�Zd�Zd�Zdd�Zd�Zd�Zd�Z d �Z d �Z d �Z d �Z d �Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�ZdS)�T1OutlineExtractorc�J�||_||_|���dSr?)r��subrsr)rr�rSs rrzT1OutlineExtractor.__init__�s!������� � � � � � � � � r c�d�d|_d|_d|_t�|��dSr)�flexingr��sbxr�rrs rrzT1OutlineExtractor.reset�s1���� ��� ����� � ��&�&�&�&�&r c�T�|jr|j���d|_dSr)r�r�r�rs rr�zT1OutlineExtractor.endPath�s+�� �>� � �H� � � � � �����r rc�*�|���Sr?�r!)rr�s rr�zT1OutlineExtractor.popallWidth�����{�{�}�}�r c�B�|j}|d|dc|d<|d<dS)Nrr�r/r3s rr�zT1OutlineExtractor.exch�s*���!��$�R�y�%��)���b� �5��9�9�9r c��|jrdS|���|�|�����dSr?)rUr�r�r!r8s rr�zT1OutlineExtractor.op_rmoveto�s>�� �<� � �F� � � ���� � � �T�[�[�]�]�#�#�#�#�#r c���|jr|�d��dS|���|�|���ddf��dSr)rUr6r�r�r!r8s rr�zT1OutlineExtractor.op_hmoveto�sW�� �<� � �I�I�a�L�L�L� �F� � � ���� � � �d�k�k�m�m�A�&��*�+�+�+�+�+r c���|jr+|�d��|���dS|���|�d|���df��dSr)rUr6r�r�r�r!r8s rr�zT1OutlineExtractor.op_vmoveto�sd�� �<� � �I�I�a�L�L�L� �I�I�K�K�K� �F� � � ���� � � �a������q�)�*�+�+�+�+�+r c�.�|���dSr?)r�r8s r� op_closepathzT1OutlineExtractor.op_closepath�s�� �������r c�J�|���}|\}}||f|_dSr?)r!r�)rrrWrr�s r�op_setcurrentpointz%T1OutlineExtractor.op_setcurrentpoint�s*���{�{�}�}�����1��q�D����r c�.�|���dSr?)r�r8s rr;zT1OutlineExtractor.op_endchar�s�� � � �����r c�x�|���\}}||_||_||jdf|_dSr�)r!r�rVr�)rrrV�wxs r�op_hsbwzT1OutlineExtractor.op_hsbw�s<���+�+�-�-���R��� ������!2�1�!5�5����r c�.�|���dSr?rYr8s r�op_sbwzT1OutlineExtractor.op_sbw��� � � � � � � � r c�r�|���}|j|}|�|��dSr?)r1rSr,r@s rrCzT1OutlineExtractor.op_callsubrs3���H�H�J�J� ��z�)�$�� � � �T�����r c���|���}|���}|dkr#|dkr|���d|_dS|dkr|dkr d|_dSdSdS)Nrrtr)r1�doFlexrU)rrrA�nArgss r�op_callothersubrz#T1OutlineExtractor.op_callothersubr sl���H�H�J�J� ���� � �� ��>�>�e�q�j�j� �K�K�M�M�M��D�L�L�L� �!�^�^��� � ��D�L�L�L��^� � r c��dSr?rr8s r�op_popzT1OutlineExtractor.op_popr<r c�Z�|���}|���}|���|���}|���}|���}|���}|���}|���}|���} |���} |���} |���} |���} |���}|���}|���}|�||z��|�| |z��|�| ��|�| ��|�| ��|�| ��|�d��|�|��|�|��|�|��|�|��|�|��|�|��|�d��|�|��|�|��dSr?)r1r6r�)r�finaly�finalx�p3y�p3x�bcp4y�bcp4x�bcp3y�bcp3x�p2y�p2x�bcp2y�bcp2x�bcp1y�bcp1x�rpy�rpxs rrlzT1OutlineExtractor.doFlexs �������������� ��� � � ��h�h�j�j���h�h�j�j����� � ����� � ����� � ����� � ���h�h�j�j���h�h�j�j����� � ����� � ����� � ����� � ���h�h�j�j���h�h�j�j�� � � �%�#�+���� � � �%�#�+���� � � �%���� � � �%���� � � �#���� � � �#���� ���$���� � � �%���� � � �%���� � � �%���� � � �%���� � � �#���� � � �#���� ���$���� � � �&���� � � �&�����r c�.�|���dSr?rYr8s r� op_dotsectionz T1OutlineExtractor.op_dotsectionErir c�.�|���dSr?rYr8s r� op_hstem3zT1OutlineExtractor.op_hstem3Hrir c ���ddlm}|���\}}}}}||}|j�|d��||} ||jz|z }|j�| dddd||f��dS)zasb adx ady bchar achar seacrr�r�rN)r�r�r!r�r�rV) rrr��asbr�r�r�r�r�r�s r�op_seaczT1OutlineExtractor.op_seacKs���I�I�I�I�I�I�&*�k�k�m�m�#��S�#�u�e�$�U�+� � ����i�);�<�<�<�&�u�-� ��D�H�n�s�"�� ����k�A�q�!�Q��S�+A�B�B�B�B�Br c�.�|���dSr?rYr8s r� op_vstem3zT1OutlineExtractor.op_vstem3Vrir Nr�)rrrrrr�r�r�r�r�r�r`rbr;rfrhrCrnrprlr�r�r�r�rr rrQrQ�sX��������� '�'�'� ��� ����4�4�4�$�$�$� ,�,�,�,�,�,����!�!�!� ���6�6�6� ������ ��� � � �(�(�(�T������ C� C� C�����r rQc��eZdZeZee��\ZZe Z e Z dd�Z dd�Zd�Zd�Zd�Zd�Zdd�Zd �Zdd �Zd �Zd �Zd�Zeeefd�Zd�Zd�Zdd�Zd�Z dS)� T2CharStringNc�\�|�g}||_||_||_|�|ng|_d|_dSr?)�bytecoder$r r � _cur_vsindex)rr�r$r r s rrzT2CharString.__init__`s@�� �?��G� �� ��� ��� �*5�*A�;�;�r��� ����r c��|j}|�J�|�||_n%|j�t|d��r|jnd|_|�|j��S)Nr�r)r r��hasattrr�r�)rr��pds rr�zT2CharString.getNumRegionsis`�� �\���~�~�~� � � '�D� � � � � &�.5�b�)�.D�.D� K�� � �!�D� ����� 1�2�2�2r c��|j�d|jjt|��fzSd|jjt|��fzS)Nz<%s (source) at %x>z<%s (bytecode) at %x>)r�r�r�idrs r�__repr__zT2CharString.__repr__rs@�� �=� �(�D�N�,C�R��X�X�+N�N� N�*�d�n�.E�r�$�x�x�-P�P� Pr c��tSr?)r�rs rr�zT2CharString.getIntEncoderx����r c��tSr?)r�rs r�getFixedEncoderzT2CharString.getFixedEncoder{r�r c���|���sdSt|jdg��}|�||j|j��}|�|��dS�N�Subrs)rr r �decompilerClassr r,)rrS� decompilers r� decompilezT2CharString.decompile~sd���&�&�(�(� � �F��� �g�r�2�2���)�)�%��1A�4�<�P�P� ����4� � � � � r c ���t|jdg��}|�|||j|jj|jj|j|��}|�|��|j|_dSr�)r r �outlineExtractorr r�r�r,r�)rr�r rS� extractors r�drawzT2CharString.draw�sq���� �g�r�2�2���)�)� � � � � �L� &� �L� &� �L� � � � � ���$�����_�� � � r c�X�t|��}|�|��|jSr?)r r��bounds)r�glyphSet� boundsPens r� calcBoundszT2CharString.calcBounds�s*���h�'�'� � � � �)������r Fc��|j�dS|j}|j}|r|r|ddvr |dd�}n,|r*t|dt��st d���g}|���}|���}d}t|��}||k�r||} |dz}t| t��rl |� d�|| D����n #t$rt d| z���wxYw| dvr |� ||��|dz}n�t| t��r|� || ����nNt| t��r|� || ����nJd t| ��z���||k�� t|��}n)#t $rt"�|���wxYw|�|��dS) Nr�)r�r�z@T2CharString or Subr has items on the stack after last operator.rrc3�4K�|]}t|��V��dSr?)r)rcrJs r� <genexpr>z'T2CharString.compile.<locals>.<genexpr>�s(����#G�#G�1�G�A�J�J�#G�#G�#G�#G�#G�#Gr zillegal operator: %s�r�r�zunsupported type: %s)r��opcodesr$rj�strrr�r�ri�extendrr�r�rH�typer � TypeErrorr��error� setBytecode) r�isCFF2r�r$r�r�r�rd�endr's r�compilezT2CharString.compile�sU�� �=� $� �F��,���,�� � �� '�7�2�;�*?�?�?�!�#�2�#�,��� � �Z��� �S�9�9� �(�R��� ����&�&�(�(� ��*�*�,�,� � ���'�l�l���#�g�g��A�J�E��A��A��%��%�%� ?�Q��O�O�#G�#G����#G�#G�#G�G�G�G�G���Q�Q�Q�0�1G�%�1O�P�P�P�Q�����4�4�4��O�O�G�A�J�/�/�/��A��A���E�3�'�'� ?���� � �%� 0� 0�1�1�1�1��E�5�)�)� ?���� � �E� 2� 2�3�3�3�3�>�0�4��;�;�>�>�>�q�!�#�g�g�" � ��*�*�H�H��� � � � �I�I�h� � � � � ���� ����"�"�"�"�"s�%C(�(D�7G�&G-c��|jduSr?)r�rs rrzT2CharString.needsDecompilation�s���}�D�(�(r c�"�||_d|_dSr?)r$r�)rr$s rr"zT2CharString.setProgram�s���� ��� � � r c�"�||_d|_dSr?)r�r$)rr�s rr�zT2CharString.setBytecode�s�� �� ��� � � r c�6�|j�U|||j��krdS||j|��}|dz}|j|}||||j|��\}}n(|||j��krdS|j|}|dz}||t��}|||fS)N)Nrrr)r��operandEncodingr$r�) rrrirrjrr*r'r(s rrzT2CharString.getToken�s��� �=� $����D�M�*�*�*�*�!�z�����u�-�.�.�B��A�I�E��*�2�.�G�"�7�4��T�]�E�B�B�L�E�5�5����D�L�)�)�)�)�!�z��L��'�E��A�I�E��Z��s�+�+� ��j�%�'�'r c��|j�||z}|j||�}|}n|j|}|dz}t|��|ksJ�||fSr�)r�r$ri)rr�nBytes�newIndex�bytess rrRzT2CharString.getBytes�s`�� �=� $��v�~�H��M�%��.�1�E��E�E��L��'�E��A�I�E��5�z�z�V�#�#�#�#��e�|�r c��|Sr?r)rrs rrzT2CharString.handle_operator�s���r c��ddlm}|j�|�|j��dSd}g} |�|��\}}}|��n|r�|dvrv|�|��\}}}g} |D].} | �|t | ��d�����/t| ��}d�|||gz��} nd�||gz��} |� | ��|� ��g}nKt|t��rt|d���}nt|��}|�|����+|r,d�|��} |� | ��dSdS) Nr)� num2binaryTr�r�� r:r;)�fontTools.misc.textToolsr�r��dumphexrr�rr �join�write�newlinerjrHrr�) r� xmlWriter�ttFontr�rrWr'r(�hintMask�bits�byte�lines r�toXMLzT2CharString.toXML�s���7�7�7�7�7�7� �=� $� � � �d�m� ,� ,� ,� ,� ,��E��D� '�+/�=�=��+?�+?�(��z�5��=���'�� 8�8�8�6:�m�m�E�6J�6J�3��*�e�!��$,�F�F�D� �K�K� � �7�4�=�=�!�(D�(D�E�E�E�E�#*�4�=�=��"�x�x���x�/@�(@�A�A���"�x�x���w��7�7���O�O�D�)�)�)��%�%�'�'�'��D�D�!�%��/�/�+� 1�%�r� J� J� J��� #�E� � ���K�K��&�&�&�- '�.� &��x�x��~�~������%�%�%�%�%�  &� &r c �0�ddlm}m}|�d��r |�||����dSt |��}|���}g}t|��}d}||k�r||} |dz} t| ��} |� | ��n�#t$r� t| d���} |� | ��n�#t$r�|� | ��| dvrk||} d} tdt| ��d ��D](} | t|| | | d z�����z} �)|� | ��|dz}YnwxYwYnwxYw||k��|�|��dS) Nr)� binary2num�readHex�rawrr:r;r�r r�)r�r�r�r�r�r r�rir�r�� ValueErrorrr�rr") r�name�attrs�contentr�r�r$r�rdr'�mask� maskBytes�js r�fromXMLzT2CharString.fromXMLs���@�@�@�@�@�@�@�@� �9�9�U� � � � � � �W�W�W�-�-� .� .� .� �F��'�"�"���-�-�/�/�����'�l�l�� ���#�g�g��A�J�E��A��A� &��E� � �� ���u�%�%�%�%��� *� *� *� *�-�e�2�F�F�F�E��N�N�5�)�)�)�)��"�"�"�"��N�N�5�)�)�)�� 8�8�8�&�q�z��$'� �!&�q�#�d�)�)�Q�!7�!7�Y�Y�A�(1�G�J�J�t�A�PQ�TU�PU�I��<W�<W�4X�4X�(X�I�I����y�1�1�1���E����"������ *���� �#�g�g�* ���� � � � � s7� B.�. E7�9C � E7� BE1�.E7�0E1�1E7�6E7)NNNNr?)F)!rrr�t2OperandEncodingr�rp� t2Operatorsrr�rr�r�r�rr�r�r�r�r�r�r�r�rr"r�rirrjrrRrr�r�rr rr�r�Zsd������'�O�*�*�;�7�7��I�w�(�O�)��!�!�!�!�3�3�3�3�Q�Q�Q� ������!�!�!� %� %� %� %� � � � *#�*#�*#�*#�X)�)�)�������#&�w�:�(�(�(�(� � � ����$&�$&�$&�$&�L !� !� !� !� !r r�c�X��eZdZeZee��\ZZd�fd� Z d�Z d�Z d�Z d�Z �xZS)� T1CharStringNc�Z��t���||��||_dSr?)r�rrS)rr�r$rSr�s �rrzT1CharString.__init__:s(��� ������7�+�+�+��� � � r c��tSr?)� encodeIntT1rs rr�zT1CharString.getIntEncoder>r�r c� �d�}dS)Nc� �td���)Nz8Type 1 charstrings don't support floating point operands)r�)rs rr�z1T1CharString.getFixedEncoder.<locals>.encodeFixedBs���V�W�W� Wr r)rr�s rr�zT1CharString.getFixedEncoderAs �� X� X� X� X� Xr c��|j�dSg}d} |�|��\}}}|�n|�|���2|�|��dSr)r�rr�r")rr$rr'r(s rr�zT1CharString.decompileEso�� �=� � �F����� "�'+�}�}�U�';�';� $�E�:�u��}�� �N�N�5� !� !� !�  "� ���� � � � � r c�r�t||j��}|�|��|j|_dSr?)rQrSr,r�)rr�r�s rr�zT1CharString.drawQs4��&�s�D�J�7�7� ����$�����_�� � � r )NNN)rrr�t1OperandEncodingr�rp� t1Operatorsrr�rr�r�r�r�rNrOs@rr�r�6s��������'�O�*�*�;�7�7��I�w����������X�X�X� !� !� !�%�%�%�%�%�%�%r r�c�\�eZdZeZdd�Zd�Zd�Zd�Zd�Z d�Z d�Z d �Z d �Z d �Zd �Zd �ZdS)�DictDecompilerNc�>�g|_||_i|_||_dSr?)r4�strings�dict�parent)rr�r�s rrzDictDecompiler.__init__Zs"���� ��� ��� ��� � � r c�T�t|j��dks Jd���|jS)Nrznon-empty stack)rir4r�rs r�getDictzDictDecompiler.getDict`s,���4�:���!�#�#�#�%6�#�#�#��y�r c���d}t|��}|jj}||krMt||��}|dz}|j|}|||||��\}}|� ||��||k�KdSdSr�)rir4r�rr�)rrr�lenDatar6rr*rs rr�zDictDecompiler.decompileds������d�)�)���z� ���g�o�o���e��%�%�B��A�I�E��*�2�.�G�"�7�4��T�5�9�9�L�E�5�� ���U� � � � �g�o�o�o�o�o�or c�0�|jd}|jd=|Sr.�r4r0s rr1zDictDecompiler.popps��� �2��� �J�r�N�� r c�8�|jdd�}|jdd�=|Sr?r�rVs rr!zDictDecompiler.popallus#���z�!�!�!�}�� �J�q�q�q�M�� r c�p�|\}}t|t��rQd}tt|��dz dd��D],}||}t |d|z��}||��f|z}�-nt |d|z��}||��}|dkr|j�|��dS||j|<dS)Nrrr��arg_r�)rjrkr�rir r4r�r�)rr�argTyperrdrI� arghandlers rrzDictDecompiler.handle_operatorzs���$���'� �g�u� %� %� )��E��3�w�<�<�!�+�R��4�4� 8� 8���a�j��$�T�6�C�<�8�8� �#��H�-�-�/�%�7��� 8� !��v��'7�8�8�J��J�x�(�(�E� �w� � � �J� � �e� $� $� $� $� $�"'�D�I�h� � � r c��t|jdt��r|�|j��}n|���}|Sr)rjr4�list�arg_blend_numberr1)rr��outs r� arg_numberzDictDecompiler.arg_number�sC�� �d�j��m�T� *� *� ��'�'�� �3�3�C�C��(�(�*�*�C�� r c���g}|���}t|��}|�|��|�d��|���}|S)Nr�)r1rir�r!)rr�r�� blendArgs� numMasters�dummys rr�zDictDecompiler.arg_blend_number�sV�����H�H�J�J� ���^�^� � � � �9���� � � �7����� � � � ���r c�@�|j|���Sr?)r�r1�rr�s r�arg_SIDzDictDecompiler.arg_SID�s���|�D�H�H�J�J�'�'r c�*�|���Sr?rYrs r� arg_arrayzDictDecompiler.arg_array�rZr c��|j�dd��}|j�|��dz}|���}|���}t |��}|||zksJ�dg|z}|dz }d} d} | |kr6|| | z} | } || |zz} | g|| | |z�z} | || <| dz } | |k�6|S)a� There may be non-blend args at the top of the stack. We first calculate where the blend args start in the stack. These are the last numMasters*numBlends) +1 args. The blend args starts with numMasters relative coordinate values, the BlueValues in the list from the default master font. This is followed by numBlends list of values. Each of value in one of these lists is the Variable Font delta for the matching region. We re-arrange this to be a list of numMaster entries. Each entry starts with the corresponding default font relative value, and is followed by the delta values. We then convert the default values, the first item in each entry, to an absolute value. r�rrN)r�r�r�r�r1r!ri)rr�r�rr�rW�numArgsr� numDeltasrd�prevVal�newVal� masterOffset� blendLists r� arg_blendListzDictDecompiler.arg_blendList�s����)�-�-� �1�-�-�� �K� %� %�g� .� .�� 2� ��H�H�J�J� ��{�{�}�}���d�)�)���*�y�0�0�0�0�0����"����N� � �����)�m�m��!�W�w�&�F��G�$��I� �6�L���4� �|�i�7O�(O�#P�P�I� �E�!�H� ��F�A� �)�m�m�� r c��|���}g}|rt|dt��r|}n!d}|D]}||z}|�|���|Sr)r!rjr�r�)rr�� valueListr��currentres r� arg_deltazDictDecompiler.arg_delta�so���K�K�M�M� ��� � $��I�a�L�$�7�7� $��C�C��G�� $� $��!�A�+��� � �7�#�#�#�#�� r r?)rrr�cffDictOperandEncodingr�rr�r�r1r!rr�r�rrrrrr rr�r�Ws�������,�O����� ��� � � ���� ��� (�(�(� ������(�(�(���� � � �D � � � � r r�c�L�t|��}|dkrd}n |dkrd}nd}|S)Ni�r�il�r�i�)ri)rS�nSubrs�biass rrr�s7�� ��Z�Z�F� ��}�}���� �%�������� �Kr )9�__doc__�fontTools.misc.fixedToolsrrrrr�rrr r �fontTools.pens.boundsPenr r0�logging� getLoggerrr�rrr(r+r3r8r=rBrMr�rir�rrG� enumerater�� maxOpStackrpr�r�� encodeIntCFFr�r�r�r�r�r�� Exceptionr�objectrr�r�r�rQr�r�r�rrr r�<module>r"s����������������� J�I�I�I�I�I�I�I�I�I�I�I�.�.�.�.�.�.� � � � ������g���!�!�� � � ����2�2�2� 3�3�3� ��� ��� <�<�<� !�!�!�  �  �  � �F�S�L���-��0��!�B�$��%�)��4��"�S�&��'�N�+;�;��#�c�'��'�N�+;�;��#�c�'��%��#�� �s� ����$�$�$�$�%�a�a�a�(��%��"��'��#��*�1�1�1�-��)��r��,��r��+��s����� �"<�;�I�I�k�$:�$:�;�;�;�� � � � � �8�8�8� �v1�1�1�h�}�U�#�#� ��m�D�!�!� ��m�D�!�!� �� �+�+�+�+���� � �g�g�c�l�l�*� �1 �1 �1 �h � � � � �Y� � � �F9�F9�F9�F9�F9��F9�F9�F9�R��� �<0�0�0�0�0�)�0�0�0�fa�a�a�a�a�)�a�a�a�H V�V�V�V�V�+�V�V�V�rY!�Y!�Y!�Y!�Y!�6�Y!�Y!�Y!�x%�%�%�%�%�<�%�%�%�Bv�v�v�v�v�V�v�v�v�r����r
Memory