L idZddlmZddlmZmZmZddlZddl m Z m Z m Z m Z ddlmZmZmZddlmZd dZdd Zdd Zdd Z dd Zy)zFExtra methods for DesignSpaceDocument to generate its STAT table data.) annotations)DictListUnionN)AxisLabelDescriptorDesignSpaceDocumentDesignSpaceDocumentErrorLocationLabelDescriptor)RegiongetVFUserRegionlocationInRegion)TTFontc|jD]}|j|k(sntd|t||}t dt |j dddD}tjjj|t||t|||j|j|Sd|S)aBuild the STAT table for the variable font identified by its name in the given document. Knowing which variable we're building STAT data for is needed to subset the STAT locations to only include what the variable font actually ships. .. versionadded:: 5.0 .. seealso:: - :func:`getStatAxes()` - :func:`getStatLocations()` - :func:`fontTools.otlLib.builder.buildStatTable()` z&Cannot find the variable font by name c3:K|]}|jdk(yw)N) platformID).0nrs [/mnt/ssd/data/python-lab/Trading/venv/lib/python3.12/site-packages/fontTools/varLib/stat.py z#buildVFStatTable..,s! snamenames)macNames)getVariableFontsrr r anygetattrget fontToolsotlLibbuilderbuildStatTable getStatAxesgetStatLocationselidedFallbackName)ttFontdocvfNamevfregionrs rbuildVFStatTabler,s""$  77f   '4VH =  S" %F%,VZZ-?"%MH    # # 2 2C f%"%"8"8"D 3 KL 3 c2td|jDd}g}|jD]@}|j|j|j+|dz }|j|Bt |j|Dcgc]y\}}t |j d|ji|j||jDcgc]/}t|j|ji|r t|1c}{c}}}Scc}wcc}}}w)zReturn a list of axis dicts suitable for use as the ``axes`` argument to :func:`fontTools.otlLib.builder.buildStatTable()`. .. versionadded:: 5.0 c3NK|]}|j|jyw)N) axisOrdering)raxiss rrzgetStatAxes..Bs!Qt43D3D3P  Qs%%)defaultren)tagrorderingvalues) maxaxesr0appendzipdictr5r labelNames axisLabelsr userValue_axisLabelToStatLocation)r( userRegion maxOrdering axisOrderingsr1r6labels rr$r$9sQsxxQKM.    (  !2!2 3 1 K   - .""#((M:   D(  5T__5"__#TYY$@*M)/     s AD 4D > D Dc|jDcic]}|j|}}|jDcgc]}t|j ||rmt d|ji|j |j |jDcic]\}}||j|c}}t|c}}}Scc}wcc}}wcc}}}w)zReturn a list of location dicts suitable for use as the ``locations`` argument to :func:`fontTools.otlLib.builder.buildStatTable()`. .. versionadded:: 5.0 r4)rlocationflags) r9rlocationLabelsr getFullUserLocationr<r=itemsr5 _labelToFlags)r(rAr1 axesByNamerDrvalues rr%r%[s /2hh7d$))T/7J7''    E55c:J G  7e&6&67 $)#<#risUL"$$ UT"$ND.; ; ;r-