+
    if:                         R t ^ RIHt ^ RIHt ^ RIHt ^ RIt ! R R]4      t^t	R t
]R 4       tR	 tR
 tR tR tR tRR ltR tR tRR ltR# )z-Helpers for instantiating name table records.)contextmanager)deepcopy)IntEnumNc                   :    ] tR t^	t^t^t^t^t^t^t	^t
^t^tRtR# )NameID N)__name__
__module____qualname____firstlineno__FAMILY_NAMESUBFAMILY_NAMEUNIQUE_FONT_IDENTIFIERFULL_FONT_NAMEVERSION_STRINGPOSTSCRIPT_NAMETYPOGRAPHIC_FAMILY_NAMETYPOGRAPHIC_SUBFAMILY_NAME!VARIATIONS_POSTSCRIPT_NAME_PREFIX__static_attributes__r       ڀ/Users/tonyclaw/.openclaw/workspace/skills/math-calculator/venv/lib/python3.14/site-packages/fontTools/varLib/instancer/names.pyr   r   	   s3    KNNNO !#(*%r   r   c                     . pR V 9   d   V R ,          pVP                    F  pVP                  VP                  4       K   	  VP                   FL  pVP                  VP                  4       VP
                  R8w  g   K1  VP                  VP
                  4       KN  	  RV 9   d   V R,          P                  pVP                  '       d   VP                  P                  MR F  pVP                  VP                  4       K   	  VP                  '       d   VP                  P                  MR F  pVP                  VP                  4       K   	  \        VRR4      pVe   VP                  V4       V Uu0 uF  q^8  g   K  VkK  	  up# u upi )fvar  STATElidedFallbackNameIDNr   )axesappend
axisNameID	instancessubfamilyNameIDpostscriptNameIDtableDesignAxisRecordAxis
AxisNameIDAxisValueArray	AxisValueValueNameIDgetattr)	varfontusedr   axisinstancestatvalueelidedFallbackNameIDnameIDs	   &        r   getVariationNameIDsr3      s@   DvIIDKK( HKK001((F2H556 ' v$$262G2G2GD))..RODKK( P6:6I6I6IT((22rQEKK))* R&t-CTJ+KK,-!%6v#FF666s   5FFc              #     "   ^RI Hp \        V 4      pRx  VP                  R4       V\        V 4      ,
          pV R,          P                   Uu. uF  qDP
                  V9  g   K  VNK  	  upV R,          P                  R&   RV 9   dd   \        ;QJ d-    R V R,          P                   4       F  '       g   K   RM"	  R	M! R V R,          P                   4       4      '       g   V R R# R# R# u upi 5i)
   )logNzPruning name tablename:NNNltagc              3   r   "   T F-  pVP                   ^ 8X  g   K  VP                  R8w  g   K)  Vx  K/  	  R# 5i)    r   N)
platformIDlangID).0records   & r   	<genexpr>%pruningUnusedNames.<locals>.<genexpr>A   s8      
/  A% *0--6*A F/s   77
7TF) r6   r3   infonamesr2   any)r+   r6   origNameIDsexcluder>   s   &    r   pruningUnusedNamesrG   /   s     %g.K	HH!"/88G$V_22 26mm76R2 GFO! 
 s 
!&///
sss 
!&///
 
 

 
  s*   AC5C0'C0-(C5"C5;+C5'C5c                   ^RI HpHp RV 9  d   \        R4      hV R,          P                  pVP
                  '       g   \        R4      hV R,          pV! V4      P                  V 4      pVP                  4       pVP                   Uu/ uF  qwP                  VP                  bK  	  ppV! / VCVC4      p	\        ;QJ d*    R V	P                  4        4       F  '       d   K   RM	  RM! R V	P                  4        4       4      '       g   Q hV! WI4      p
\        WJV	P                  4       4       V
 Uu. uF#  qP                  \         ,          '       d   K!  VNK%  	  p
p\#        V
4      p
\%        W
4       R	# u upi u upi )
a  Update instatiated variable font's name table using STAT AxisValues.

Raises ValueError if the STAT table is missing or an Axis Value table is
missing for requested axis locations.

First, collect all STAT AxisValues that match the new default axis locations
(excluding "elided" ones); concatenate the strings in design axis order,
while giving priority to "synthetic" values (Format 4), to form the
typographic subfamily name associated with the new default instance.
Finally, update all related records in the name table, making sure that
legacy family/sub-family names conform to the the R/I/B/BI (Regular, Italic,
Bold, Bold Italic) naming model.

Example: Updating a partial variable font:
| >>> ttFont = TTFont("OpenSans[wdth,wght].ttf")
| >>> updateNameTable(ttFont, {"wght": (400, 900), "wdth": 75})

The name table records will be updated in the following manner:
NameID 1 familyName: "Open Sans" --> "Open Sans Condensed"
NameID 2 subFamilyName: "Regular" --> "Regular"
NameID 3 Unique font identifier: "3.000;GOOG;OpenSans-Regular" -->         "3.000;GOOG;OpenSans-Condensed"
NameID 4 Full font name: "Open Sans Regular" --> "Open Sans Condensed"
NameID 6 PostScript name: "OpenSans-Regular" --> "OpenSans-Condensed"
NameID 16 Typographic Family name: None --> "Open Sans"
NameID 17 Typographic Subfamily name: None --> "Condensed"

References:
https://docs.microsoft.com/en-us/typography/opentype/spec/stat
https://docs.microsoft.com/en-us/typography/opentype/spec/name#name-ids
)
AxisLimitsaxisValuesFromAxisLimitsr   z6Cannot update name table since there is no STAT table.z<Cannot update name table since there are no STAT Axis Valuesr   c              3   R   "   T F  qP                   VP                  8H  x  K  	  R # 5iN)minimummaximum)r=   vs   & r   r?   "updateNameTable.<locals>.<genexpr>y   s     J/I!yyAII%/Is   %'FTN)rA   rI   rJ   
ValueErrorr#   r'   limitAxesAndPopulateDefaultsdefaultLocationr   axisTagdefaultValueallvaluescheckAxisValuesExistpinnedLocationFlagsELIDABLE_AXIS_VALUE_NAME_sortAxisValues_updateNameRecords)r+   
axisLimitsrI   rJ   r/   r   partialDefaultsafvarDefaultsdefaultAxisCoordsaxisValueTablesrO   s   &&          r   updateNameTablerd   I   sO   @ 7WQRR6?  DWXX6?D
 J'DDWMJ 002O7;yyAy!IIq~~-yLA"#Fl#Fo#FG3J/@/G/G/IJ333J/@/G/G/IJJJJJ.tGO0A0P0P0RS #"a''4L*L*L?   &o6Ow0 Bs   	E74E<E<c                 T  a \        4       pV P                  P                  p\        4       pV P                  P                   F  pVP
                  R9   d.   VP                  WFP                  ,          P                  4       KA  VP
                  ^8X  g   KT  VP                   F.  pVP                  WGP                  ,          P                  4       K0  	  K  	  V F  pVP
                  p	VP
                  R9   di   WHP                  ,          P                  p
V	^8X  d   VP                  pMVP                  pV
S9   d$   VSV
,          8X  d   VP                  V
4       K  K  K  VP
                  ^8X  g   K  VP                   FS  pWGP                  ,          P                  p
V
S9   g   K(  VP                  SV
,          8X  g   KB  VP                  V
4       KU  	  EK  	  \        S4      V,
          V,          pV'       d+   RP                  V3R lV 4       4      p\        RV R24      hR# )r5   z, c              3   B   <"   T F  pR V RSV,           2x  K  	  R# 5i)'z': Nr   )r=   i
axisCoordss   & r   r?   'checkAxisValuesExist.<locals>.<genexpr>   s"     K{!as#jm_5{s   zCannot find Axis Values {}N)r5         )setr$   r%   r'   r(   Formatadd	AxisIndexAxisTagAxisValueRecordNominalValueValuejoinrQ   )r/   
axisValuesri   seen
designAxes	hasValuesr0   recaxisValueTableaxisValueFormatrT   	axisValuemissingAxesmissings   &&f           r   rX   rX      s   5D&&++JI$$..<<9$MM*__5==>\\Q,,j7??@ -	 / %(//  I- !9!9:BBG!#*77	*00	*$j6I)I! *J$""a'%55$]]3;;j(SYY*W:M-MHHW% 6 %  z?T)Y6K))K{KK5gYbABB r   c                    . p\        4       p\        V  Uu. uF  q3P                  ^8X  g   K  VNK  	  upR RR7      pV FT  p\        R VP                   4       4      p\	        V4      pW&,          '       d   K:  W&,          pVP                  Wu34       KV  	  V  FB  pWT9   d   K  VP                  pW9  g   K  VP                  V4       VP                  W34       KD  	  \        V4       U	U
u. uF  w  rV
NK	  	  up
p	# u upi u up
p	i )   c                 ,    \        V P                  4      # rL   )lenrs   )rO   s   &r   <lambda>!_sortAxisValues.<locals>.<lambda>   s    c!++,r   T)keyreversec              3   8   "   T F  qP                   x  K  	  R # 5irL   )rq   r=   rs   & r   r?   "_sortAxisValues.<locals>.<genexpr>   s     C/B!++/Bs   )rn   sortedro   rs   minr   rq   rp   )rw   resultsseenAxesrO   format4valaxisIndexesminIndex	axisIndex_r~   s   &          r   r\   r\      s     GuH0Jq((a-J0,G Cs/B/BCC{#%%#HNNH?+  >MM	$LL#NNI+,  +1/:/,!I/::) 	1( ;s   C?C?.Dc                   aa V R ,          pV R,          P                   pV Uu. uF  qDP                  NK  	  ppV Uu. uF  p\        W&4      '       g   K  VNK  	  ppV Uu. uF  qfV9  g   K  VNK  	  ppVP                  p	\        W)4      p
VP                  o\        R VP                   4       4      pV EF  o\        ;QJ d#    VV3R l^^V	3 4       F  '       d   K   RM	  RM! VV3R l^^V	3 4       4      '       g   KN  RP                  VV3R lV 4       4      pV'       d   RP                  VV3R lV 4       4      pMR	pV'       gB   V'       g:   V
'       d   S! V	.SO5!  P                  4       pMS! V	.SO5!  P                  4       pRP                  VV3R
 lV 4       4      p\        V VVV.SO5!   EK	  	  R	# u upi u upi u upi )r7   r   c              3   f   "   T F'  qP                   VP                  VP                  3x  K)  	  R # 5irL   )r;   	platEncIDr<   r   s   & r   r?   %_updateNameRecords.<locals>.<genexpr>   s!     S?a\\1;;9?s   /1c              3   8   <"   T F  pS! V.SO5!  x  K  	  R # 5irL   r   )r=   rh   getNameplatforms   & r   r?   r      s      G2FQ71(x((2Fs   FT c              3   T   <"   T F  pS! V.SO5!  P                  4       x  K  	  R # 5irL   	toUnicoder=   nr   r   s   & r   r?   r      s*      !
7C!GA!!++--|   %(c              3   T   <"   T F  pS! V.SO5!  P                  4       x  K  	  R # 5irL   r   r   s   & r   r?   r      s+      );Ka%H%//11;Kr   Nc              3   T   <"   T F  pS! V.SO5!  P                  4       x  K  	  R # 5irL   r   r   s   & r   r?   r      s*      $
7F!GA!!++--r   )r#   r)   _isRibbir   r   rn   rC   rV   rv   r   _updateNameTableStyleRecords)r+   rw   	nametabler/   r`   axisValueNameIDsr   ribbiNameIDsnonRibbiNameIDselidedNameIDelidedNameIsRibbi	platformssubFamilyNametypoSubFamilyNamefamilyNameSuffixr   r   s   &&             @@r   r]   r]      s   I6?  D/9:z!z:/J/!8I3IAA/LJ"2L"2Q|6Kqq"2OL,,L 9GS9??SSIsG1a2FGsssG1a2FGGG  !
7C!
 
  # );K) ! !% !  ' @x @ J J L$+L$D8$D$N$N$P!88 $
7F$
 
 	%		

 	
9  ;JLs   GG	G	!G.Gc                 d    V P                  V^^R4      pVe   VP                  4       R9   d   R# R# )rm   	  TF)RegularItalicBoldzBold Italic)r   r   )r   r2   englishRecords   && r   r   r      sF    %%faE:M $##%)UU 	 	r   c                    V R ,          pWEV3pVP                   ! \        P                  .VO5!  ;'       g#    VP                   ! \        P                  .VO5!  p	VP                   ! \        P                  .VO5!  ;'       g#    VP                   ! \        P
                  .VO5!  p
\        W.4      '       g   \        RV 24      hV	P                  4       p	V
P                  4       p
\        P                  T	\        P
                  T;'       g    R/pV'       dL   V	 RV 2P                  4       V\        P                  &   W\        P                  &   W;\        P                  &   M9\        P                  \        P                  3 F  pVP                  VR7       K  	  VP                  \        P                  4      ;'       g    V\        P                  ,          pVP                  \        P                  4      ;'       g    V\        P
                  ,          pV RV 2V\        P                  &   \        WW4      V\        P                  &   \        WV4      pV'       d   W\        P                   &   VP#                  4        F*  w  ppV'       g   Q V4       hVP$                  ! VV.VO5!   K,  	  RV 9  d"   VP                  \        P&                  4       R# R# )r7   z.Missing required NameIDs 1 and 2 for platform r   r   )r2   r   N)r   r   r   r   r   r   rV   rQ   r   stripremoveNamesgetr   _updatePSNameRecordr   _updateUniqueIdNameRecordr   itemssetNamer   )r+   r   r   r   r;   r   r<   r   r   currentFamilyNamecurrentStyleNamenameIDsr2   newFamilyNamenewStyleNameuniqueIDstrings   &&&&&&&          r   r   r     s    Iv.H!))&&)1 : :			6--	9	9  !(()),4 = =			600	<8	<  !455I(TUU)335'113 	-}99	G ):(;1=M<N&O&U&U&W""#2C../5F112
 **--
F !!!0	
 	F223RRwv?Q?Q7R  	F556XX'&BWBW:X  )6a~%FGF!!"&9'GF""# )8DH19--.!--/vv&&484 * WfFFG r   c                    V R ,          pVP                   ! \        P                  .VO5!  pV'       d   VP                  4       pMTpV RV 2p\        P
                  ! RRV4      p\        V4      ^8  d   VR,           R2# V# )r7   -z[^A-Za-z0-9-]rA   :N|   Nz...)r   r   r   r   resubr   )r+   
familyName	styleNamer   r   family_prefixpsNames   &&&&   r   r   r   J  s     I%%003;M %//1"a	{+F VV$c62F
6{S ,s##Mr   c                    V R ,          pVP                   ! \        P                  .VO5!  pV'       g   R# \        P                  \        P                  3 F  pVP                   ! V.VO5!  pV'       g   K!  VP                  4       VP                  4       9   g   KF  VP                  4       P                  VP                  4       WP                  ,          4      u # 	  \        W4      pV R,          P                  p\        P                  ! RRV4      P                  4       p	V\        P                  ,          p
V RV	 RV
 2# )r7   NzOS/2z[^\x00-\x7F]rA   ;)r   r   r   r   r   r   replacer2   _fontVersion	achVendIDr   r   r   )r+   r   r   r   currentRecordr2   
nameRecordfontVersionr   vendorr   s   &&&        r   r   r   d  s   I%%f&C&COhOM ((&*@*@A&&v99
!]%<%<%>> **,44$$&0A0A(B  B w1K))IVVOR399;FV++,F]!F81VH--r   c                    V R ,          P                   ! \        P                  .VO5!  pVf   V R,          P                  R # VP	                  4       P                  R4      ^ ,          pVP                  R4      P                  4       # )r7   headz.3fr   zVersion )r   r   r   fontRevisionr   splitlstripr   )fontr   r   versionNumbers   &&  r   r   r   }  sv    f%%f&;&;GhGJv,++C01 ((*005a8M
+1133r   rm   r5   r   )r   )__doc__
contextlibr   copyr   enumr   r   r   r[   r3   rG   rd   rX   r\   r]   r   r   r   r   r   r   r   r   <module>r      sv    3 %   		+W 	+  7.    2:1zCB;D/
dBHJ4.24r   