
    h}C                        S r SSKJrJrJr  SSKJr  SSKJ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rSS	KrSS	KrSS	KrSS	Kr\R.                  " S
5      r\R2                  " S5      r " S S\5      rS r\" \S5      S 5       r\" \S5      S 5       rS r S r!S r"SS jr#\$S:X  a  \RJ                  " \#" 5       5        g	g	)a  usage: ttx [options] inputfile1 [... inputfileN]

TTX -- From OpenType To XML And Back

If an input file is a TrueType or OpenType font file, it will be
decompiled to a TTX file (an XML-based text format).
If an input file is a TTX file, it will be compiled to whatever
format the data is in, a TrueType or OpenType/CFF font file.
A special input value of - means read from the standard input.

Output files are created so they are unique: an existing file is
never overwritten.

General options
===============

-h Help            print this message.
--version          show version and exit.
-d <outputfolder>  Specify a directory where the output files are
                   to be created.
-o <outputfile>    Specify a file to write the output to. A special
                   value of - would use the standard output.
-f                 Overwrite existing output file(s), ie. don't append
                   numbers.
-v                 Verbose: more messages will be written to stdout
                   about what is being done.
-q                 Quiet: No messages will be written to stdout about
                   what is being done.
-a                 allow virtual glyphs ID's on compile or decompile.

Dump options
============

-l           List table info: instead of dumping to a TTX file, list
             some minimal info about each table.
-t <table>   Specify a table to dump. Multiple -t options
             are allowed. When no -t option is specified, all tables
             will be dumped.
-x <table>   Specify a table to exclude from the dump. Multiple
             -x options are allowed. -t and -x are mutually exclusive.
-s           Split tables: save the TTX data into separate TTX files per
             table and write one small TTX file that contains references
             to the individual table dumps. This file can be used as
             input to ttx, as long as the table files are in the
             same directory.
-g           Split glyf table: Save the glyf data into separate TTX files
             per glyph and write a small TTX for the glyf table which
             contains references to the individual TTGlyph elements.
             NOTE: specifying -g implies -s (no need for -s together
             with -g)
-i           Do NOT disassemble TT instructions: when this option is
             given, all TrueType programs (glyph programs, the font
             program and the pre-program) will be written to the TTX
             file as hex data instead of assembly. This saves some time
             and makes the TTX file smaller.
-z <format>  Specify a bitmap data export option for EBDT:
             {'raw', 'row', 'bitwise', 'extfile'} or for the CBDT:
             {'raw', 'extfile'} Each option does one of the following:

             -z raw
               export the bitmap data as a hex dump
             -z row
               export each row as hex data
             -z bitwise
               export each row as binary in an ASCII art style
             -z extfile
               export the data as external files with XML references

             If no export format is specified 'raw' format is used.
-e           Don't ignore decompilation errors, but show a full traceback
             and abort.
-y <number>  Select font number for TrueType Collection (.ttc/.otc),
             starting from 0.
--unicodedata <UnicodeData.txt>
             Use custom database file to write character names in the
             comments of the cmap TTX output.
--newline <value>
             Control how line endings are written in the XML file. It
             can be 'LF', 'CR', or 'CRLF'. If not specified, the
             default platform-specific line endings are used.

Compile options
===============

-m           Merge with TrueType-input-file: specify a TrueType or
             OpenType font file to be merged with the TTX file. This
             option is only valid when at most one TTX file is specified.
-b           Don't recalc glyph bounding boxes: use the values in the
             TTX file as-is.
--recalc-timestamp
             Set font 'modified' timestamp to current time.
             By default, the modification time of the TTX file will be
             used.
--no-recalc-timestamp
             Keep the original font 'modified' timestamp.
--flavor <type>
             Specify flavor of output font file. May be 'woff' or 'woff2'.
             Note that WOFF2 requires the Brotli Python extension,
             available at https://github.com/google/brotli
--with-zopfli
             Use Zopfli instead of Zlib to compress WOFF. The Python
             extension is available at https://pypi.python.org/pypi/zopfli
--optimize-font-speed
             Enable optimizations that prioritize speed over file size.
             This mainly affects how glyf t able and gvar / VARC tables are
             compiled. The produced fonts will be larger, but rendering
             performance will be improved with HarfBuzz and other text
             layout engines.
    )OPTIMIZE_FONT_SPEEDTTFont
TTLibError)getMacCreatorAndType)setUnicodeData)Tagtostr)timestampSinceEpoch)Timer)makeOutputFileNameNzfontTools.ttxzsfntVersion=['"]OTTO["']c                   f    \ rS rSrSrSrSrSrSrSr	Sr
SrSrSrSrSrSrSrSrSrSrSrSrS rSrg)	Options   FNTraw
c                    / U l         / U l        SU l        U GH  u  p4US:X  a'  [        [        5        [
        R                  " S5        M3  US:X  a)  SSKJn  [        U5        [
        R                  " S5        Mb  US:X  aB  [        R                  R                  U5      (       d  [        R                  " S5      eX@l        M  US:X  a  X@l        M  US	:X  a	  S
U l        M  US:X  a	  S
U l        M  US:X  a	  S
U l        M  US:X  a	  S
U l        M  US:X  a/  UR)                  S5      nU R                   R+                  U5        GM)  US:X  a/  UR)                  S5      nU R                  R+                  U5        GM^  US:X  a
  S
U l        GMn  US:X  a  S
U l        S
U l        GM  US:X  a
  SU l        GM  US:X  a.  SnXF;  a  [        R                  " SU< SU< 35      eX@l        GM  US:X  a  [5        U5      U l        GM  US:X  a	  X@l        GM  US:X  a
  SU l        GM  US:X  a
  SU l        GM  US:X  a	  X@l        GM   US:X  an  SnUS :X  a
  S!U l        GM8  US":X  a
  S#U l        GMH  US$:X  a
  S%U l        GMX  [        R                  " S&U< S'S(RA                  [C        [D        U5      5      < S)35      eUS*:X  a
  S
U l#        GM  US+:X  a
  SU l#        GM  US,:X  a	  X@l$        GM  US-:X  a
  S
U l%        GM  US.:X  d  GM  S
U l&        GM     U R"                  (       a'  U R$                  (       a  [        R                  " S/5      eU R"                  (       a  [N        RP                  U l)        O<U R$                  (       a  [N        RT                  U l)        O[N        RV                  U l)        U R6                  (       a'  U RH                  (       a  [        R                  " S05      eU R                   (       a'  U R                  (       a  [        R                  " S15      eU R6                  (       a  US2:  a  [        R                  " S35      eU RH                  S4:w  a(  U RJ                  (       a  [        R                  " S55      eg g )6Nz-hr   z	--version)versionz-dz1The -d option value must be an existing directoryz-oz-fTz-vz-qz-lz-t   z-xz-sz-gz-iFz-z)r   rowbitwiseextfilez-z does not allow z as a format. Use z-yz-mz-bz-ez--unicodedataz	--newline)LFCRCRLFr   r   r   r   z
zInvalid choice for --newline: z (choose from z, )z--recalc-timestampz--no-recalc-timestampz--flavorz--with-zopfliz--optimize-font-speedz(-q and -v options are mutually exclusivez.-m and --flavor options are mutually exclusivez(-t and -x options are mutually exclusive   z6Must specify exactly one TTX source file when using -mwoffz---with-zopfli option requires --flavor 'woff'),
onlyTables
skipTables
fontNumberprint__doc__sysexit	fontToolsr   ospathisdirgetoptGetoptError	outputDir
outputFile	overWriteverbosequiet
listTablesljustappendsplitTablessplitGlyphsdisassembleInstructionsbitmapGlyphDataFormatint	mergeFilerecalcBBoxesignoreDecompileErrorsunicodedata
newlinestrjoinmapreprrecalcTimestampflavor	useZopflioptimizeFontSpeedloggingDEBUGlogLevelWARNINGINFO)self
rawOptionsnumFilesoptionvaluer   validOptionss          ?/var/www/html/env/lib/python3.13/site-packages/fontTools/ttx.py__init__Options.__init__   sm   'MF~g;&-g4ww}}U++ ,,K  "'4"'4!%4#4!
4"&4A&&u-4A&&u-4#' 4#' #' 4/4,4C, ,,!<1  .3*4"%e*4!&4$)!4-2*?*#( ;&3D=&*DOd]&*DOf_&,DO ,, $))Cl,C"DF  //'+$22',$:%#?*!%22)-&i (j <<DJJ$$%OPP<<#MMDMZZ#OODM#LLDM>>dkk$$%UVV??t$$%OPP>>hl$$H  ;;& T^^$$%TUU &4     )r8   r7   rC   r"   r<   r2   rH   r:   r>   r    rE   r-   r.   r/   r1   r;   rB   r!   r6   r5   r=   rD   r0   )__name__
__module____qualname____firstlineno__r2   r-   r.   r/   r0   r1   r5   r6   r7   r:   r;   r<   r8   r=   r>   rB   rC   rD   rE   rR   __static_attributes__ rT   rQ   r   r      sl    JIJIGEKK"IL !KJOFIjVrT   r   c                 8   [        XR                  SS9nUR                  n[        UR	                  5       5      n[        SU -  5        Sn[        US-  5        [        US-  5        U H  nUR                  U   nUR                  S:X  a*  SS	KJ	n	  UR                  UR                  5      n
U	" U
5      nO[        UR                  5      nUS:  a  US
-   nSU-  n[        XgXR                  UR                  4-  5        M     [        5         UR!                  5         g )NT)r"   lazyzListing table info for "%s":z    %4s  %10s  %8s  %8s)ztag z
  checksumz  lengthz  offset)z----z
------------------r]   woff2r   )calcChecksuml        z0x%08X)r   r"   readersortedkeysr#   tablesrC   fontTools.ttLib.sfntr_   loadDatatransformBufferr9   checkSumlengthoffsetclose)inputoutputoptionsttfr`   tagsformattagentryr_   datarg   checksums                rQ   ttListru     s    
#5#5D
ACZZF&++- D	
(5
01&F	&A
AB	&A
ABc":: 9>>&"8"89D#D)H5>>*Ha<+-Hh&fX||U\\BBC  
GIIKrT   z&Done dumping TTX in %(time).3f secondsc                 l   U nU S:X  a3  [         R                  R                  [         R                  R                  p0UnUS:X  a)  [         R                  [         R                  R                  pA[
        R                  SX45        UR                  (       a  [        UR                  5        [        U SUR                  UR                  S9nUR                  UUR                  UR                  UR                  UR                   UR"                  UR$                  UR&                  S9  UR)                  5         g )N-zDumping "%s" to "%s"...r   )r<   r"   )rc   r!   r5   r6   r7   r8   r>   )r%   stdinbuffernamestdoutloginfor=   r   r   r<   r"   saveXMLr    r!   r5   r6   r7   r8   r>   rj   )rk   rl   rm   
input_nameoutput_namern   s         rQ   ttDumpr     s    J|II,,ciinnzK}!jj#**//HH&
@w**+
	%;;%%	C KK!!%%'''' ' ? ?%;;%%  	 IIKrT   z(Done compiling TTX in %(time).3f secondsc                    U nU S:X  a)  [         R                  [         R                  R                  p0UnUS:X  a3  [         R                  R                  [         R                  R                  pA[
        R                  SU< SU< S35        UR                  (       a  SSKJ	n  SUl
        [        UR                  UR                  UR                  UR                  S9nUR                   (       a  UR                   UR"                  [$        '   UR'                  U 5        UR                  cK  S	U;   aE  U [         R                  La2  [(        R*                  R-                  U 5      n[/        U5      US	   l        UR3                  U5        g )
Nrw   zCompiling "z" to "z"...r   )sfntT)rC   r;   rB   head)r%   rx   rz   r{   ry   r|   r}   rD   fontTools.ttLibr   
USE_ZOPFLIr   r:   rC   r;   rB   rE   cfgr   	importXMLr(   r)   getmtimer
   modifiedsave)rk   rl   rm   r   r   r   rn   mtimes           rQ   	ttCompiler   =  s   J|IIsyy~~zK}!jj//HHJ?@(
~~))//	C   '.'@'@#$MM%&6S=U#))=S  '259FHHVrT   c                 |   U S:X  a,  [         R                  R                  R                  S5      nSnOH[        R
                  R                  U 5      u  p2 [        U S5       nUR                  S5      nS S S 5        WR                  S5      (       a  UR                  S5      n[        U 5      u  pVUS;   a  gUS	:X  a  g[        US S
 5      nUS:X  a  gUS:X  a  gUS;   a  gUS:X  a  gUS:X  a  gUS:X  a(  [        US5      n[        R!                  U5      (       a  ggg ! , (       d  f       N= f! [         a     g f = f)Nrw       rbs   ﻿<?xmls   ﻿)r   FFILTTFz.dfontr   OTTOOTFttcfTTC)z   truewOFFWOFFwOF2WOFF2z<?xmlatin1OTXTTX)r%   rx   ry   peekr(   r)   splitextopenreadIOError
startswithlstripr   r   r	   opentypeheaderREsearch)fileNameheaderextbasefcrtpr   s           rQ   guessFileTyper   \  s/   3!!&&s+GG$$X.		h% &
 -../!(+FB	
hvbqz?Dv~		%	%			vx(""6**= &% 		s0   D. !D3D. 
D+'D. +D. .
D;:D;c                    [         R                  " U S/ SQ5      u  p[        U[        U5      5      n/ nU(       d  [         R                  " S5      eU GH  nUS:w  a=  [
        R                  R                  U5      (       d  [         R                  " SU-  5      e[        U5      nUS;   a!  SnUR                  (       a  [        nO~[        nOwUS:X  a)  UR                  (       a  S	UR                  -   OS
n[        nOHUS:X  a)  UR                  (       a  S	UR                  -   OSn[        nO[         R                  " SU-  5      eUR                  (       a  UR                  n	O`US:X  a  [         R                  " S5      e[        XSR                   XsR"                  5      n	U[        :w  a  [%        U	S5      R'                  5         UR)                  XU	45        GM     XC4$ )Nzld:o:fvqht:x:sgim:z:baey:)zunicodedata=zrecalc-timestampzno-recalc-timestampzflavor=r   zwith-zopfliznewline=zoptimize-font-speedz$Must specify at least one input filerw   zFile not found: "%s")r   r   r   r   r   z.ttxr   .z.ttfr   z.otfzUnknown file type: "%s"z'Must provide -o when reading from stdina)r+   
gnu_getoptr   lenr,   r(   r)   isfiler   r2   ru   r   rC   r   r.   r   r-   r/   r   rj   r4   )
argsrL   filesrm   jobsrk   r   	extensionactionrl   s
             rQ   parseOptionsr     s   ))#		
J j#e*-GD  !GHHC<u 5 5$$%;e%CDD5!77I!!5[07gnn,FIF5[07gnn,FIF$$%>%FGG''F|(()RSS'(()5F5FF VS!'')VF+,= > =rT   c                 .    U  H  u  p#nU" X4U5        M     g NrZ   )r   rm   r   rk   rl   s        rQ   processr     s    !%vug& "&rT   c                    SSK Jn  U c  [        R                  SS n  [	        U 5      u  p#U" WR                  S9   [        WU5        g! [
        R                   aC  n[        [        < SU< 3[        R                  S9  [        R                  " S5         SnANpSnAff = f! [         a.    [        R                  S	5        [        R                  " S5         g[          a    e ["         a5  n[        R                  U5        [        R                  " S5         SnAgSnAf  [        R%                  S
5        [        R                  " S5         g= f)z&Convert OpenType fonts to XML and backr   )configLoggerNr   z
ERROR: )file   )levelz(Cancelled.)z Unhandled exception has occurred)r'   r   r%   argvr   r+   r,   r#   r$   stderrr&   rH   r   KeyboardInterruptr|   error
SystemExitr   	exception)r   r   r   rm   es        rQ   mainr     s    &|xx|$T*
 w''(g  !,3::>  		.!  		!89s4   A	 B# 	B 9BB #5EE-+D0E__main__r   )&r$   r   r   r   r   fontTools.misc.macCreatorTyper   fontTools.unicoder   fontTools.misc.textToolsr   r	   fontTools.misc.timeToolsr
   fontTools.misc.loggingToolsr   fontTools.misc.cliToolsr   r(   r%   r+   rerF   	getLoggerr|   compiler   objectr   ru   r   r   r   r   r   r   rU   r&   rZ   rT   rQ   <module>r      s   m^ D C > , / 8 - 6 	 
  	  (::<= Vf VD4 s45 6: s67 8<%P5p'
: zHHTV rT   