
    h                        S /r  SSKJrJr  SSKJr  SSKJr  SSKJ	r	  SSK
Jr  SSKrSS	KJr  \" S0 S
S_SS_SS_SS_SS_SS_SS_SS_SS_SS_SS_SS_SS_SS_SS_SS_SS_6r\" S SSSSSSSSSSSSSSS!9r\" S"SS#9r\" S$SSSSSSSSS%9	r\" S0 S
S _S&S_S'S_S(S_S)S_S*S_S+S_S,S_S-S_S.S_S/S_S0S_S1S_S2S_S3S_S4S_S5S_6r\" S0 S
S _S&S_S'S_S(S_S6S_S7S_S8S_S9S_S-S_S.S_S0S_S1S_S2S_S3S_S:S_S4S_S;S_6r\" S0 S<S_S=S_S>S_S?S_S@SA_SBSC_SDSE_SFSG_SHSI_SJSK_SLSM_SNSO_SPSQ_SRSS_STSU_SVSW_SXSY_SZS[_S\S]_S^S__S`Sa_SbSc_SdSe_SfSg_ShSi_6r\	" 5       r\" S0 SBS_SjS_SkSl_SmSC_SnSA_SoS_SpS_SqS_SrS_SsS_StS_SuS_SvS_SwS_SxS_SyS_Sz\_S{S_S|S_S}S_S~S_SS_SS_SS_SS_SS_SS_SS_SS_SS_SS_SS_SS_SS_SS_SS_SS_SS_SS_6r " S S \5      rS rS rg)FontBuilder   )TTFontnewTable)cmap_classes	flagCubic)Panose)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maxComponentDepthi P  )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   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                      \ rS rSrS$S jrS rS rS rS rS r	S	 r
S%S
 jrS&S jrS rS rS'S jrS rS&S jrS rS(S jrS rS rS rS rS rS rS rS(S jrS)S jrS rS rS*S jrS+S jr      S,S  jr!   S-S! jr"S.S" jr#S#r$g)/r   i8  Nc                     UcF  [        SS9U l        X0l        [        5       nUc   eU R	                  UUUUS9  U R                  5         gUb   eX l        SU;   U l        g)aN  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.

The `glyphDataFormat` argument corresponds to the `head` table field
that defines the format of the TrueType `glyf` table (default=0).
TrueType glyphs historically can only contain quadratic splines and static
components, but there's a proposal to add support for cubic Bezier curves as well
as variable composites/components at
https://github.com/harfbuzz/boring-expansion-spec/blob/main/glyf1.md
You can experiment with the new features by setting `glyphDataFormat` to 1.
A ValueError is raised if `glyphDataFormat` is left at 0 but glyphs are added
that contain cubic splines or varcomposites. This is to prevent accidentally
creating fonts that are incompatible with existing TrueType implementations.

If `font` is given, it must be a `TTFont` instance and `unitsPerEm`
must _not_ be given. The `isTTF` and `glyphDataFormat` arguments will be ignored.
NF)recalcTimestamp)r   r   r   r   glyf)r   fontisTTFr
   	setupHead	setupMaxp)selfr   r   r   r   nows         G/var/www/html/env/lib/python3.13/site-packages/fontTools/fontBuilder.py__init__FontBuilder.__init__9  sr    , <u5DIJ.C)))NN% /	   NN%%%I4DJ    c                 :    U R                   R                  U5        g)zWSave the font. The 'file' argument can be either a pathname or a
writable file object.
N)r   save)r   files     r   r   FontBuilder.save`  s     			tr   c                     [        U5      =o@R                  U'   UR                  5        H  u  pV[        XEU5        M     UR                  5        H  u  pV[        XEU5        M     U$ N)r   r   itemssetattr)r   tableTagdefaultsvaluestablekvs          r   _initTableWithValues FontBuilder._initTableWithValuesf  sV    &.x&88		(#NN$DAEa  %LLNDAEa  #r   c                 l    U R                   U   nUR                  5        H  u  pE[        X4U5        M     g r   )r   r   r   )r   r   r   r   r   r   s         r   _updateTableWithValues"FontBuilder._updateTableWithValuesn  s,    		(#LLNDAEa  #r   c                 2    U R                  S[        U5        g)zoCreate a new `head` table and initialize it with default values,
which can be overridden by keyword arguments.
headN)r   _headDefaultsr   r   s     r   r   FontBuilder.setupHeads       	!!&-@r   c                 (    U R                  SU5        g)zNUpdate the head table with the fields and values passed as
keyword arguments.
r   N)r   r   s     r   
updateHeadFontBuilder.updateHeady  s     	##FF3r   c                 :    U R                   R                  U5        g)z!Set the glyph order for the font.N)r   setGlyphOrder)r   
glyphOrders     r   setupGlyphOrderFontBuilder.setupGlyphOrder  s    		
+r   c                 >   / nU(       a  [        U5      OSnUS:  a@  [        S UR                  5        5       5      n[        USSS5      nUR	                  U5        OUnSn[        XhSS5      n	 U	R                  U R                  5        UR	                  U	5        [        XhSS5      n
UR	                  U
5        Ubg  0 nU H:  u  pnUR                  U5      U:X  a  S
nX;  a  / X'   X   R	                  X45        M<     [        0 SSS5      nXl        UR	                  U5        [        S5      U R                  S'   SU R                  S   l        X@R                  S   l        g
! [        R                   a%    U(       d  [        S	5      eSn[        XhSS5      n	 GNf = f)ae  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.
r   i  c              3   <   #    U  H  u  pUS :  d  M  X4v   M     g7f)r    N ).0r   r   s      r   	<genexpr>0FontBuilder.setupCharacterMap.<locals>.<genexpr>  s     S3C41q7{3Cs   
rd   r   r`   rT   r   zFcmap format 4 subtable overflowed; sort glyph order by unicode to fix.Nrh   rV   cmap)maxdictr   buildCmapSubTableappendcompiler   structerror
ValueErrorgetuvsDictr   r   tables)r   cmappinguvsallowFallback	subTableshighestUnicodecmapping_3_1subTable_3_10formatsubTable_3_1subTable_0_3r   unicodeValuevariationSelector	glyphNameuvsSubTables                   r   setupCharacterMapFontBuilder.setupCharacterMap  s    	*2XF"S8>>3CSSL-hArBM]+#L(q!D		I  + 	&(q!D&?G>A:<<-: $I$313G.*11<2KL ?B ,BAq9K")[)$V,		&)*		&&#,		& 7 || 	I  \  F,\1aHL	Is   /E# #5FFc           	      *   [        S5      =o@R                  S'   / Ul        UR                  5        H_  u  pV[	        U[
        5      (       a  UnO	[        U   n[	        U[        5      (       a	  [        US9nUR                  X`R                  XrUS9  Ma     g)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)
r   r   namesr   
isinstanceint_nameIDsstrr   addMultilingualName)r   nameStringsr   r   	nameTablenameName	nameValuer   s           r   setupNameTableFontBuilder.setupNameTable  s    J )1(88	IIf%	#.#4#4#6H(C((!!(+)S)) I.	))))FQT *  $7r   c                 r   U R                  S[        U5        SU;  a?  SU R                  ;   d   S5       eU R                  S   R                  U R                  5        SU;   dU  SU;   dN  SU;   dG  SU;   d@  SU R                  ;   d   S	5       eU R                  S   R	                  U R                  5        g
g
g
g
g
)zoCreate a new `OS/2` table and initialize it with default values,
which can be overridden by keyword arguments.
zOS/2r}   hmtxz6the 'hmtx' table must be setup before the 'OS/2' tabler   r   r   r   z6the 'cmap' table must be setup before the 'OS/2' tableN)r   _OS2Defaultsr   recalcAvgCharWidthrecalcUnicodeRangesr   s     r   setupOS2FontBuilder.setupOS2  s     	!!&,?&($))#HGH#IIf00;' F* F* F* $))#HGH#IIf11$))< + + + (r   c                    SSK JnJnJnJnJn	Jn
  U R                  (       a   eSU R                  l	        U" 5       nSUl
        SUl        U R                  Ul        U/Ul        U" 5       Ul        U	" 5       nXl        U
" 5       nUR!                  5        H  u  p[#        XU5        M     S nS nU" 5       nU R                  R%                  5       Ul        UUl        UR                  Ul        UR!                  5        H  u  p[#        UX5        M     SU;  a)  SU R                  S   R*                  -  nUSSUSS/Ul        U" S UR&                  XUU5      nUR!                  5        H  u  nnUUl        UUl        UUU'   M     UUl        UR                  R3                  U5        [5        S5      U R                  S'   XR                  S   l        g )Nr   )
CFFFontSetTopDictIndexTopDictCharStringsGlobalSubrsIndexPrivateDictOTTOr   
FontMatrixr   zCFF )cffLibr  r  r  r  r  r  r   r   sfntVersionmajorminorotFont	fontNamestopDictIndexGlobalSubrsr   r   getGlyphOrdercharsetPrivater   r  privateglobalSubrsr   r   cff)r   rW   fontInfocharStringsDictprivateDictr  r  r  r  r  r  fontSetr%  r$  keyvaluefdSelectfdArraytopDictscalecharStringsr   
charStrings                          r   setupCFFFontBuilder.setupCFF  s   	
 	
 ::~ &		,#H+~&()-%++-JCG%( .)))113!%11"..*JCGS( +x'		&)444E"'Aua!;G!'//;7
 &5%:%:%<!Iz!(J%0J"%/K	" &= *##G,$V,		& '		&r   c                    SSK JnJnJnJnJnJn	Jn
Jn  U R                  (       a   eSU R                  l        U" 5       nSUl        SUl        U R                  R                  nU" S US 5      Ul        U" 5       nXl        Uc  0 /nS nU
" 5       nS Ul        UUl        U Ha  nU" 5       nUR%                  S5        U	" 5       nUR'                  5        H  u  nn[)        UUU5        M     UUl        UR-                  U5        Mc     U" 5       nUUl        UUl        SU R                  S   R2                  -  nUSSUSS/Ul        US   R*                  nU" S S UUUU5      nUR'                  5        H  u  nnUUl        UUl        UUU'   M     UUl        UR                  R-                  U5        [;        S5      U R                  S'   XR                  S   l        U(       a  U R?                  U5        g g )	Nr   )r  r  r  r  r  r  FDArrayIndexFontDictr  r   r   Tr   CFF2) r  r  r  r  r  r  r  r6  r7  r   r   r  r  r  r!  r  r   stringssetCFF2r   r   r#  r   cff2GetGlyphOrderFDArrayr   r  r$  r%  r   r&  setupCFF2Regions)r   r(  fdArrayListregionsr  r  r  r  r  r  r6  r7  r*  r;  r%  r-  r.  r)  fontDictr$  r+  r,  r/  r0  r1  r   r2  s                              r   	setupCFF2FontBuilder.setupCFF24  s   		
 		
 		
 ::~ &		, II33+D2CTJ&()$K.)&KzHT"!mG)//1
Ue, 2&HNN8$ ' )$5!!DIIf%000#Q5!Q7!*$$!$k7HgV%4%:%:%<!Iz!(J%0J"%/K	" &= *##G,$V,		& '		&!!'* r   c           	          SSK JnJnJn  SSKJn  SU R                  ;   d   S5       eSU R                  ;   d   S5       eU R                  S   R                   Vs/ s H  ofR                  PM     nnU" X5      nU" [        [        [        U5      5      5      S SS	9n	U" X/5      n
U" U
S
9nU R                  S   R                  R                  S   nXl        UR                   H  nXR                   l        M     g s  snf )Nr   )buildVarRegionListbuildVarDatabuildVarStore)VarStoreDatafvarzfvar must to be set up firstr8  zCFF2 must to be set up firstF)optimize)
otVarStorer   )varLib.builderrD  rE  rF  r  rG  r   axesaxisTaglistrangelenr&  r  VarStorer<  r#  vstore)r   r?  rD  rE  rF  rG  aaxisTagsvarRegionListvarDatavarStorerR  r/  r@  s                 r   r=  FontBuilder.setupCFF2Regionsq  s    SS("B$BB""B$BB"'+yy'8'='=>'=!II'=>*7=tE#g,$78$O 	:2))F#''44Q7!H&,# ( ?s   C;c                 f   U R                   (       d   eU(       ay  U R                  S   R                  S:X  a\  UR                  5        HH  u  pEUR                  S:  d  M  [        S UR                   5       5      (       d  M:  [        SU< S35      e   [        S5      U R                  S'   [        S5      U R                  S'   XR                  S   l	        [        U R                  S5      (       a(  U R                  R                  U R                  S   l        U(       a  U R                  5         g	g	)
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.

If `validateGlyphFormat` is True, raise ValueError if any of the glyphs contains
cubic curves or is a variable composite but head.glyphDataFormat=0.
Set it to False to skip the check if you know in advance all the glyphs are
compatible with the specified glyphDataFormat.
r   r   c              3   2   #    U  H  o[         -  v   M     g 7fr   r   )r   fs     r   r   (FontBuilder.setupGlyf.<locals>.<genexpr>  s     1QAi-s   zGlyph zt has cubic Bezier outlines, but glyphDataFormat=0; either convert to quadratics with cu2qu or set glyphDataFormat=1.locar   r   N)r   r   r   r   numberOfContoursanyr   r   r   glyphshasattrr   calcGlyphBounds)r   r`  rb  validateGlyphFormatr   gs         r   	setupGlyfFontBuilder.setupGlyf  s     zzz499V#4#D#D#I!<<>%%)c1Q1Q.Q.Q$  )\ \  * %V,		&$V,		&#)		& 499l+++/99+?+?DIIf(  " r   c                 0    [        U R                  X5        g)a7  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   rL  	instancess      r   	setupFvarFontBuilder.setupFvar  s    * 			4+r   c                    SSK Jn  SU R                  ;  a  [        S5      eU R                  S   R                   Vs/ s H  oDR
                  PM     nn[        [        U5      5      nU" U R                  XU5        gs  snf )zAdds an axis variations table to the font.

Args:
    axes (list): A list of py:class:`.designspaceLib.AxisDescriptor` objects.
r   )	_add_avarrH  z*'fvar' table is missing; can't add 'avar'.N)varLibrm  r   KeyErrorrL  rM  r   	enumerate)r   rL  mappingsrm  axisrT  s         r   	setupAvarFontBuilder.setupAvar  sj     	&"GHH-1YYv->-C-CD-CTLL-CD9T?+$))TX6 Es   A=c                 ^    [        S5      =o R                  S'   SUl        SUl        Xl        g )Ngvarr   r   )r   r   rU   reserved
variations)r   rx  rv  s      r   	setupGvarFontBuilder.setupGvar  s+    #+F#33yy $r   c                     U R                   S   nUR                  R                  5        H  nUR                  U5        M     g)zvCalculate the bounding boxes of all glyphs in the `glyf` table.
This is usually not called explicitly by client code.
r   N)r   r`  r   recalcBounds)r   
glyphTableglyphs      r   rb  FontBuilder.calcGlyphBounds  s9     YYv&
&&--/Ez* 0r   c                 (    U R                  SU5        g)zCreate a new `hmtx` table, for horizontal metrics.

The `metrics` argument must be a dict, mapping glyph names to
`(width, leftSidebearing)` tuples.
r
  NsetupMetricsr   metricss     r   setupHorizontalMetrics"FontBuilder.setupHorizontalMetrics       	&'*r   c                 (    U R                  SU5        g)zCreate a new `vmtx` table, for horizontal metrics.

The `metrics` argument must be a dict, mapping glyph names to
`(height, topSidebearing)` tuples.
vmtxNr  r  s     r   setupVerticalMetrics FontBuilder.setupVerticalMetrics  r  r   c                     US;   d   e[        U5      =o0R                  U'   0 nU H3  nX%   u  pg[        [        U5      5      [        [        U5      5      4XE'   M5     XCl        g)z<See `setupHorizontalMetrics()` and `setupVerticalMetrics()`.)r
  r  N)r   r   r   roundr  )r   r   r  mtxTableroundedMetricsgnwlsbs           r   r  FontBuilder.setupMetrics  sd    ++++)1();;99X&B[FA!$U1XE#J!?N  *r   c                 2    U R                  S[        U5        g)zkCreate a new `hhea` table initialize it with default values,
which can be overridden by keyword arguments.
hheaN)r   _hheaDefaultsr   s     r   setupHorizontalHeader!FontBuilder.setupHorizontalHeader  r   r   c                 2    U R                  S[        U5        g)zkCreate a new `vhea` table initialize it with default values,
which can be overridden by keyword arguments.
vheaN)r   _vheaDefaultsr   s     r   setupVerticalHeaderFontBuilder.setupVerticalHeader  r   r   c           	        ^ Uc;  0 mU H!  nX   nUT;  a  STU'   M  TU==   S-  ss'   M#     [        TU4S jSS9S   nU R                  S0 [        0 US95        U R                  S   nSUl        SUl        U H	  nX   XS'   M     g)	a1  Create 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.
Nr   c                    > TU    $ r   r   )vorgbags    r   <lambda>2FontBuilder.setupVerticalOrigins.<locals>.<lambda>  s	    c$ir   T)r+  reverser   VORG)VOriginRecordsdefaultVertOriginY)sortedr   r   r   majorVersionminorVersion)r   verticalOriginsdefaultVerticalOriginr  r  	vorgTabler  s         @r   setupVerticalOrigins FontBuilder.setupVerticalOrigins  s     !(C%&*s? !CIINI & %+/%%! 	!!7LM	

 IIf%	!"	!"	!B+/IM "r   c                     SU R                   ;   nU R                  S[        U5      nU R                  (       d  U(       a  U(       a  SUl        / Ul        0 Ul        gSUl        g)zoCreate a new `post` table and initialize it with default values,
which can be overridden by keyword arguments.
r8  postg       @r/   N)r   r   _postDefaultsr   r0   
extraNamesmapping)r   keepGlyphNamesr   isCFF2	postTables        r   	setupPostFontBuilder.setupPost  sQ     499$--fmVL	JJ&n#&I #%I  "I#&I r   c                 f    U R                   (       a  [        nO[        nU R                  SU0 5        g)zuCreate 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   s     r   r   FontBuilder.setupMaxp'  s'     ::'H'H!!&(B7r   c                 B    [        SSS/ S9nU R                  S0 U5        g)ztThis adds an empty DSIG table to the font to make some MS applications
happy. This does not properly sign the font.
r   r   )	ulVersionusFlag	usNumSigssignatureRecordsDSIGN)r   r   r   s     r   setupDummyDSIGFontBuilder.setupDummyDSIG1  s.     	
 	!!&"f5r   c                 4    SSK Jn  U" U R                  XX4S9  g)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.

The optional `debug` argument controls whether to add source debugging
information to the font in the `Debg` table.
r   )addOpenTypeFeaturesFromString)filenamer   debugN)feaLib.builderr  r   )r   featuresr  r   r  r  s         r   addOpenTypeFeaturesFontBuilder.addOpenTypeFeatures=  s     	B%IIx6	
r   c                 z    SSK Jn  SU R                  ;  a  [        S5      eUR	                  U R                  XS9  g)zlAdd conditional substitutions to a Variable Font.

See `fontTools.varLib.featureVars.addFeatureVariations`.
r   )featureVarsrH  z5'fvar' table is missing; can't add FeatureVariations.)
featureTagN)rn  r  r   ro  addFeatureVariations)r   conditionalSubstitutionsr  r  s       r   r   FontBuilder.addFeatureVariationsQ  s<    
 	("RSS((II/ 	) 	
r   c           
      v    SSK Jn  U R                  R                  5       nU" UUUUUUUS9U R                  S'   g)zaBuild new COLR table using color layers dictionary.

Cf. `fontTools.colorLib.builder.buildCOLR`.
r   )	buildCOLR)rU   glyphMaprW  varIndexMap	clipBoxesallowLayerReuseCOLRN)fontTools.colorLib.builderr  r   getReverseGlyphMap)	r   colorLayersrU   rW  r  r  r  r  r  s	            r   	setupCOLRFontBuilder.setupCOLR_  sA     	999//1%#+
		&r   c           	      p    SSK Jn  U" UUUUU R                  R                  S5      S9U R                  S'   g)zBuild 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  s         r   	setupCPALFontBuilder.setupCPALy  s6     	9%%'1iimmF+
		&r   c                     SSK Jn  SU R                  ;   d   S5       eU" U R                  UUU[        S U R                  S   R                   5       5      S9  g)zjBuild a new 'STAT' table.

See `fontTools.otlLib.builder.buildStatTable` for details about
the arguments.
r   )buildStatTabler   zname must to be set up firstc              3   >   #    U  H  oR                   S :H  v   M     g7fr   N
platformIDr   nrs     r   r   (FontBuilder.setupStat.<locals>.<genexpr>  s     N6M!+6M   )macNamesN)otlLib.builderr  r   r_  r   )r   rL  	locationselidedFallbackNamer  s        r   	setupStatFontBuilder.setupStat  sT     	3"B$BB"IINdii6G6M6MNN	
r   )r   r   )NNTr   )NF)TT)NNr   )T)NNF)rvrn)NNNNT)NNN)Nr   )%__name__
__module____qualname____firstlineno__r   r   r   r   r   r   r   r   r  r  r3  rA  r=  re  rj  rs  ry  rb  r  r  r  r  r  r  r  r   r  r  r  r  r  r  __static_attributes__r   r   r   r   r   8  s    %(N!
A4,4-l1f=*1(f;+z- #@,.7%+++*AA0>'8
6
(
" 
: 
0
r   c                 V    [         U   " U5      nXl        X$l        X4l        SUl        U$ )Nr   )r   r   r  	platEncIDlanguage)r   r   r  r  subTables        r   r   r     s/    F#F+HM$"HOr   c                 `   SSK JnJn  U(       d   e[        S5      nU S   n[	        S [        USS5       5       5      nSnU(       a  S	U-   nU H  n	U" 5       n
[        U	[        5      (       a  U	u  U
l        U
l	        U
l
        U
l        nOkU	R                  U	R                  U	R                  U	R                  U	R                   4u  U
l        U
l	        U
l
        U
l        nU	R"                  (       a  SU
l        [        U[&        5      (       a	  [)        US
9nUR+                  XUS9U
l        UR.                  R1                  U
5        M     U H  n[        U[(        5      (       a  US   nUS   nUR3                  S5      nO7UR4                  nUR6                  =(       d    UR8                  nUR:                  n[        U[&        5      (       a	  [)        US
9nU" 5       nUR+                  XUS9Ul        Ub  UR?                  XS9Ul         Xl!        URD                  R1                  U5        M     XPS'   g )Nr   )AxisNamedInstancerH  r   c              3   >   #    U  H  oR                   S :H  v   M     g7fr  r  r  s     r   r   addFvar.<locals>.<genexpr>  s     P0O"==A%0Or  r   r   ))r   r   i	  ))r   r   r   r   )r   r   location	stylenamepostscriptfontname)	platforms)#ttLib.tables._f_v_a_rr  r  r   r_  getattrr   tuplerM  minValuedefaultValuemaxValuetagminimumdefaultmaximumr   hiddenr   r  r   r  
axisNameIDrL  r   r   r	  localisedStyleNamerQ   postScriptFontNamesubfamilyNameIDaddNamepostscriptNameIDcoordinatesri  )r   rL  ri  r  r  rH  r  r  r  axis_defrr  r   instancer  psnameinsts                   r   rh  rh    s   :K4FDVI P	7B0OPPH !I 9,	vh&& !       UQT\4=$*;T]D #
dC  4=D#77x7X		5 8 h%%":.KK(D\\"67F"++K..D(2D2DD00FdC  4=D(<<8  =  
 $-$5$5f$5$RD!&d#) , Lr   r   )__all__ttLibr   r   ttLib.tables._c_m_a_pr   ttLib.tables._g_l_y_fr   ttLib.tables.O_S_2f_2r	   misc.timeToolsr
   r   collectionsr   r   r   r  r  r  r  r  r   _panoseDefaultsr  objectr   r   rh  r   r   r   <module>r,     sw  /B $ / , ) (  #    	
     
 
 
 
     !" #(  "  
 
    	
             !" #(    	
             !" #(    	
           " #$ %& '( )* !+, -. /0 12 34 $&5@ ( ((( ( 	(
 ( ( ( ( ( ( ( ( ( ( (  !(" #($ %(& '(( )(* +(, -(. /(0 1(2 3(4 5(6 7(8 9(: ;(< =(> ?(@ A(B C(D E(F G(H I(J K(L M(N O(Vi	
& i	
XCr   