%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib/python3/dist-packages/reportlab/pdfbase/__pycache__/
Upload File :
Create Path :
Current File : //lib/python3/dist-packages/reportlab/pdfbase/__pycache__/ttfonts.cpython-312.pyc

�

C��e3���D�dZdZddlmZmZmZddlmZm	Z	m
Z
mZmZddl
mZmZddlmZddlmZmZmZmZddlmZdd	lmZdd
lZdd
lZGd�dej:�ZejAd
d�fd�Z!d�Z"d�Z#d�Z$dZ%dZ&dZ'dZ(dZ)dZ*dZ+dZ,dZ-dZ.dZ/dZ0dZ1iZ2d �Z3d!�Z4Gd"�d#�Z5Gd$�d%�Z6ed&d'�Z7Gd(�d)e�Z8Gd*�d+e5�Z9dZ:dZ;dZ<dZ=dZ>dZ?d,Z@d-ZAd.ZBGd/�d0e9ej��ZDGd1�d2�ZEGd3�d4�ZFd5�ZGdd6lHmIZIeIeG�[Iy
)7z$Id$aTrueType font support

This defines classes to represent TrueType fonts.  They know how to calculate
their own width and how to write themselves into PDF files.  They support
subsetting and embedding and can represent all 16-bit Unicode characters.

Note on dynamic fonts
---------------------

Usually a Font in ReportLab corresponds to a fixed set of PDF objects (Font,
FontDescriptor, Encoding).  But with dynamic font subsetting a single TTFont
will result in a number of Font/FontDescriptor/Encoding object sets, and the
contents of those will depend on the actual characters used for printing.

To support dynamic font subsetting a concept of "dynamic font" was introduced.
Dynamic Fonts have a _dynamicFont attribute set to 1.

Dynamic fonts have the following additional functions::

    def splitString(self, text, doc):
        '''Splits text into a number of chunks, each of which belongs to a
        single subset.  Returns a list of tuples (subset, string).  Use
        subset numbers with getSubsetInternalName.  Doc is used to identify
        a document so that different documents may have different dynamically
        constructed subsets.'''

    def getSubsetInternalName(self, subset, doc):
        '''Returns the name of a PDF Font object corresponding to a given
        subset of this dynamic font.  Use this function instead of
        PDFDocument.getInternalFontName.'''

You must never call PDFDocument.getInternalFontName for dynamic fonts.

If you have a traditional static font, mapping to PDF text output operators
is simple::

   '%s 14 Tf (%s) Tj' % (getInternalFontName(psfontname), text)

If you have a dynamic font, use this instead::

   for subset, chunk in font.splitString(text, doc):
       '%s 14 Tf (%s) Tj' % (font.getSubsetInternalName(subset, doc), chunk)

(Tf is a font setting operator and Tj is a text ouput operator.  You should
also escape invalid characters in Tj argument, see TextObject._formatText.
Oh, and that 14 up there is font size.)

Canvas and TextObject have special support for dynamic fonts.
�)�pack�unpack�error)�bytestr�	isUnicode�char2int�isStr�isBytes)�
pdfmetrics�pdfdoc)�	rl_config)�hex32�add32�calcChecksum�instanceStringWidthTTF)�
namedtuple)�BytesIONc��eZdZdZy)�TTFErrorzTrueType font exceptionN)�__name__�
__module__�__qualname__�__doc__���;/usr/lib/python3/dist-packages/reportlab/pdfbase/ttfonts.pyrr?s���rrs
0123456789s
ABCDEFGIJKc�>�td|zd�j|�S)Nz%6.6d�ASCII)�bytes�	translate)�n�tables  r�SUBSETNr#Cs������7�#�-�-�e�4�4rc���ddddd|zd|zddd	|zd
ddt|�d
z
zddt|�zgt|�D��cgc]\}}d||fz��c}}zgd�z}dj|�Scc}}w)zuCreates a ToUnicode CMap for a given subset.  See Adobe
    _PDF_Reference (ISBN 0-201-75839-3) for more information.z$/CIDInit /ProcSet findresource beginz
12 dict begin�	begincmapz/CIDSystemInfoz<< /Registry (%s)z/Ordering (%s)z
/Supplement 0z>> defz/CMapName /%s defz/CMapType 2 defz1 begincodespacerangez<00> <%02X>��endcodespacerangez%d beginbfcharz
<%02X> <%04X>)�	endbfchar�endcmapz-CMapName currentdict /CMap defineresource pop�endr*�
)�len�	enumerate�join)�fontname�subset�i�v�cmaps     r�makeToUnicodeCMapr4Hs���	/�����h�&��8�#����h�&�����V��q��)���3�v�;�&�
�1:�&�0A�B���1�_��!�u�
$�B�C�F
�
�D�,�9�9�T�?���
Cs�A/c�6�|d||z||t|�zdzS)zxSplices the given value into stream at the given offset and
    returns the resulting stream (the original is unchanged)N)r,��stream�offset�values   r�splicer:cs+���'�6�?�U�"�V�F�S��Z�,?�,@�%A�A�Arc�0�t||td|��S)z�Writes the given unsigned short value into stream at the given
    offset and returns the resulting stream (the original is unchanged)�>H)r:rr6s   r�_set_ushortr=hs���&�&�$�t�U�"3�4�4rr&����� �@��iiiic	��tj|d�}|��tjj}tjj
}g}|j}|D]Y}tj|d��D]=\}}}||�}	|	|vr||	�|D]}	||||	��}	|	|vs�||	�� �?�[|t|<|S)NT)�followlinks)�_cached_ttf_dirs�get�os�pathr.�realpath�append�walk)
�roots�Rr.rL�aR�root�r�d�f�ss
          r�	_ttf_dirsrW�s������U�4�(�A��y��w�w�|�|���7�7�#�#����
�X�X���	)�D��7�7�4�D�9�
)���1�a��Q�K���A�:�r�!�u��)�A� ��a���+�A���z�2�a�5�)�
)�	)�#$�����Hrc�B�ddlm}m}	||d�}||fS#t$r~ddl}|j
j
|�sPttj�D]7}|j
j||�}||�s�(||d�}||fccYStd|z��wxYw)zXOpens a TTF file possibly after searching TTFSearchPath
    returns (filename,file)
    r)�	rl_isfile�
open_for_read�rbNzCan't open file "%s")�reportlab.lib.utilsrYrZ�IOErrorrJrK�isabsrWr
�
TTFSearchPathr.r)�fnrYrZrUrJ�D�tfns       r�TTFOpenFilerc�s���=�5��"�T�"���1�u����5���w�w�}�}�R� ��	� 7� 7�8�
"���g�g�l�l�1�R�(���S�>�%�c�$�/�A���6�M�	
"�
�.��3�4�4�5�s��A%B�=B�Bc��eZdZdZdZdZdZdd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zd
�Zd�Zd�Zdd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zy)�TTFontParserzBasic TTF file parser)�ieurtifctt)rf��TTFc��||_|j|�|j�}|r"|j�|j	|�y|jr|j�|j
�d|_y)z�Loads and parses a TrueType font file.  file can be a filename or a
        file object.  If validate is set to a false values, skips checksum
        validation.  This can save time, especially if the font is large.
        rN)�validate�readFile�
readHeader�
readTTCHeader�
getSubfont�checksumFile�readTableDirectory�subfontNameX)�self�filerj�subfontIndex�isCollections     r�__init__zTTFontParser.__init__�sd��
!��
��
�
�d�����(������ ��O�O�L�)��}�}�d�/�/�1��#�#�%� #�D�rc��|j�|_d|_|jdd|_|j|jvr/td|j|j|jfz��|j�|_g|_|jj}t|j�D]}||j���y)N�TTC���z1"%s" is not a %s file: can't read version 0x%8.8x)�
read_ulong�
ttcVersion�fileKind�ttfVersions�ttcVersionsr�filename�numSubfonts�subfontOffsetsrM�range)rr�ar1s   rrmzTTFontParser.readTTCHeader�s����/�/�+�����
��+�+�C�R�0����?�?�$�"2�"2�2��O�RV�R_�R_�`d�`m�`m�nr�n}�n}�Q~�~����?�?�,��� ������&�&���t�'�'�(�	!�A�
�d�o�o�� �	!rc��|jdk7r$td|j|jfz��	|j|}|j
|�|j�|j�tdt|�z�|_y#t$r)td|j||j
dz
fz��wxYw)Nrxz'"%s" is not a TTC file: use this methodz0TTC file "%s": bad subfontIndex %s not in [0,%d]r&�-)r|rrr��
IndexErrorr��seekrlrpr�strrq)rrrt�poss   rrnzTTFontParser.getSubfont�s����=�=�%���D��
�
�VZ�Vc�Vc�Gd�d�e�e�	A��%�%�l�3�C�	
�	�	�#���������!�#�C��L�(9�$9�:�����	A��M�QU�Q^�Q^�_k�lp�l|�l|�}~�l~�P��A�
A�	A�s�B�2Cc��	|j�|_|j�|_|j�|_|j�|_i|_g|_t|j�D]}}i}|j�|d<|j�|d<|j�|d<|j�|d<|jj|�||j
|d<�	|jr|j�yy#td|j�d|j�d���xYw)N�tag�checksumr8�lengthzCorrupt � file "z" cannot read Table Directory)�read_ushort�	numTables�searchRange�
entrySelector�
rangeShiftr"�tablesr��read_tagrzrMrr|rrj�checksumTables)rrr!�records   rrpzTTFontParser.readTableDirectory�s��	p�!�-�-�/�D�N�#�/�/�1�D��!%�!1�!1�!3�D��"�.�.�0�D�O��D�J��D�K��4�>�>�*�
3���� $�
�
���u�
�%)�_�_�%6��z�"�#'�?�?�#4��x� �#'�?�?�#4��x� ����"�"�6�*�,2��
�
�6�%�=�)�
3��=�=�$�-�-�/�=��	p��QU�Q^�Q^�`d�`m�`m�n�o�o�s�C7D�(Ec�8�	|j�x|_}|dk(r%t|j�d|j�d���||j
vrtd|z��||j
dk(S#td|j�d|j�d���xYw)	z,read the sfnt header at the current position�"z" is not a z file: can't read versioniOTTOr�z(": postscript outlines are not supportedz/Not a recognized TrueType font: version=0x%8.8Xry)rz�versionrrr|r})rrr�s  rrlzTTFontParser.readHeader�s���	h�%)�_�_�%6�6�D�L�7��J���RV�R_�R_�`d�`m�`m�n�o�o��$�*�*�*��L�w�V�W�W���(�(��,�,�,��	h��$�-�-�X\�Xe�Xe�f�g�g�s�A1�1(Bc��t|d�sst|d�r/t|dd�|_|j�|_d|_yt|�\|_}|j�|_|j
�d|_y)N�	_ttf_data�read�namez(ttf)r)�hasattr�getattrrr�r�rc�close�_pos)rrrUs  rrkzTTFontParser.readFile�sk���t�K�(��q�� � '��&�� 9��
�!"������
��	�$/�q�>� ��
�q�!"���������	���	rc
�<�|jD]�}|j|d|d�}t|�}|ddk(rtd|dd�d}t	||�}|d	}||k7s�Xtd
|j�dt|��d|d�d
t|��d�	��y)Nr8r�r��headz>lr@�rr�z
TTF file "z": invalid checksum z table: z (expected �))r��	get_chunkrrrrrr)rr�tr"r��
adjustment�	xchecksums      rr�zTTFontParser.checksumTabless������	Y�A��N�N�1�X�;��(��<�E�#�E�*�H���x�6�!�#�D�%��#�,�7��:�
� ��J�;�7���*�
�I��H�$��_c�_l�_l�mr�s{�m|�}~�@E�~F�GL�MV�GW� X�Y�Y�	Yrc	���t|j�}d|k7rNtd|jt	|�t|j�t|j�dzfz��y)N��/aczGTTF file "%s": invalid checksum %s (expected 0xB1B0AFBA) len: %d &3: %d�)rr�rrrr,)rrr�s  rrozTTFontParser.checksumFiles�������/���x���d�hl�hu�hu�v{�}E�wF�GJ�KO�KY�KY�GZ�\_�`d�`n�`n�\o�pq�\q�hs�s�t�
t� rc�R�|j|d}|j|d}||fS)z1Returns the offset and size of a given TTF table.r8r�)r")rrr�r8r�s    r�
get_table_poszTTFontParser.get_table_poss1�����C���*�����C���*�����rc��||_y)z-Moves read pointer to a given offset in file.N�r��rrr�s  rr�zTTFontParser.seeks	����	rc�,�|j|z|_y)zSkip the given number of bytes.Nr�)rr�deltas  r�skipzTTFontParser.skips���I�I��%��	rc�R�|j|�d|z|_|jS)z}Moves read pointer to the given offset within a given table and
        returns absolute offset of that position in the file.r)r�r�)rrr��offset_in_tables   r�
seek_tablezTTFontParser.seek_table s*���&�&�s�+�A�.��@��	��y�y�rc��|xjdz
c_t|j|jdz
|jd�S)zRead a 4-character tagr?�utf8)r�r�r��rrs rr�zTTFontParser.read_tag&s3���	�	�Q��	��4�>�>�$�)�)�a�-��	�	�:�6�B�Brc�8�t|j|||z�S)z,Return a chunk of raw data at given position)rr�)rrr�r�s   rr�zTTFontParser.get_chunk+s���T�^�^�C��F�
�3�4�4rc�v�|xjdz
c_t|j|jdz
�S)Nr&)r��intr�r�s r�
read_uint8zTTFontParser.read_uint8/s+���	�	�Q��	��4�>�>�$�)�)�A�+�.�/�/rc��|xjdz
c_td|j|jdz
|j�dS)zReads an unsigned shortr>r<r�r�rr�r�s rr�zTTFontParser.read_ushort3s8���	�	�Q��	��d�4�>�>�$�)�)�A�+�d�i�i�@�A�!�D�Drc��|xjdz
c_td|j|jdz
|j�dS)zReads an unsigned longr?�>Lrr�r�s rrzzTTFontParser.read_ulong8s8���	�	�Q��	��d�4�>�>�$�)�)�a�-��	�	�B�C�A�F�Frc���|xjdz
c_	td|j|jdz
|j�dS#t$r}t	|��d}~wwxYw)zReads a signed shortr>�>hrN)r�rr��structErrorr)rrrs  r�
read_shortzTTFontParser.read_short=sW���	�	�Q��	�	"��$�t�~�~�d�i�i��k�$�)�)�D�E�a�H�H���	"��5�/�!��	"�s�2A
�
	A#�A�A#c�@�td|j||dz�dS)z*Return an unsigned short at given positionr<r>r�rr�r�s  r�
get_ushortzTTFontParser.get_ushortE�#���d�4�>�>�#�c�!�e�4�5�a�8�8rc�@�td|j||dz�dS)z)Return an unsigned long at given positionr�r?rr�r�s  r�	get_ulongzTTFontParser.get_ulongIr�rc�N�|j|�\}}|j|||zS)zReturn the given TTF table)r�r�)rrr�r�r�s    r�	get_tablezTTFontParser.get_tableMs+���(�(��-���V��~�~�c�#�f�*�-�-rN�rr)r)rrrrr}r~r|rvrmrnrprlrkr�ror�r�r�r�r�r�r�r�rzr�r�r�r�rrrrere�s����4�K�)�K�
�H�$� 
!�
;�0�,-�	�
Y�t� ��&��C�
5�0�E�
G�
"�9�9�.rrec�"�eZdZdZd�Zd�Zd�Zy)�TTFontMakerzBasic TTF file generatorc��i|_y)zInitializes the generator.N)r�r�s rrvzTTFontMaker.__init__Us	����rc�F�|dk(r
t|dd�}||j|<y)zAdds a table to the TTF file.r�r@sN)r:r�)rrr��datas   r�addzTTFontMaker.addYs%���&�=��$��;�/�D�����C�rc����t�}|j�|j}t|�}d}d}|dz|kr|dz}|dz}|dz|kr�|dz}|dz|z
}�t	dd||||��d|dzz}��fd�}tt
|j���}	|	D]R\�}
�d	k(r|}t|
�}|���t	d
||t|
���t|
�dzdz}
||
z}�T|	D]!\�}
|
d
z
}
�|
dt|
�dz��#t|j��}td|�}|jdz��t	d|��|j�S)z<Finishes the generation and returns the TTF file as a stringr&rr>rAz>lHHHHrfr�c�(���t�d��S)N�latin1)r)�xr��writes ��r�<lambda>z(TTFontMaker.makeStream.<locals>.<lambda>ts����e�C��1�2�rr�z>LLLr����sNr�r@r�)rr�r�r,r�list�sorted�itemsr�getvaluerr�)rr�stmr�r�r�r�r�r8�wStr�tables_itemsr��
head_startr��paddedLengthr�r�s              @@r�
makeStreamzTTFontMaker.makeStream_s�����i���	�	��������K�	����
��A�o��*�%��/�K�)�A�-�M��A�o��*�"�B�&����^�k�1�
�	�d�8�Z��K�!.�
�<�	=��i�"�n�$��2���F�6�<�<�>�2�3��%�	+�I�C���f�}�#�
�#�D�)�H���I��$�v�x���T��;�<���I�a�K��+�L��l�*�F�	+�&�	'�I�C���I��D��$�}��D�	�"��%�&�	'� �����/����h�Y�/������a�� �
�d�4��"�#��|�|�~�rN)rrrrrvr�r�rrrr�r�Rs���� �*rr��CMapFmt2SubHeaderz*firstCode entryCount idDelta idRangeOffsetc��eZdZdZdd�Zy)�TTFNameBytesz"class used to return named stringsc��	|j|�}tj||jd��}||_|S#|jd�}Y�CxYw)Nr�r�)�decoder�__new__�encode�ustr)�cls�b�encr�rrs     rr�zTTFNameBytes.__new__�sP��	&��8�8�C�=�D��}�}�S����V�!4�5����	����		&��8�8�H�%�D�s�A�AN�r�)rrrrr�rrrr�r��s
��,�rr�c�.�eZdZdZdZiZdd�Zdd�Zd�Zy)	�
TTFontFilezTTF file parser and generatorrc��t|��r d}|jj�}	tj	||||��|j�x}|_|j|�t|�r||jk(s||jjk(ry|s0|jt|j|j���|dz
}||k\rtd|j�d|����|jj!�|jj|���tj	||||��|j|�y)aLoads and parses a TrueType font file.

        file can be a filename or a file object.  If validate is set to a false
        values, skips checksum validation.  This can save time, especially if
        the font is large.  See TTFontFile.extractInfo for more information.
        r�rjrtN)r�rr&zcannot find z	 subfont )r	�__dict__�copyrervrzr��extractInfor
r�r��update�dictr�r�
ValueError�clear)rrrs�charInforjrt�sfir�r�s        rrvzTTFontFile.__init__�s������C��}�}�)�)�+�H���%�%�d�D�8�QT�%�U�15���1B�B��d�.�� � ��*��L�)�l�D�I�I�.E�#�T�Y�Y�^�^�3����O�O�D�4�>�>�D�M�M�$Z�[��q�����#�$�D�M�M�S_�%`�a�a��
�
�#�#�%��
�
�$�$�X�.��
�!�!�$��x�\�!�Z����X�&rc	�'�|jd�}|j�}|dk7rtd|z��|j�}||j�z}dddddd�}t|j	��}t|�}t
|�D�]!}	|j�}
|j�}|j�}|j�}
|j�}|j�}|
|vr�id}|
dk(re|dk(r`|dk(r[|j}	|j||z�|d	zdk7rtd
��t|j||z|�d�}||_n.|
dk(r)|dk(r$|dk(rt|j||z|�d�}|s��||
dk(s��|||
<|dz}|dk(s��"n|d
�|d
}n|d�|d}n
|d�|d}nd}|�sYtj�r=|j}|r?tjj!tjj#|��d}|sXt%dt'j&��d|j(j*�d��}|j(xj*dz
c_n�|j,j/|d�}|s�rt%d|z�}nWt%dt'j&��d|j(j*�d��}|j(xj*dz
c_||j,|<ntd��|j)|j1dd��}|D].}t3|�dkDs|dvs�td|�dt5|�����||_|dxs||_|d	xsd|_|dxs||_|dxs||_	|jd�|j�|j�}}|dk7rtd||fz��|j�|j�f|_ |jCd�|jE�}|dk7rtd |z��|jCd	�|j�x|_#}|fd!�}|jCd"�|jI�}|jI�}|jI�}|jI�}ttK|||||g��|_&|jCd
�|j�}|j�} d#}!d$|jNv�r7|jd$�|j�}"|jCd	�|j�}#|jCd	�|j�}$|$d	k(s|$d%zr9tjj#|j�tjPv}!|jCd&�|jI�}%|jI�}&||%�|_)||&�|_*|"dkDr/|jCd"�|jI�}'||'�|_+n?|jR|_+n-d'}#||�|_)||�|_*|jR|_+d(tY|#d)zd	z�z|_-|jd*�|j�|j�}}|d+vrtd,||fz��|jI�|j�d-zz|_.|jI�|_/|jI�|_0|jE�}(tb|_2|j\dk7r|jdtfz|_2|#d.k\r|jdthz|_2|(r|jdtjz|_2|jd/�|j�|j�}}|dk7rtd0||fz��|jCd1�|j�})|)dk7rtd2|)z��|j�}*|*dk(rtd3��|jd4�|j�|j�}}|dk7rtd5||fz��|j�x|_6}+|!s%|jld6kDrtd7$z��d#|_7nd8|_7|sd|_8d|_9d|_:y| dk7rtd9| z��|jd:�},|j�}-|j�}.|.dk(r	|-dk7r|-|.}-}.d}/d}0t
|.�D]o}1|j�}2|j�}3|jE�}|2dk(rd}0|}/�=|2dk(r|3dk(r
|0dk7rd	}0|}/�Q|2dk(r
|3dk(rd}0|}/�`|2dk(s�f|3d;k7s�ld}0|}/�q|/�td<��|/|,z
}/|j|/�|j�}4ix|_8}5i}6|4d=vr2|jCd	�|jE�}|jE�}7n |j�}|j�}7|4dk(r�t
|d
z
�D�	cgc]}	|jw���}8}	t
tyd>|jlt|8���D]-}9|8|9}:|:|5|9<|6j{|:g�j}|9��/�ne|4dk(�r�|/|z};tY|j�d?z�}<|jCd
�t
|<�D�=cgc]}=|j���}>}=|jCd	�t
|<�D�=cgc]}=|j���}?}=t
|<�D�=cgc]}=|jI���}@}=|j}At
|<�D�=cgc]}=|j���}B}=t
|<�D]�}1t
|?|1|>|1dz�D]�}9B|1dk(r|9@|1zd@z}:nE|9|?|1z
d	zB|1z}Ad	|1zz|z}||;k\rd}:n!|j|�}:|:dk7r|:@|1zd@z}:|:|5|9<|6j{|:g�j}|9������n�|4d
k(rl|j�}C|j�}Dt
|C|C|Dz�D]8}:|j�}9|:|5|9<|6j{|:g�j}|9��:�n\|4dAk(rl|jE�}C|jE�}Dt
|C|C|Dz�D]8}:|j�}9|:|5|9<|6j{|:g�j}|9��:�n�|4dBk(r�|jE�}<t
|<�D]t}1|jE�}E|jE�}F|jE�|Ez
}Gt
|E|Fdz�D]-}9|9Gz}:|:|5|9<|6j{|:g�j}|9��/�v�nR|4dCk(r�|jE�}<t
|<�D]l}1|jE�}E|jE�}F|jE�}Ht
|E|Fdz�D](}9H|5|9<|6j{|Hg�j}|9��*�n�n�|4d	k(�r�t
d>�D�	cgc]}	|j���}8}	t�|8�}Ig}Jt
|Idz�D]n}	|j�}K|j�}L|j�}@|j�I|	z
dDzz
d	z
dz	}BJj}t�|K|L|@|B���p||j|,|/zz
z
dz	}Lt
|L�D�	cgc]}	|jI���}M}	dE}Nt
d>�D�]�}9|8|9dk(r�NdEk7rd}:n�|9Jdj�ksG|9Jdj�|Jdj�zk\s%Jdj�|9|Jdj�z
zLk\rd}:n<MJdj�|9|Jdj�z
z}:|:dk7r|:Jdj�z
}:|:dk7s��|:|jlks��|:|5|9<|6j{|:g�j}|9���|8|9}Ot
J|Oj��D]�}PJOj�|PzLk\rd}:n,MJOj�Pz}:|:dk7r|:JOj�z
}:|:dk7s�M|:|jlks�]|9dDzPJOj�zz}0|:|5|0<|6j{|:g�j}|0���NdEk(s���|9}N���nt�dF|4z��|jdG�d}Qix|_:}Rg|_Gt
|*�D]g}:|j�|j�}S}Q|j�j}|Q|Sf�||Q�}Q|:dk(rQ|_9|:|6vs�Y|6|:D]}TQR|T<�	�it
|*|+�D]C}:|j�}S|j�j}Q|Sf�|:|6vs�5|6|:D]}TQR|T<�	�EdH|jNvrtdI��|jdH�g|_H|dk(r@t
|+dz�D].}1|j�j}|j�dz��0nP|dk(r=t
|+dz�D]+}1|j�j}|jE���-ntdJ|z��dK|5vr|5dK|5dL<RdK|RdL<ydL|5vr|5dL|5dK<RdL|RdK<yy#||_wxYw#td|j6z��xYwcc}	wcc}=wcc}=wcc}=wcc}=wcc}	wcc}	w)Ma�
        Extract typographic information from the loaded font file.

        The following attributes will be set::
        
            name         PostScript font name
            flags        Font flags
            ascent       Typographic ascender in 1/1000ths of a point
            descent      Typographic descender in 1/1000ths of a point
            capHeight    Cap height in 1/1000ths of a point (0 if not available)
            bbox         Glyph bounding box [l,t,r,b] in 1/1000ths of a point
            _bbox        Glyph bounding box [l,t,r,b] in unitsPerEm
            unitsPerEm   Glyph units per em
            italicAngle  Italic angle in degrees ccw
            stemV        stem weight in 1/1000ths of a point (approximate)
        
        If charInfo is true, the following will also be set::
        
            defaultWidth   default glyph width in 1/1000ths of a point
            charWidths     dictionary of character widths for every supported UCS character
                           code
        
        This will only work if the font has a Unicode cmap (platform 3,
        encoding 1, format 4 or platform 0 any encoding format 4).  Setting
        charInfo to false avoids this requirement
        
        r�rzUnknown name table format (%d)N)r&r>r�r?�r�r&i	r>z0PostScript name is UTF-16BE string of odd length�	utf_16_be�	mac_romanrr?�_RL_�_�_TTF�z
_RL_%s_TTFz#Could not find PostScript font name� �-�~s [](){}<>/%zpsName=z contains invalid character �Regularr�z head table not found ttf name=%sz"Unknown head table version %d.%04xi�<_zInvalid head table magic %04xc��|dz|zS)Ng@�@r)r��
unitsPerEms  rr�z(TTFontFile.extractInfo.<locals>.<lambda>5s���U��Z�1G�rrAT�OS/2i�:i��2g@P@�post)r&r>r�r?z"Unknown post table version %d.%04xg�@iX�hheaz"Unknown hhea table version %d.%04x�z*Unknown horizontal metric data format (%d)z!Number of horizontal metrics is 0�maxpz"Unknown maxp table version %d.%04x�z/Font does not allow subsetting/embedding (%04X)FzUnknown glyph data format (%d)r3�z'could not find a suitable cmap encoding)�
r��
r@rEg@�rr�rr@ryz#Unsupported cmap encoding format %d�hmtx�locazmissing location tablez"Unknown location table format (%d)rB�)Ir�r�rr��keysr,r�r�r�r�r�r
�autoGenerateTTFMissingTTFNamerrJrK�splitext�basenamer�time�	__class__�_agfnc�_agfnmrI�replacer�asciir��
familyName�	styleName�fullName�uniqueFontID�fontRevisionr�rzrr��map�bboxr"�allowTTFSubsetting�ascent�descent�	capHeightr��stemV�italicAngle�underlinePosition�underlineThickness�FF_SYMBOLIC�flags�	FF_ITALIC�FF_FORCEBOLD�FF_FIXED�	numGlyphs�
_full_font�charToGlyph�defaultWidth�
charWidthsr��min�
setdefaultrMr��maxr��	firstCode�
entryCount�
idRangeOffset�idDeltar��hmetrics�glyphPos)Urrr��name_offset�format�
numRecords�string_data_offset�names�K�	nameCountr1�
platformId�
encodingId�
languageId�nameIdr�r8�N�opos�psNamer`�bfn�c�ver_maj�ver_min�magicr�scale�xMin�yMin�xMax�yMax�indexToLocFormat�glyphDataFormat�subsettingAllowedr��
usWeightClass�fsType�
sTypoAscender�sTypoDescender�
sCapHeight�isFixedPitch�metricDataFormat�numberOfHMetricsr<�cmap_offset�cmapVersion�cmapTableCount�encoffsr�r!�platform�encoding�fmtr>�glyphToChar�lang�T�unichar�glyph�limit�segCountr�endCount�
startCountrG�idRangeOffset_startrF�first�count�startr*�inc�gid�maxSHK�SHrDrE�glyphs�last�k�j�awr@�lsb�charsU                                                                                     rr�zTTFontFile.extractInfo�sQ��:�o�o�f�-���!�!�#���Q�;��;�f�D�E�E��%�%�'�
�(�4�+;�+;�+=�=���$���t�4�����������J�	��z�"�	'�A��)�)�+�J��)�)�+�J��)�)�+�J��%�%�'�F��%�%�'�F��%�%�'�F��Q����A��Q��:��?�z�U�7J��y�y��%��I�I�0�6�9�:���z�Q��&�'Y�Z�Z�$�T�^�^�4F��4O�QW�%X�Yd�e�A� $�D�I��q��Z�1�_��q��!����0B�V�0K�V�!T�U`�a���U�6�]�D�(� !��f�
��Q��	��a�<��5	'�6��8���1�X�F�
�1�X�
!��1�X�F�
�1�X�
!��1�X�F��F���6�6��]�]����'�'�*�*�2�7�7�+;�+;�B�+?�@��C�C��$��	�	��T�^�^�EZ�EZ�%[�\�F��N�N�)�)�Q�.�)�!�[�[�_�_�R��3�F�!��%,�\�C�-?�%@�F�%,��	�	��T�^�^�Mb�Mb�-c�%d�F� �N�N�1�1�Q�6�1�*0����B���D�E�E��!�!�&�.�.��t�"<�=���	^�A���{�3��!�~�"5��F�SX�YZ�S[�\�]�]�	^���	���(�,�f����q��.�Y����a��*�F��
�!�!�H�.����	K��O�O�F�#� �+�+�-�t�/?�/?�/A����a�<��?�7�G�BT�T�U�U� �,�,�.��0@�0@�0B�B����	�	�!�����!���J���:�U�B�C�C��	�	�!��'+�'7�'7�'9�9���*�%/�G���	�	�"�
���� ����� ����� ����� ����U�T�4��t�$<�=�>��	��	�	�#���+�+�-���*�*�,��!���T�Z�Z���O�O�F�#��&�&�(�G��I�I�a�L� �,�,�.�M��I�I�a�L��%�%�'�F��v�~�&�6�/�$&�G�G�$4�$4�T�]�]�$C�9�Kg�Kg�$g�!��I�I�b�M� �O�O�-�M�!�_�_�.�N��
�.�D�K� ��0�D�L���{��	�	�"�
�!�_�_�.�
�!&�z�!2���!%����� �M���+�D�K� ��;�D�L�!�[�[�D�N��#�}�t�3��9�:�:��
�	
������+�+�-�t�/?�/?�/A����,�&�
�?�7�G�BT�T�U�U��?�?�,�t�/?�/?�/A�G�/K�K���!%���!2���"&�/�/�"3������(�� ��
����a�����i�/�D�J��C�����l�2�D�J�����h�.�D�J�	
������+�+�-�t�/?�/?�/A����a�<��?�7�G�BT�T�U�U��	�	�"�
��+�+�-���q� ��G�JZ�Z�[�[��+�+�-���q� ��>�?�?�	
������+�+�-�t�/?�/?�/A����a�<��?�7�G�BT�T�U�U�%)�%5�%5�%7�7���� ��~�~�d�"��P�SY�Y�Z�Z�"&���#�D�O��#�D�� $�D��"�D�O���a���;�o�M�N�N��o�o�f�-���&�&�(���)�)�+���1���a��*5�~�K�N������~�&�	!�A��'�'�)�H��'�'�)�H��_�_�&�F���{��� ���1���1���a���� ���1���1���� ���1���1���� ��	!� �?��D�E�E��;����	�	�'����� ��)+�+���;����,���I�I�a�L��_�_�&�F��?�?�$�D��%�%�'�F��#�#�%�D���6�,1�&��(�O�<�q����"�<�A�<� ��S�����A��!?�@�
A���'�
��',��G�$��&�&�u�R�0�7�7��@�
A��!�V��f�$�E��4�+�+�-��3�4�H��I�I�a�L�49�(�O�D�q��(�(�*�D�H�D��I�I�a�L�6;�H�o�F��$�*�*�,�F�J�F�27��/�B�Q�t���(�B�G�B�"&�)�)��9>�x��I�A�T�-�-�/�I�M�I��8�_�
E��$�Z��]�H�Q�K�!�O�D�E�G�$�Q�'�1�,�!(�7�1�:�!5�� ?��")�J�q�M�"9�Q�!>��q�AQ�!Q��!4�q�1�u�!<�v�!E��!�U�?�$%�E�$(�O�O�F�$;�E�$��z�).����);�v�(E��+0�K��(��*�*�5��4�;�;�G�D�E�
E� �!�V��$�$�&�E��$�$�&�E��u�U�5�[�1�
A���*�*�,��',��G�$��&�&�u�R�0�7�7��@�
A��"�W��O�O�%�E��O�O�%�E��u�U�5�[�1�
A���*�*�,��',��G�$��&�&�u�R�0�7�7��@�
A��"�W����(�H��8�_�
E�����)���o�o�'���o�o�'�%�/��$�U�3�q�5�1�E�G�#�c�M�E�+0�K��(��*�*�5��4�;�;�G�D�E�	
E��"�W����(�H��8�_�
C�����)���o�o�'���o�o�'��$�U�3�q�5�1�C�G�+.�K��(��*�*�3�r�2�9�9�'�B�C�	
C��!�V�-2�3�Z�8���!�!�#�8�A�8���V�F��B��6�!�8�_�
Y�� �,�,�.�	�!�-�-�/�
��*�*�,��!%�!1�!1�!3�V�A�X�q�L�!@��!B�Q� F�
��	�	�+�I�j���W�X�
Y�!�$�)�)�[��-@�"A�B�Q�F�J�16�z�1B�C�A�d�o�o�'�C�F�C��D� ��:�
'���W�:�q�=��R�x� !��!�"�Q�%�/�/�1�W�b��e�o�o�b�QR�e�N^�N^�>^�5^��q�E�/�/���A����1H�I�:�U� !�� &�r�!�u�':�':�G�B�q�E�O�O�<S�'T� U�� �!�8�!�R��U�]�]�2�E��a�x�E�$�.�.�$8�/4��G�,�#�.�.�u�R�8�?�?��H��'�
�A�"�2�a�5�#3�#3�4�
I���a�5�.�.�q�0�*�<�$%�E�$*�2�a�5�+>�+>�q�+@�$A�E�$�q�y� %��A���� 6�� �!�8��d�n�n�(<�#*�A�:��"�Q�%�/�/�0A�"B�C�/4�K��,�'�2�2�5��<�C�C�C�H�
I��R�x�&��=
'�@�B�S�H�I�I�	
�����
��')�)���*���
��+�,�
	*�E��&�&�(�$�*:�*:�*<��B��M�M� � �"�c��+��r��B���z�$&��!���#�'��.�*�D�')�J�t�$�*�
	*��+�Y�7�	*�E��"�"�$�C��M�M� � �"�c��+���#�'��.�*�D�')�J�t�$�*�
	*�����#�8�4L�+M�%M��������
��q� ��9�q�=�)�
>���
�
�$�$�T�%5�%5�%7�1�%<�=�
>�
��
"��9�q�=�)�
8���
�
�$�$�T�_�_�%6�7�
8��?�BR�R�S�S��;�� +�D� 1�K���)�$�/�J�t��
�[�
 � +�D� 1�K���)�$�/�J�t��!��g!%�D�I��n	K��=��	�	�I�J�J��@=��E��F��B��I��j9��DsP�AAL?�AM�AM(�AM-�;AM2�!AM7�AM<�6AN�AN�L?	AM�MAM%c��t�}dg}ddi}i}|D]M}||jvr|j|}nd}||vrt|�||<|j|�||||<�O|j	d�d}d}	|	t|�k�rS||	}|j
|}
|j
|dz|
z
}|	dz
}	|s�@|j
||
z�|j�}|dkr�|jd�t}
|
tzr�|j�}
|j�}||vrt|�||<|j|�|
tzr|jd�n|jd�|
tzr|jd�n5|
tzr|jd�n|
tzr|jd�|
tzr��|	t|�kr��SdD]$}	|j||j!|���&d|j!d	�dd
zdz}|jd	|�t|�}g}t%|�D]K}	|j&||	\}}|jt)|��|jt)|���Mt|�dz
}	|	r$||	||	dz
k(r|	dz}	|	r||	||	dz
k(r�|	dz
}	|	dz	}|d|	||	dzdd�z}t+d
t|�zg|z�}|jd|�|j!d�}t-|d|�}|jd|�|j!d�}t-|d|�}|jd|�t|�}d|dzz}ddddddd|dd|gt/t1|j2|��z}t+d
t|�zg|z�}|jd|�|j!d�}g}g}d}t%|�D�]@}	|j|�||	}|j
|}
|j
|dz|
z
}||
|
|z}|dkDr�t5d|dd�ddkr�d} t}
|
tzr�t5d|| | dz�d}
t5d|| dz| dz�d}t-|| dz||�}| dz} |
tzr| dz} n| dz} |
tzr| dz} n|
tzr| dz} n|
tzr| dz} |
tzr��|j|�||z}|dzdk7s�� d|dzz
}!|jd|!z�||!z}��C|j|�|jddj7|��g}"|dzdz	dkDr3d}#|D]}$|"j|$��t+dt|"�zg|"z�}"n5d}#|D]}$|"j|$dz	��t+d
t|"�zg|"z�}"|jd|"�|j!d�}%t-|%d|#�}%|jd|%�|j9�S#t"$rY��gwxYw)z"Create a subset of a TrueType fontr�glyfr&r@r?r>)r�rzcvt �fpgm�prepsrrAsNz>%dHrr�"rrr�rr3r�r<�rrz>%dLrr�r)r�r>r,rMr�rIr�r�r��GF_MORE_COMPONENTSr��GF_ARG_1_AND_2_ARE_WORDS�GF_WE_HAVE_A_SCALE�GF_WE_HAVE_AN_X_AND_Y_SCALE�GF_WE_HAVE_A_TWO_BY_TWOr�r��KeyErrorr�rHr�rr=r�r-rIrr.r�)&rrr0�output�glyphMap�glyphSet�codeToGlyph�code�originalGlyphIdxr�r!rI�glyphLen�numberOfContoursr8�glyphIdxr�rr<rr�r�rlrrrEr�r3�	glyphData�offsetsr�r�r��pos_in_glyph�paddingrrbr8r�s&                                      r�
makeSubsetzTTFontFile.makeSubsetjs�������3���a�5�����	;�D��t�'�'�'�#'�#3�#3�D�#9� �#$� ��x�/�-0��]��)�*���� 0�1� (�)9� :�K���	;��"�"�6�*�1�-��
���#�h�-��'��{���}�}�%5�6�H��}�}�%5��%9�:�X�E�H�
��F�A��X��I�I�e�h�&�'�#���0���!�#��	�	�!��*���0�0� �,�,�.�E�#�/�/�1�H��x�/�-0��]���*� ����1��7�7��	�	�!���	�	�!���1�1��	�	�!���!<�<��	�	�!���!8�8��	�	�!���0�0��#�h�-��><�	�C�
��
�
�3����s� 3�4�	�#�T�^�^�F�%;�A�b�%A�A�L�P���
�
�6�4� ���M�	����y�!�	"�A��m�m�H�Q�K�0�G�B���K�K��B�� ��K�K��C��!�	"�
��I�a�K���D��G�T�!�A�#�Y�&�
��F�A��D��G�T�!�A�#�Y�&�	
�Q����a�4���B�Q�x�$�q��s�v�A�v�,�&���v��D�	�)�*�T�1�3���
�
�6�4� ��~�~�f�%���4��%5�6���
�
�6�4� ��~�~�f�%���4��I�.���
�
�6�4� ���[�
��j�1�n�$���1��1�a���6�1���	�
�C�����0�1�2���v��D�	�)�*�T�1�3���
�
�6�4� ��N�N�6�*�	��������y�!�	$�A��N�N�3��'��{���}�}�%5�6�H��}�}�%5��%9�:�X�E�H��X�h�x�&7�8�D��!�|��t�T�"�1�X� 6�q� 9�A� =�!��*���0�0�"�4��l�<��>�)J�K�A�N�E�%�d�D��a���Q��,O�P�QR�S�H�&�t�\�A�-=�x��?Q�R�D�#/�!�#3�L��7�7�'3�a�'7��'3�a�'7���1�1�'3�a�'7���!<�<�'3�a�'7���!8�8�'3�a�'7���0�0�
�K�K�����.�C��Q�w�!�|��c�A�g�+�����E�G�O�,��G�m��?	$�@	���s���
�
�6�3�8�8�D�>�*����!�G��>�F�"� ��!�
$�����F�#�
$��6�C��I�-�.��5�7�D� ��!�
)�����F�a�K�(�
)��6�C��I�-�.��5�7�D��
�
�6�4� ��~�~�f�%���4��%5�6���
�
�6�4� �� � �"�"��c�
��	
�s�$!X;�;	Y�YN)r&rr)r&)	rrrrr$r%rvr�r�rrrr�r��s!��#�
�F�
�F�'�8l0�`
l#rr�rfrgic�$�eZdZdZdd�Zd�Zd�Zy)�
TTFontFacez�TrueType typeface.

    Conceptually similar to a single byte typeface, but the glyphs are
    identified by UCS character codes instead of glyph names.c�v�tjj|d�tj||||��y)z$Loads a TrueType font from filename.Nr�)r�TypeFacervr�)rrrrjrts    rrvzTTFontFace.__init__.s/�����$�$�T�4�0����D�(�X�L��Yrc�N�|jj||j�S)z'Returns the width of character U+<code>)r@rIr?)rrr�s  r�getCharWidthzTTFontFace.getCharWidth3s�����"�"�4��):�):�;�;rc��tj�}|j|�|_t	|j�|j
d<|jrtjg|_|j|d|j�d|�d��}|jtz}|tz}tjd|j|j |j"|tj$|j&�tj(|�|j*|j,||j.d��}|j|d|z�S)z�Generate a TrueType font subset and add it to the PDF document.
        Returns a PDFReference to the new FontDescriptor object.�Length1z	fontFile:�(r�z/FontDescriptor)�Type�Ascent�	CapHeight�Descent�Flags�FontBBox�FontName�ItalicAngle�StemV�	FontFile2�MissingWidthzfontDescriptor:)r�	PDFStreamr��contentr,�
dictionary�compression�PDFZCompress�filters�	Referencerr8�FF_NONSYMBOLICr7�
PDFDictionaryr0r2r1�PDFArrayr.�PDFNamer4r3r?)rr�docr/r0�fontFile�fontFileRefr8�fontDescriptors        r�addSubsetObjectszTTFontFace.addSubsetObjects7s���#�#�%���?�?�6�2���),�X�-=�-=�)>����I�&��?�?� &� 3� 3�4�H���m�m�H�4�=�=�RZ�.[�\���
�
�~�-�-����#���-�-�%��k�k�����|�|������	�	�2����x�0��+�+��Z�Z�$� �-�-�/����}�}�^�->��-I�J�JrNr�)rrrrrvr�r�rrrr�r�(s��A�
Z�
<�Krr�c��eZdZdZd�Zy)�
TTEncodingz�Encoding for TrueType fonts (always UTF-8).

    TTEncoding does not directly participate in PDF object creation, since
    we need a number of different 8-bit encodings for every generated font
    subset.  TTFont itself cares about that.c��d|_y)NzUTF-8)r�r�s rrvzTTEncoding.__init__[s	����	rN)rrrrrvrrrr�r�Ts��0�rr�c�X�eZdZdZGd�d�ZdZdZdd�Zd
d�Zdd�Z	dd	�Z
d
�Zd�Zy)�TTFonta�Represents a TrueType font.

    Its encoding is always UTF-8.

    Note: you cannot use the same TTFont object for different documents
    at the same time.

    Example of usage:

        font = ttfonts.TTFont('PostScriptFontName', '/path/to/font.ttf')
        pdfmetrics.registerFont(font)

        canvas.setFont('PostScriptFontName', size)
        canvas.drawString(x, y, "Some text encoded in UTF-8")
    c��eZdZdZdd�Zy)�TTFont.State�FNc��ix}|_d|_d|_d|_t	|dd�}t	|dd�r�t|jj��}d|vr|jd�td�D]}||vs�|||<|j|��|D]}|||<�	|D�cgc]}|��c}g|_
d|_y|�tj}|r^ttdd��}t	|d	d�}|r|D]}||vs�|||<�n|D]}|||<�	d|d<ddgz|zg|_
d
|_ydgdgdzzg|_
d|d<d
|_d|d<ycc}w)Nr�facer=rrETrBrDr>r&)�assignments�nextCode�internalName�frozenr��setr>r�remover��subsetsr
�ttfAsciiReadabler�)	rr�
asciiReadable�ttf�Ar��Cr!�subset0r>s	         rrvzTTFont.State.__init__ps���#%�%�A�� ��D�M� $�D���D�K��3�v�d�+�D��t�L��.���(�(�-�-�/�0���1�9�a�h�h�t�n��s��$�A��A�v� ��!�������$���A��A�a�D��,-��q���/���"�����$� )� :� :�
��
�u�R��}�-��%�d�=��>���$�%����+�#$�A�a�D�%�%�!�� ��!��!���!�� "�A�3��� 0�1��� !��
�"#��R�D��G��}�����!�� !��
���"���;!/s�,	E�NN)rrr�
namePrefixrvrrr�Stater�ns���
�,	rr�r&Nc��||_t|||��|_t�|_ddlm}|�|_|�tj}||_
y)z�Loads a TrueType font from filename.

        If validate is set to a false values, skips checksum validation.  This
        can save time, especially if the font is large.
        r�r)�WeakKeyDictionaryN)�fontNamer�r�r�rr�weakrefr��stater
r��_asciiReadable)rrr�rrjrtr�r�s       rrvzTTFont.__init__�sJ����
��x�(��V��	�"���
�-�&�(��
�� �%�6�6�M�+��rc��t||||�S�N)r)rr�text�sizerrs    r�stringWidthzTTFont.stringWidth�s��%�d�4��X�>�>rc��|�|j}	|j|}|S#t$r2tj	||�x}|j|<|�||_Y|SwxYw)zIconvenience function for those wishing to roll their own state properties)r�r�r�r�r�r�)rrr�r�r�r�s     r�_assignStatezTTFont._assignState�sn��� � �/�/�M�	.��J�J�s�O�E�
���	�	.�&,�l�l�=��&F�F�E�D�J�J�s�O��%�#-�� ����		.�s�!�7A�Ac��|j}|j|}|r|j
dkrdnd}d}g}g}	t
|�s|jd�}|jj}
|j}|j}tt|�D�]b}
|
dk(rd}
|
|vr||
}�n|
|
vrd}�n|jr$tj d|j"|
fz��|j
}|d	zdk(r=|dk7r||d
z	j%d�|xj
dz
c_|j
}|dkDrP|d	zs3|j%dg�|xj
dz
c_|j
}||d
z	j%|
�n||k(rd|_|
|d|<|xj
dz
c_|||
<|d
z	|k7r%|r|	j%|t'|�f�|d
z	}g}|j%|d	z���e|r|	j%|t'|�f�|	S#t$r)tj	||�x}|j|<Y��,wxYw)
a Splits text into a number of chunks, each of which belongs to a
        single subset.  Returns a list of tuples (subset, string).  Use subset
        numbers with getSubsetInternalName.  Doc is needed for distinguishing
        subsets when building different documents at the same time.rB�i���ry�utf-8rrz:Font %s is already frozen, cannot add new character U+%04Xrr@r&�)r�r�r�r�r�r�rr�r�r>r�r�r-�ordr�r�PDFErrorr�rMr)rrr�r�rrr�r��_31skip�curSet�cur�resultsr>r�r�r�r!s               r�splitStringzTTFont.splitString�s1��
�+�+�
��Z�Z��_�U�%�%�.�.��*;�"�������������;�;�w�'�D��i�i�+�+���'�'���-�-����D�M�#	!�D��T�z�"�4��{�"���%���[�(����<�<� �/�/�*f�jn�jw�jw�y}�i~�*~����N�N���T�6�2�:��"�u�g�a�1�f�o�4�4�R�8��N�N�a�'�N����A��R�4��T�6�����s�+����!�+��!�N�N���A��F�O�*�*�4�0��'�z�*-���$(�G�A�J�q�M����!�#��$%��D�!��Q��6�!���N�N�F�5��:�#6�7��q�&�����J�J�q�4�x� �G#	!�H��N�N�F�5��:�.�/����c�S�6�<�<�
�d�3S�S�����C��S�s�H�.I	�I	c�,�|j|}|dks|t|j�k\rtd||jfz��|j�t|jtt|j�dz�z|_	d|jz|j|j<|jj|�d|j|fzS#t$r2tj|j�x}|j|<Y��wxYw)z�Returns the name of a PDF Font object corresponding to a given
        subset of this dynamic font.  Use this function instead of
        PDFDocument.getInternalFontName.rz#Subset %d does not exist in font %sr&�/z/%s+%d)r�r�r�r�r�r,r�r�r�r�r��repr�fontMapping�delayedFontsrM)rrr0r�r�s    r�getSubsetInternalNamezTTFont.getSubsetInternalName�s����Z�Z��_�U��A�:��3�u�}�}�#5�5��B�f�d�m�m�E\�\�]�]����%�!&�!1�!1�4��C�O�O�8L�q�8P�3Q�!Q�E��-0�5�3E�3E�-E�C�O�O�D�M�M�*����#�#�D�)��5�-�-�v�6�6�6���T�6�<�<��@S�@S�3T�T�����C��T�s�C�7D�Dc�h�|j|}d|_t
|j�D�]�\}}|j||�dd}djt|�d|jj|jjf�jd�}tj �}d|j"|fz|_||_||_d|_t-|�dz
|_t1t3|jj4|��}tj6|�|_tj:�}	t=||�|	_|j@rtjBg|	_"|jG|	d|z�|_$|jjK|||�|_&|jG||�}
|jNd	jP}|||<���|j|=y#t$r2tj|j�x}|j|<Y�� wxYw)
aZMakes  one or more PDF objects to be added to the document.  The
        caller supplies the internal name to be used (typically F1, F2, ... in
        sequence).

        This method creates a number of Font and FontDescriptor objects.  Every
        FontDescriptor is a (no more than) 256 character subset of the original
        TrueType font.r&Nr�+rzFont %s subset %drztoUnicodeCMap:�
BasicFonts))r�r�r�r�r�r�r-r�rr.r#r�r�rqr�r�PDFTrueTypeFontr��__Comment__�Name�BaseFont�	FirstCharr,�LastCharr�r-r�r��Widthsr�r4r�r�r�r�r��	ToUnicoder��FontDescriptor�
idToObjectr�)rrr�r�r!r0r��baseFontName�pdfFont�widths�
cmapStream�ref�fontDicts            r�
addObjectszTTFont.addObjectss����Z�Z��_�U����!�%�-�-�0�	-�H�A�f��5�5�a��=�a�b�A�L��H�H�g�a�j��d�i�i�n�n�T�Y�Y�E[�E[�%\�]�e�e�fn�o�L��,�,�.�G�"5�����8J�"J�G��'�G�L�+�G�� !�G��"�6�{�Q��G���#�d�i�i�4�4�f�=�>�F�#�_�_�V�4�G�N��)�)�+�J�!2�<��!H�J�����&,�&9�&9�%:�
�"� #�
�
�j�:J�\�:Y� Z�G��%)�Y�Y�%?�%?��\�SY�%Z�G�"��-�-���6�C��~�~�l�3�8�8�H�%,�H�\�"�5	-�6
�J�J�s�O��;�T�6�<�<��@S�@S�3T�T�����C��T�s�G6�67H1�0H1)rrNr�r�)r�)
rrrrr��
_multiByte�_dynamicFontrvr�r�r�rrrrrr�r�^s=���.�.�`�J��L�
,�?�
�8�t7�&rr�c�,�tj�yr�)rHr�rrr�_resetr0s�����r)�register_reset)J�__version__r�structrrrr�r\rrrr	r
�reportlab.pdfbaserr�	reportlabr
�reportlab.lib.rl_accelrrrr�collectionsr�iorrJr"r�rr�	maketransr#r4r:r=r��GF_ARGS_ARE_XY_VALUES�GF_ROUND_XY_TO_GRIDr��GF_RESERVEDr�r�r��GF_WE_HAVE_INSTRUCTIONS�GF_USE_MY_METRICS�GF_OVERLAP_COMPOUND�GF_SCALED_COMPONENT_OFFSET�GF_UNSCALED_COMPONENT_OFFSETrHrWrcrer�r�r�r�r;�FF_SERIFr7�	FF_SCRIPTr�r9�	FF_ALLCAP�FF_SMALLCAPr:r�r�r�r�r�reportlab.rl_configrrrr�<module>r0s�����0	��d6�5�L�L�0��U�U�"���	�v���	��O�O�M�-�@�5�
�6B�
5�#)��"(��"(��"(��"(��"(��"(��"(��"(��"(��")��")��")����
�"5�$m.�m.�^7�7�t�2�4`�a��	�5�	�}	#��}	#�J�������	����	��	�����*K��Z�0�0�*K�X��O�O�d�/��v��r

Zerion Mini Shell 1.0