403Webshell
Server IP : 93.86.61.54  /  Your IP : 216.73.216.60
Web Server : Apache/2.4.62 (Ubuntu)
System : Linux rasin.ddns.net 6.8.0-124-generic #124~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Tue May 26 21:05:19 UTC x86_64
User : www-data ( 33)
PHP Version : 8.4.22
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /lib/python3/dist-packages/fontTools/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /lib/python3/dist-packages/fontTools/__pycache__/fontBuilder.cpython-310.pyc
o

��a�y�@s�dgZ	ddlmZmZddlmZddlmZddlZddl	m
Z
ed�idd	�d
d	�dd�dd
�dd�dd�dd�dd�dd�dd�dd�dd�dd�dd�dd�dd�dd��Zedddddddddddddddd�Z
ed dd!�Zed"ddddddddd#�	Zed�idd�d$d�d%d�d&d�d'd�d(d�d)d�d*d�d+d�d,d�d-d�d.d�d/d�d0d�d1d�d2d�d3d��Zed�idd�d$d�d%d�d&d�d4d�d5d�d6d�d7d�d+d�d,d�d.d�d/d�d0d�d1d�d8d�d2d�d9d��Zed�id:d�d;d�d<d�d=d�d>d?�d@dA�dBdC�dDdE�dFdG�dHdI�dJdK�dLdM�dNdO�dPdQ�dRdS�dTdU�dVdW�dXdY�dZd[�d\d]�d^d_�d`da�dbdc�ddde�dfdg��Zedddddddddddh�
Zed�id@d�did�djdk�dldA�dmd?�dnd�dod�dpd�dqd�drd�dsd�dtd�dud�dvd�dwd�dxd�dye�dzd�d{d�d|d�d}d�d~d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d��d�d�d�d�d�d��ZGd�d�de�Zd�d��Zd�d��ZdS)��FontBuilder�)�TTFont�newTable)�cmap_classes)�timestampNow�N)�OrderedDict�tableVersiong�?�fontRevision�checkSumAdjustment�magicNumberi�<_�flags��
unitsPerEmi��created�modified�xMin�yMin�xMax�yMax�macStyle�
lowestRecPPEM�fontDirectionHint��indexToLocFormat�glyphDataFormat�)r	�	numGlyphs�	maxPoints�maxContours�maxCompositePoints�maxCompositeContours�maxZones�maxTwilightPoints�
maxStorage�maxFunctionDefs�maxInstructionDefs�maxStackElements�maxSizeOfInstructions�maxComponentElements�maxComponentDepthiP)r	r�@)	�
formatType�italicAngle�underlinePosition�underlineThickness�isFixedPitch�minMemType42�maxMemType42�minMemType1�maxMemType1�ascent�descent�lineGap�advanceWidthMax�minLeftSideBearing�minRightSideBearing�
xMaxExtent�caretSlopeRise�
caretSlopeRun�caretOffset�	reserved0�	reserved1�	reserved2�	reserved3�metricDataFormat�numberOfHMetrics�advanceHeightMax�minTopSideBearing�minBottomSideBearing�
yMaxExtent�	reserved4�numberOfVMetrics�	copyright�
familyName�	styleName�uniqueFontIdentifier�fullName��version��psName��	trademark��manufacturer��designer�	�description�
�	vendorURL��designerURL��licenseDescription�
�licenseInfoURL��typographicFamily��typographicSubfamily��compatibleFullName��
sampleText��postScriptCIDFindfontName��
wwsFamilyName��wwsSubfamilyName��lightBackgroundPalette��darkBackgroundPalette��variationsPostScriptNamePrefix�)
�bFamilyType�bSerifStyle�bWeight�bProportion�	bContrast�bStrokeVariation�	bArmStyle�bLetterForm�bMidline�bXHeight�
xAvgCharWidth�
usWeightClassi��usWidthClass�fsType�ySubscriptXSize�ySubscriptYSize�ySubscriptXOffset�ySubscriptYOffset�ySuperscriptXSize�ySuperscriptYSize�ySuperscriptXOffset�ySuperscriptYOffset�yStrikeoutSize�yStrikeoutPosition�sFamilyClass�panose�ulUnicodeRange1�ulUnicodeRange2�ulUnicodeRange3�ulUnicodeRange4�	achVendIDz????�fsSelection�usFirstCharIndex�usLastCharIndex�
sTypoAscender�sTypoDescender�sTypoLineGap�usWinAscent�usWinDescent�ulCodePageRange1�ulCodePageRange2�sxHeight�
sCapHeight�
usDefaultChar�usBreakChar� �usMaxContext�usLowerOpticalPointSize�usUpperOpticalPointSizec@s2eZdZdFdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Zdd�Z	dGdd�Z
dHdd�Zdd�Zdd�Z
dIdd�Zdd�ZdJdd�Zd d!�Zd"d#�Zd$d%�Zd&d'�Zd(d)�Zd*d+�Zd,d-�Zd.d/�Zd0d1�ZdKd2d3�ZdJd4d5�Zd6d7�Zd8d9�ZdId:d;�ZdLd=d>�Z				dMd?d@�Z 			dNdAdB�Z!dOdDdE�Z"dS)PrNTcCsh|dur$tdd�|_||_t�}|dusJ�|j|||d�|��dS|dus*J�||_d|v|_dS)a�Initialize a FontBuilder instance.

        If the `font` argument is not given, a new `TTFont` will be
        constructed, and `unitsPerEm` must be given. If `isTTF` is True,
        the font will be a glyf-based TTF; if `isTTF` is False it will be
        a CFF-based OTF.

        If `font` is given, it must be a `TTFont` instance and `unitsPerEm`
        must _not_ be given. The `isTTF` argument will be ignored.
        NF)�recalcTimestamp)rrr�glyf)r�font�isTTFr�	setupHead�	setupMaxp)�selfrr�r��now�r��7/usr/lib/python3/dist-packages/fontTools/fontBuilder.py�__init__BszFontBuilder.__init__cC�|j�|�dS)zgSave the font. The 'file' argument can be either a pathname or a
        writable file object.
        N)r��save)r��filer�r�r�r�Y�zFontBuilder.savecCsRt|�}|j|<|��D]
\}}t|||�q
|��D]
\}}t|||�q|S�N)rr��items�setattr)r��tableTag�defaults�values�table�k�vr�r�r��_initTableWithValues_sz FontBuilder._initTableWithValuescCs,|j|}|��D]
\}}t|||�q	dSr�)r�r�r�)r�r�r�r�r�r�r�r�r��_updateTableWithValuesgs
�z"FontBuilder._updateTableWithValuescK�|�dt|�dS)zCreate a new `head` table and initialize it with default values,
        which can be overridden by keyword arguments.
        �headN)r��
_headDefaults�r�r�r�r�r�r�l�zFontBuilder.setupHeadcK�|�d|�dS)z^Update the head table with the fields and values passed as
        keyword arguments.
        r�N)r�r�r�r�r��
updateHeadrr�zFontBuilder.updateHeadcCr�)z!Set the glyph order for the font.N)r��
setGlyphOrder)r��
glyphOrderr�r�r��setupGlyphOrderxszFontBuilder.setupGlyphOrderFcCsXg}t|�}|dkr"tdd�|��D��}t|ddd�}|�|�n|}d}t||dd�}	z|	�|j�WntjyN|sCt	d	��d}t||dd�}	Ynw|�|	�t||d
d�}
|�|
�|dur�i}|D]\}}
}|�
|�|krvd}|
|vr~g||
<||
�||f�qhtidd
d
�}||_|�|�td�|jd<d
|jd_
||jd_dS)a�Build the `cmap` table for the font. The `cmapping` argument should
        be a dict mapping unicode code points as integers to glyph names.

        The `uvs` argument, when passed, must be a list of tuples, describing
        Unicode Variation Sequences. These tuples have three elements:
            (unicodeValue, variationSelector, glyphName)
        `unicodeValue` and `variationSelector` are integer code points.
        `glyphName` may be None, to indicate this is the default variation.
        Text processors will then use the cmap to find the glyph name.
        Each Unicode Variation Sequence should be an officially supported
        sequence, but this is not policed.
        i��css$�|]
\}}|dkr||fVqdS)rNr�)�.0r�r�r�r�r��	<genexpr>�s�"z0FontBuilder.setupCharacterMap.<locals>.<genexpr>r`rr\rPrzFcmap format 4 subtable overflowed; sort glyph order by unicode to fix.rNrdrR�cmap)�max�dictr��buildCmapSubTable�append�compiler��struct�error�
ValueError�get�uvsDictrr	�tables)r��cmapping�uvs�
allowFallback�	subTables�highestUnicode�cmapping_3_1�
subTable_3_10�format�subTable_3_1�subTable_0_3r��unicodeValue�variationSelector�	glyphName�uvsSubTabler�r�r��setupCharacterMap|sH
��


zFontBuilder.setupCharacterMapcCsptd�}|jd<g|_|��D]%\}}t|t�r|}nt|}t|t�r*t|d�}|j	||j|||d�qdS)a�Create the `name` table for the font. The `nameStrings` argument must
        be a dict, mapping nameIDs or descriptive names for the nameIDs to name
        record values. A value is either a string, or a dict, mapping language codes
        to strings, to allow localized name table entries.

        By default, both Windows (platformID=3) and Macintosh (platformID=1) name
        records are added, unless any of `windows` or `mac` arguments is False.

        The following descriptive names are available for nameIDs:

            copyright (nameID 0)
            familyName (nameID 1)
            styleName (nameID 2)
            uniqueFontIdentifier (nameID 3)
            fullName (nameID 4)
            version (nameID 5)
            psName (nameID 6)
            trademark (nameID 7)
            manufacturer (nameID 8)
            designer (nameID 9)
            description (nameID 10)
            vendorURL (nameID 11)
            designerURL (nameID 12)
            licenseDescription (nameID 13)
            licenseInfoURL (nameID 14)
            typographicFamily (nameID 16)
            typographicSubfamily (nameID 17)
            compatibleFullName (nameID 18)
            sampleText (nameID 19)
            postScriptCIDFindfontName (nameID 20)
            wwsFamilyName (nameID 21)
            wwsSubfamilyName (nameID 22)
            lightBackgroundPalette (nameID 23)
            darkBackgroundPalette (nameID 24)
            variationsPostScriptNamePrefix (nameID 25)
        �name��en)�ttFont�nameID�windows�macN)
rr��namesr��
isinstance�int�_nameIDs�strr��addMultilingualName)r��nameStringsr�r��	nameTable�nameName�	nameValuer�r�r�r��setupNameTable�s%


��zFontBuilder.setupNameTablecs�d|vr$|j����fdd����D�}ttt|�tt|����|d<|�dt	|�d|vsOd|vsQd|vsSd|vsUd|jvsDJd	��|jd�
|j�d
Sd
Sd
Sd
Sd
S)zCreate a new `OS/2` table and initialize it with default values,
        which can be overridden by keyword arguments.
        r�cs$g|]}�|jdkr�|j�qS)r)�width)r�r���gsr�r��
<listcomp>�s
�z(FontBuilder.setupOS2.<locals>.<listcomp>zOS/2r�r�r�r�z6the 'cmap' table must be setup before the 'OS/2' tableN)r��getGlyphSet�keysr��round�sum�float�lenr��_OS2Defaults�recalcUnicodeRanges)r�r��widthsr�r�r��setupOS2�s&

� ��zFontBuilder.setupOS2cCsfddlm}m}m}m}m}	m}
|jrJ�d|j_	|�}d|_
d|_|j|_|g|_
|�|_|	�}||_|
�}
|��D]
\}}t|
||�q;d}d}|�}|j��|_|
|_|j|_|��D]
\}}t|||�q^d|vr~d|jdj}|dd|ddg|_|d|j||
||�}|��D]\}}|
|_||_|||<q�||_|j�|�td�|jd<||jd_dS)Nr)�
CFFFontSet�TopDictIndex�TopDict�CharStrings�GlobalSubrsIndex�PrivateDict�OTTOr�
FontMatrixr�zCFF )�cffLibrrr
rrrr�r��sfntVersion�major�minor�otFont�	fontNames�topDictIndex�GlobalSubrsr�r��
getGlyphOrder�charset�Privaterr�private�globalSubrsr�r�cff)r�rS�fontInfo�charStringsDict�privateDictrrr
rrr�fontSetrr�key�value�fdSelect�fdArray�topDict�scale�charStringsr��
charStringr�r�r��setupCFF�sH 
	�
zFontBuilder.setupCFFcCs�ddlm}m}m}m}m}m}	m}
m}|j	rJ�d|j
_|�}d|_d|_
|j
j}
|d|
d�|_|�}||_|dur>ig}d}|
�}d|_||_|D]$}|�}|�d�|	�}|��D]
\}}t|||�q\||_|�|�qK|�}|
|_||_d|j
dj}|dd|ddg|_|dj}|dd||||�}|��D]\}}||_||_|||<q�||_|j�|�td�|j
d<||j
d_|r�|�|�dSdS)	Nr)rrr
rrr�FDArrayIndex�FontDictrrrTr��CFF2) rrrr
rrrr.r/r�r�rrrrrr�strings�setCFF2r�r�rr��cff2GetGlyphOrder�FDArrayrrrrrr �setupCFF2Regions)r�r"�fdArrayList�regionsrrr
rrrr.r/r$r3rr'r(r#�fontDictrr%r&r)r*r+r�r,r�r�r��	setupCFF20sT(



�zFontBuilder.setupCFF2c
Cs�ddlm}m}m}ddlm}d|jvsJd��d|jvs"Jd��dd	�|jdjD�}|||�}|tt	t
|���dd
d�}|||g�}	||	d�}
|jdjjd
}|
|_
|jD]}|
|j_qYdS)Nr)�buildVarRegionList�buildVarData�
buildVarStore)�VarStoreData�fvarzfvar must to be set up firstr0zCFF2 must to be set up firstcSsg|]}|j�qSr�)�axisTag)r��ar�r�r�rssz0FontBuilder.setupCFF2Regions.<locals>.<listcomp>F)�optimize)�
otVarStorer)�varLib.builderr:r;r<rr=r��axes�list�rangerr r�VarStorer4r�vstore)
r�r7r:r;r<r=�axisTags�
varRegionList�varData�varStorerHr)r8r�r�r�r5ms



�zFontBuilder.setupCFF2RegionscCsb|jsJ�td�|jd<td�|jd<||jd_t|jd�r'|jj|jd_|r/|��dSdS)a|Create the `glyf` table from a dict, that maps glyph names
        to `fontTools.ttLib.tables._g_l_y_f.Glyph` objects, for example
        as made by `fontTools.pens.ttGlyphPen.TTGlyphPen`.

        If `calcGlyphBounds` is True, the bounds of all glyphs will be
        calculated. Only pass False if your glyph objects already have
        their bounding box values set.
        �locar�r�N)r�rr��glyphs�hasattrr��calcGlyphBounds)r�rNrPr�r�r��	setupGlyf}s
	�zFontBuilder.setupGlyfcCst|j||�dS)a�Adds an font variations table to the font.

        Args:
            axes (list): See below.
            instances (list): See below.

        ``axes`` should be a list of axes, with each axis either supplied as
        a py:class:`.designspaceLib.AxisDescriptor` object, or a tuple in the
        format ```tupletag, minValue, defaultValue, maxValue, name``.
        The ``name`` is either a string, or a dict, mapping language codes
        to strings, to allow localized name table entries.

        ```instances`` should be a list of instances, with each instance either
        supplied as a py:class:`.designspaceLib.InstanceDescriptor` object, or a
        dict with keys ``location`` (mapping of axis tags to float values),
        ``stylename`` and (optionally) ``postscriptfontname``.
        The ``stylename`` is either a string, or a dict, mapping language codes
        to strings, to allow localized name table entries.
        N)�addFvarr�)r�rD�	instancesr�r�r��	setupFvar�szFontBuilder.setupFvarcCs$ddlm}||jtt|���dS)z�Adds an axis variations table to the font.

        Args:
            axes (list): A list of py:class:`.designspaceLib.AxisDescriptor` objects.
        r)�	_add_avarN)�varLibrUr�r�	enumerate)r�rDrUr�r�r��	setupAvar�szFontBuilder.setupAvarcCs(td�}|jd<d|_d|_||_dS)N�gvarrr)rr�rQ�reserved�
variations)r�r[rYr�r�r��	setupGvar�s
zFontBuilder.setupGvarcCs(|jd}|j��D]}|�|�q
dS)z�Calculate the bounding boxes of all glyphs in the `glyf` table.
        This is usually not called explicitly by client code.
        r�N)r�rNr��recalcBounds)r��
glyphTable�glyphr�r�r�rP�s
�zFontBuilder.calcGlyphBoundscCr�)z�Create a new `hmtx` table, for horizontal metrics.

        The `metrics` argument must be a dict, mapping glyph names to
        `(width, leftSidebearing)` tuples.
        �hmtxN��setupMetrics�r��metricsr�r�r��setupHorizontalMetrics��z"FontBuilder.setupHorizontalMetricscCr�)z�Create a new `vmtx` table, for horizontal metrics.

        The `metrics` argument must be a dict, mapping glyph names to
        `(height, topSidebearing)` tuples.
        �vmtxNrarcr�r�r��setupVerticalMetrics�rfz FontBuilder.setupVerticalMetricscCs^|dvsJ�t|�}|j|<i}|D]}||\}}tt|��tt|��f||<q||_dS)z<See `setupHorizontalMetrics()` and `setupVerticalMetrics()`.)r`rgN)rr�r�rrd)r�r�rd�mtxTable�roundedMetrics�gn�w�lsbr�r�r�rb�s
zFontBuilder.setupMetricscKr�)z{Create a new `hhea` table initialize it with default values,
        which can be overridden by keyword arguments.
        �hheaN)r��
_hheaDefaultsr�r�r�r��setupHorizontalHeader�r�z!FontBuilder.setupHorizontalHeadercKr�)z{Create a new `vhea` table initialize it with default values,
        which can be overridden by keyword arguments.
        �vheaN)r��
_vheaDefaultsr�r�r�r��setupVerticalHeader�r�zFontBuilder.setupVerticalHeadercs�|dur-i�|D]}||}|�vrd�|<q�|d7<qt��fdd�dd�d}|�diti|d	��|jd}d|_d|_|D]}||||<qEdS)
aYCreate a new `VORG` table. The `verticalOrigins` argument must be
        a dict, mapping glyph names to vertical origin values.

        The `defaultVerticalOrigin` argument should be the most common vertical
        origin value. If omitted, this value will be derived from the actual
        values in the `verticalOrigins` argument.
        Nrcs�|Sr�r�)�vorg��bagr�r��<lambda>�sz2FontBuilder.setupVerticalOrigins.<locals>.<lambda>T)r%�reverser�VORG)�VOriginRecords�defaultVertOriginY)�sortedr�r�r��majorVersion�minorVersion)r��verticalOrigins�defaultVerticalOriginrkrt�	vorgTabler�rur��setupVerticalOrigins�s.
��
�
�z FontBuilder.setupVerticalOriginscKsFd|jv}|�dt|�}|js|r|rd|_g|_i|_dSd|_dS)zCreate a new `post` table and initialize it with default values,
        which can be overridden by keyword arguments.
        r0�postg@r+N)r�r��
_postDefaultsr�r,�
extraNames�mapping)r��keepGlyphNamesr��isCFF2�	postTabler�r�r��	setupPosts


zFontBuilder.setupPostcCs"|jrt}nt}|�d|i�dS)z�Create a new `maxp` table. This is called implicitly by FontBuilder
        itself and is usually not called by client code.
        �maxpN)r��_maxpDefaultsTTF�_maxpDefaultsOTFr�)r�r�r�r�r�r�szFontBuilder.setupMaxpcCs"tdddgd�}|�di|�dS)z�This adds an empty DSIG table to the font to make some MS applications
        happy. This does not properly sign the font.
        rr)�	ulVersion�usFlag�	usNumSigs�signatureRecords�DSIGN)r�r�r�r�r�r��setupDummyDSIGs�zFontBuilder.setupDummyDSIGcCs"ddlm}||j|||d�dS)a�Add OpenType features to the font from a string containing
        Feature File syntax.

        The `filename` argument is used in error messages and to determine
        where to look for "include" files.

        The optional `tables` argument can be a list of OTL tables tags to
        build, allowing the caller to only build selected OTL tables. See
        `fontTools.feaLib` for details.
        r)�addOpenTypeFeaturesFromString)�filenamer�N)�feaLib.builderr�r�)r��featuresr�r�r�r�r�r��addOpenTypeFeatures&s

�zFontBuilder.addOpenTypeFeatures�rvrncCs4ddlm}d|jvrtd��|j|j||d�dS)z|Add conditional substitutions to a Variable Font.

        See `fontTools.varLib.featureVars.addFeatureVariations`.
        r)�featureVarsr>z5'fvar' table is missing; can't add FeatureVariations.)�
featureTagN)rVr�r��KeyError�addFeatureVariations)r��conditionalSubstitutionsr�r�r�r�r�r�7s

�z FontBuilder.addFeatureVariationscCs4ddlm}|j��}|||||||d�|jd<dS)zqBuild new COLR table using color layers dictionary.

        Cf. `fontTools.colorLib.builder.buildCOLR`.
        r)�	buildCOLR)rQ�glyphMaprL�varIndexMap�	clipBoxes�COLRN)�fontTools.colorLib.builderr�r��getReverseGlyphMap)r��colorLayersrQrLr�r�r�r�r�r�r��	setupCOLREs
�zFontBuilder.setupCOLRcCs0ddlm}||||||j�d�d�|jd<dS)z�Build new CPAL table using list of palettes.

        Optionally build CPAL v1 table using paletteTypes, paletteLabels and
        paletteEntryLabels.

        Cf. `fontTools.colorLib.builder.buildCPAL`.
        r)�	buildCPALr�)�paletteTypes�
paletteLabels�paletteEntryLabelsr��CPALN)r�r�r�r�)r��palettesr�r�r�r�r�r�r��	setupCPAL]s
�zFontBuilder.setupCPALrcCs ddlm}||j|||�dS)z�Build a new 'STAT' table.

        See `fontTools.otlLib.builder.buildStatTable` for details about
        the arguments.
        r)�buildStatTableN)�otlLib.builderr�r�)r�rD�	locations�elidedFallbackNamer�r�r�r��	setupStatuszFontBuilder.setupStat)NNT)NF)TT)NN)Tr�)r�)NNNN)NNN)Nr)#�__name__�
__module__�__qualname__r�r�r�r�r�r�r�r�r�r
r-r9r5rQrTrXr\rPrerhrbrprsr�r�r�r�r�r�r�r�r�r�r�r�r�rAsP


63
3=









�
�cCs(t||�}||_||_||_d|_|S)Nr)rr��
platformID�	platEncID�language)r�r�r�r��subTabler�r�r�r��sr�cCsXddlm}m}|sJ�td�}|d}|D]C}|�}t|t�r,|\|_|_|_|_	}	n|j
|j|j|j
|jf\|_|_|_|_	}	t|	t�rKt|	d�}	|j|	|d�|_|j�|�q|D]I}
t|
t�rq|
d}|
d}	|
�d	�}n|
j}|
jpy|
j}	|
j}t|	t�r�t|	d�}	|�}
|j|	|d�|
_|dur�|�|�|
_||
_|j�|
�q\||d<dS)
Nr)�Axis�
NamedInstancer>r�r�)r��location�	stylename�postscriptfontname)�ttLib.tables._f_v_a_rr�r�rr��tupler?�minValue�defaultValue�maxValue�tag�minimum�default�maximumr�r�r�r��
axisNameIDrDr�r�r��localisedStyleNamerM�postScriptFontName�subfamilyNameID�addName�postscriptNameID�coordinatesrS)r�rDrSr�r�r>r��axis_def�axisr��instancer��psname�instr�r�r�rR�sR
��




rRr�)�__all__�ttLibrr�ttLib.tables._c_m_a_pr�misc.timeToolsrr��collectionsrr�r�r�r�r�rorrr��_panoseDefaultsr�objectrr�rRr�r�r�r��<module>sL��������	�
���
����������������	�
���
�������������	�
���
�������������	�
���
������������� �
��������	�
���
������������������� �!�"�#�$�%�&�'�+C	

Youez - 2016 - github.com/yon3zu
LinuXploit