
    3vjl                         d Z ddlZddlZddlmZ ddlmZ ddlZddlm	Z	 ddl
mZmZmZ ddlmZ dd	lmZ dd
lmZ ddlmZmZmZmZmZ ddlmZmZ  G d d      Zd Zd Zd Z y)zFonts integration in PDF.    N)md5)ceil)subset)TTFont
TTLibErrorttFont)instantiateVariableFont   )LOGGER)PANGO_STRETCH_PERCENT)
FROM_UNITSffiharfbuzzharfbuzz_subsetpango)get_hb_object_dataget_pango_font_hb_facec                   @    e Zd Zd Zd Zd Zed        Zd Zd Z	d Z
y)	Fontc           	         t        j                  |      | _        t        |      | _        t        | j                        | _        t        j                  | j                        | _	        || _
        t        j                  |      | _        t        j                  t        j                  |            j!                         | _        i | _        t        j&                  |      }|t        j(                  k7  rst        j                  |      j!                         j+                  d      D ci c]2  }|j+                  d      d   t-        |j+                  d      d         4 c}| _        | j$                  j/                  d      x}r't1        |      | _        t        j4                  ||       nt        j6                  |      | _        | j$                  j/                  d      r%t        j8                  |t         j:                         n?| j$                  j/                  d      r$t        j8                  |t         j<                         | j$                  j/                  d      x;t?        tA        jB                         fd	
      d   }t        jD                  ||       t        j                  t        jF                  |            }djI                  d tK        |d      jM                         d d D              | _'        tQ        j*                  d|      d   }	d| jN                  jS                         z   dz   |	jU                  dd      z   | _+        | j                  rt        jX                  |t        j(                        }
t1        t        jZ                  |
      t\        z  | j                  z  dz        | _/        t1        t        j`                  |
      t\        z  | j                  z  dz         | _1        ndx| _/        | _1        t        jd                  dd      }t        jd                  d      }t        jd                  d      }t        jf                  | j                  d||       g | _4        tk        |d         D ]W  }t        jl                  ||   |       | jh                  jo                  t        j                  |      j!                                Y d| _8        d| jh                  v rd| jh                  v rd| jh                  v rkt        jr                  dd      }t        jt                  | j                  |      }t        jv                  |      dk(  rd| _8        t        jx                  |       nd| _8        d| _=        t        j|                  | j                        | _?        t        j                  | j                        | _A        t        j                  | j                        | _C        t        j                  | j                        | _E        d | _F        d | _G        i | _H        i | _I        i | _J        d| _K        d!| _L        | j                  r| xj                  d"z  c_L        d#|	j+                  d      v r| xj                  d$z  c_L        y y c c}w )%N,=r      weightitalslntwdthc                 &    t        | d   z
        S )Nr   )abs)itemwidths    G/root/.hermes/venv/lib/python3.12/site-packages/weasyprint/pdf/fonts.py<lambda>zFont.__init__.<locals>.<lambda>3   s    T!Wu_!5     )key c              3   >   K   | ]  }t        d |dz  z           yw)A      N)chr.0letters     r"   	<genexpr>z Font.__init__.<locals>.<genexpr>9   s%      L&,CVb[ !Ls   F)usedforsecurity   s    [#@]   /   +       -  zunsigned int *d   zhb_tag_t[100]zchar[4]EBDTEBLCglyfs   glyfTP      @   s   Serifr
   )Mr   pango_font_get_hb_fonthb_fontr   hb_facer   file_contentr   hb_face_get_indexindex	font_size pango_font_description_get_stylestyler   string!pango_font_description_get_familydecodefamily
variations%pango_font_description_get_variationsNULLsplitfloatgetroundr   !pango_font_description_set_weight!pango_font_description_get_weight pango_font_description_set_stylePANGO_STYLE_ITALICPANGO_STYLE_OBLIQUEminr   items"pango_font_description_set_stretch pango_font_description_to_stringjoinr   digesthashreencodereplacenamepango_font_get_metricspango_font_metrics_get_ascentr   ascentpango_font_metrics_get_descentdescentnewhb_face_get_table_tagstablesrangehb_tag_to_stringappendbitmaphb_tag_from_stringhb_face_reference_tablehb_blob_get_lengthhb_blob_destroyitalic_anglehb_face_get_upemupemhb_ot_color_has_pngpnghb_ot_color_has_svgsvghb_face_get_glyph_countglyph_countstemvstemhwidths
to_unicodemissingused_in_formsflags)self
pango_fontdescriptionrD   rK   partr   stretchdescription_stringra   pango_metricstable_count
table_tags
table_nameitagblobr!   s                    @r"   __init__zFont.__init__   s,   33J?-j9.t||<//=
";;KH
jj33K@BBH&( 	 @@M
!  JJz299;AA#FH 

3"E$**S/!*<$==HDO __((2262-DK33KHAA+NDK??v&22U557__  (22U668__((00E=%++-5778:G 44['J ZZ22;?A GG L%u=DDFrJL L	
 xx"45a8499++--4t||D$7OO	 >>!88SXXNM33MBZO!%&'DK "44]CjP!%&' 'DL *+*DK$, gg.4WW_-
WWY'
''ajQ{1~& 	@A%%jmZ@KKszz*5<<>?	@ T[[ Vt{{%:$11'2>77cJ..t49"&DK((."--dll;	//=//=#;;DLLI

" "
::JJ,&Jtzz$''JJ,&J (]Hs   )7Z
c                     || j                   vr[| j                  t        | j                         z   }|dkD  r%t        j                  d| j
                   d       d}|| j                   |<   | j                   |   S )uJ   Get a glyph id that’s not used in the font, for given Unicode codepoint.i  zToo many glyphs missing from "z!", expect text selection problems)r   rz   lenr   warningrJ   )r   	codepointnext_unused_glyph_ids      r"   get_unused_glyph_idzFont.get_unused_glyph_ids   sw    DLL(#'#3#3c$,,6G#G #k14T[[M B5 56 (3$&:DLL#||I&&r$   c                    | j                  ||       d| j                  v rt        j                  | j                        }t        || j                        }|d   j                  D ci c]  }|j                  | }}d|v r'd| j                  vr| j                  | j                  d<   d|v r'd| j                  vr| j                  | j                  d<   d|v r_d| j                  vrQd}| j                  dk(  r1|d   j                  dk(  r|d   j                  }n|d   j                  }|| j                  d<   d|v r3d| j                  vr%t        | j                  d	k(        | j                  d<   t        j                         }	 t!        || j                  d
      }|j#                  |       |j%                         | _        | j0                  s| j2                  rtt        j                  | j                        }t        || j                        }	 d| j                  vsd| j                  vr t5        j6                  d             |d<    t5        j6                  d             |d<   |j9                         |d   _        |d   j:                  D 
ci c]&  }
|
t5        j<                  d      j?                         ( c}
|d   _         n=|d   j@                  D ]+  }t5        j<                  d      j?                         |d   |<   - dD ]
  }||v s||=  t        j                         }|j#                  |       |j%                         | _        yyc c}w # t&        $ rE}	t)        j*                  d| j,                   d       t)        j.                  d|	       Y d}	~	d}	~	ww xY wc c}
w # tB        $ rD}	t)        j*                  d| j,                   d       t)        j.                  d|	       Y d}	~	yd}	~	ww xY w)zRemove useless data from font.fvar
fontNumberwghtopszr   r   r   r   r
   T)staticzUnable to instantiate "z" variable fontOriginal exception:exc_infoNlocar9   )CBDTCBLCzSVG zUnable to save emoji font "")"r   ri   ioBytesIOrA   r   rC   axesaxisTagrK   r   rD   rF   maxValueminValueintr	   savegetvalue	Exceptionr   r   rJ   debugrv   rx   r   getTableClassgetGlyphOrder
glyphOrdergetTableModuleGlyphglyphsr   )r   r~   hinting	full_fontttfontaxisr   r   partial_font	exceptionra   glyphr   output_fonts                 r"   cleanz
Font.clean   ss    	J( T[[ 

4#4#45II$**=F39&>3F3FG4DLL$&GDG~&"?*.++'~&"?*...'~&"?::?F|,,1#F|44#F|44*.'~&"?*-djjAo*>'::<L<0QUVL)
 %1$9$9$;! 88txx

4#4#45II$**=FH,dkk0I%AV%9%9&%A%CF6N%AV%9%9&%A%CF6N060D0D0FF6N- %+6N$=$=-?  f33F;AACC-?F6N) "(!6!6 V060E0Ef0M0S0S0Uvu-V": /J!V+":./ !jjlK($/$8$8$:!)  5 H&  H!8_UV2YGGH -?  H!<T[[MKL2YGGHsP   )M)M A?N+ +N&<AN+ ?N+ 	N#:NN#&N+ +	O84:O33O8c                 .    | j                   d d dk(  rdS dS )Nr<   s   OTTOotfttf)rA   )r   s    r"   typez	Font.type   s!    ))"1-8uCeCr$   c                     |syt         r*t        j                  ddd      r| j                  ||       y| j	                  ||       y)z*Remove unused glyphs and tables from font.Nr<   r   r   )r   r   hb_version_atleast_harfbuzz_subset_fonttools_subset)r   r~   r   s      r"   r   zFont.subset   s<    x::1aC!!*g6"":w7r$   c                     t        j                  t        j                         t        j                        }t        j
                  |      }t        j                  dt        |       dt        |            }t        j                  ||t        |             t        j                  t        j                  z  t        j                  z  }| j                  r|t        j                  z  }t        j                   ||       t        j"                  |t        j$                        }t'        d dD              }t        j                  dt        |       d|      }	t        j                  ||	t        |             t        j                  t        j(                  | j*                  |      t        j,                        }
t        j
                  |      }t'        t/        t1        |      dz               }t        j                  dt        |       d|      }t        j                  ||t        |             t        j                  t        j                  z  }|s|t        j2                  z  }| j                  r|t        j                  z  }t        j                   ||       t        j                  t        j(                  |
|      t        j,                        }
|
rt5        |
      }|r|| _        yt9        j:                  d| j<                   d       y)	zSubset font using Harfbuzz.zhb_codepoint_t[]c              3   H   K   | ]  }t        j                  |d         yw)r:   N)r   rn   )r,   ra   s     r"   r.   z(Font._harfbuzz_subset.<locals>.<genexpr>   s!      (dH77bA (s    ")s   BASEs   DSIGs   EBDTs   EBLCs   EBSCs   GPOSs   GSUBs   JSTFs   LTSHs   PCLTs   SVG r   NUnable to subset "z" with HarfBuzz)r   gcr   hb_subset_input_create_or_failhb_subset_input_destroyhb_subset_input_glyph_setrg   r   sortedr   hb_set_add_sorted_arrayHB_SUBSET_FLAGS_RETAIN_GIDS(HB_SUBSET_FLAGS_PASSTHROUGH_UNRECOGNIZEDHB_SUBSET_FLAGS_DESUBROUTINIZEr   HB_SUBSET_FLAGS_NOTDEF_OUTLINEhb_subset_input_set_flagshb_subset_input_setHB_SUBSET_SETS_DROP_TABLE_TAGtuplehb_subset_or_failr@   hb_face_destroyrj   maxHB_SUBSET_FLAGS_NO_HINTINGr   rA   r   r   rJ   )r   r~   r   	hb_subsetgid_set	gid_arrayr   drop_setdrop_tablesdrop_tables_arrayr@   keeprA   s                r"   r   zFont._harfbuzz_subset   s|   FF::<335	
 ";;IFGGoc*o->a@&BTU	(()S_M 77DDE::; 	 <<_CCCE11)UC #66DDF ( O' ( (  GGoc+6F5Gq$I;W((3Dc+FVW &&--dllIF$$&
 ";;IFU3z?Q./0GGoc$i[:DA	(()SYG DD::; 	 _???E<<_CCCE11)UC &&--gyA$$&
 -g6L$0!+DKK=HIr$   c           
         t        j                  | j                        }t        j                  ddd|dt        | j                              }|xj                  g dz  c_        t        j                  |      }|j                  |       	 t        || j                        }|j                  |       t        j                         }|j                  |       |j                         | _        y
# t        $ rD}t        j                   d| j"                   d       t        j$                  d|	       Y d
}~y
d
}~ww xY w)zSubset font using Fonttools.T)retain_gidspassthrough_tablesignore_missing_glyphsr   desubroutinizenotdef_outline)GSUBGPOSSVG)gidsr   r   z" with fontToolsr   r   N)r   r   rA   r   Optionsboolr   r   	Subsetterpopulater   rC   r   r   r   r   r   rJ   r   )	r   r~   r   r   options	subsetterr   optimized_fontr   s	            r"   r   zFont._fonttools_subset  s   JJt001	 ..TDdllASU 	66$$W-	
+		:I$**=FV$
  ZZ\NKK' . 7 7 9D  	DNN/}<LMNLL.CC	Ds   (C0 0	D=9:D88D=N)__name__
__module____qualname__r   r   r   propertyr   r   r   r    r$   r"   r   r      s<    ]'~
';Hz D D	8>J@:r$   r   c                 ^   t        j                         }i }|j                         D ]-  }|j                  |j                  g       j                  |       / i }|j                         D ]  \  }	}
|
d   }|j                  ri }|r#|j                  s|
D ]  }i ||j                  } |j                  ||d          |j                  dk(  rt        j                  ddi      }n*t        j                  dt        |j                        i      }t        j                  |j                  g||      }| j                  |       |j                   ||	<    |j                         D ]  }|r%|j                  s|j"                  }|j                  }nt%        j&                  |j                        }t)        ||j*                        }i i }}t-        |j/                         j                               D ]$  \  }}|j0                  d	z  |j2                  z  ||<   & |j5                         j                         D ])  \  }}|j7                  |      }||vst9        |      ||<   + t        j                  g d
|      }|j:                  }t        |      }t=        |j                               }t?        tA        |dz              D ]  }tC        d||dz  z
        }|j                  | djE                                ||dz  |dz   dz   D ]D  \  }}djG                  d |D              }|j                  d|dd| djE                                F |j                  d        |jI                  g d       | j                  |       t        j                  dd|j                  rdnd |jJ                  |j                   d      }|j                  rtM        || ||||       n!tO        || |||||j                     |d          | j                  |       |j                   ||j                  <    |S )zBuild PDF dictionary for fonts.r   r   r   Subtypez	/OpenTypeLength1compressr   r5   )$   /CIDInit /ProcSet findresource begin   12 dict begin	   begincmap   /CIDSystemInfos   << /Registry (Adobe)s   /Ordering (UCS)s   /Supplement 0s   >> defs!   /CMapName /Adobe-Identity-UCS defs   /CMapType 2 def   1 begincodespacerange   <0000> <ffff>   endcodespaceranger6   z beginbfcharr   r&   c              3   \   K   | ]$  }|j                  d       j                           & yw)z	utf-16-beN)r_   hexr+   s     r"   r.   z)build_fonts_dictionary.<locals>.<genexpr>g  s/      -N>Dv}}[155789-Ns   *,<04xz> <>s	   endbfchars   endcmaps-   CMapName currentdict /CMap defineresource pop   endr  /Fontz/Type   )Typer   BaseFont	ToUnicodepdf_version)(pydyf
Dictionaryvalues
setdefaultr]   rl   rX   rm   r   r~   r   r   r   rA   Stream
add_object	referencer}   r   r   r   rC   	enumerategetGlyphSetr!   rt   getBestCmap
getGlyphIDr*   streamr   rj   r   rW   r_   r[   extendra   _build_bitmap_font_dictionary_build_vector_font_dictionary)pdffontsr   r   r   	pdf_fontsfonts_by_file_hashfontfont_references_by_file_hash	file_hash
file_fontsr~   	file_font
font_extrafont_streamfont_widthsr   r   r   r   r-   r%   glyph_idto_unicode_objectto_unicode_streamto_unicode_lengthto_unicode_itemsbatch_lengthtextunicode_codepointsfont_dictionarys                                  r"   build_fonts_dictionaryr6  $  s3     "I B%%dii4;;DAB#% !3!9!9!; H	:!};; 
$,,' D	C
Ci.B.BC
D

:wy12 99))9k*BCJ))9c$:K:K6L*MNJllD$5$5#6
XV{#2=2G2G$Y/)H,  @9$,,++KJ 

4#4#45II$**=F&("K%f&8&8&:&A&A&CD @5!&t!3dii!?A@%11399; 7!,,S1:-+.v;Jx(7
 "LL *" -56 .44
O !1!1!34t-345 	3As$5C$?@L$$~\%B%I%I%KL/#qsCi@ Ft%'WW -NHL-N &N"!((c{#&8%9;BBDFF
 $$\2	3 	   " 	
 	()**DKKqQ78		*44	,
  ;;)dK6K *dK,TYY79OQ 	'.88	$))A@9D r$   c                   789 t        j                  g d      | d<   t        j                  g d      | d<   |rt        t        |j                              }nt        t        d            }|d   |d   }}g }	t        |      D ].  }
|
dz
  |vr|	j                  |
       |	j                  d	|
        0 || d
<   || d<   t        j                  dt        j                  |	      d      | d<   t        j                  i       }t        j                  |j                        }t        ||j                        }|d   j                  d   }dg||z
  dz   z  }i }|j                         D ]_  \  }}
|
j                         }|j!                  |      }|dk(  r|
j"                  }|d   j$                  d   j&                  }|D ]  }|j(                  }|j*                  }||cxk  r|k  s'n *|j,                  j.                  }|j,                  j0                  x}9|j,                  j2                  }|j,                  j4                  } n t7        j8                  d|j:                   d|        |dv rdnd}|
j"                  |d  }|
j"                  dd \  }9t<        j?                  |
j"                  dd dd      }t<        j?                  |
j"                  dd dd      }|
j"                  d   }||z
  }||v r||||z
  <   tA        9dz        }9||||d d dx}||<   d9|fv s|sd|d<   |d v r||d<   |d!v rd9dz  z
  dz  8tC        t=        |jE                         d"            dd  77jG                  dtI        |      z        7d#jK                  789fd$t        |      D              } t=        | d      jM                  ||z  d      |d<   j|d%v rg x}!|d&<   |d'k(  rdnd}"t<        j?                  ||"|"dz    d      }#t        |#      D ]  }$|"dz   |$dz  z   }%t<        j?                  ||%|%dz    d      }&t<        j?                  ||%dz   |%dz    dd      }'t<        j?                  ||%dz   |%dz    dd      }(|!j                  |&|'|(d(        *t7        j8                  d)|j:                   d*|        tO        ||z        |d<   b |j                         D ]  \  }}||vr|d+   }|d,   9|d-   }|d.   }'|d/   }(|d   X||z  })t<        j?                  tO        |)      d      }*|d&   D ]  }+|+d.   },|+d/   }-|+d0   }.|.|vr&t7        j8                  d1|j:                   d*|.        =||.   }+|+d   &t7        j8                  d2|j:                   d*|.        mt        |+d-         D ]  }/tQ        |/|+d+   z  |/dz   |+d+   z        }0|+d   |0   }1t<        j?                  |1d      }2|dz  ||-z
  |/z
  dz
  z  }3||+d+   z
  }4|4dkD  r	|2|4dz  z  }2n|4dk  r	|2|4 dz  z  }2|,dkD  r|2|,z  }2n|,dk  r|2|, z  }2|2d|dz  z  z  }2|2|3z  }2|*|2z  }*  |*jM                  |)d      }5n|d   }5t        jR                  d39 d4| d5|' d5|( d6jU                         d7d8d99d:|d;d<d=|5d>g|?      }6|jW                  |6       |6jX                  ||<    |jW                  |       t        j                  |      | d@<   |jX                  | dA<   y )BN)r   r   r   r   FontBBox)r   r   r   r   r   r   
FontMatrix   r   r:   r   /	FirstCharLastCharz	/Encoding)r  DifferencesEncodingr   r7      r8   zUnknown bitmap metrics in "z" for glyph: )r   r
      rA  r
   r  bigT)signedr<   )r!   heightxystriderm   	subglyphsr$   rm   )r   r0   )r
   r@        r&   c              3   F   K   | ]  }|z  |d z   z   dz  z     yw)r   0Nr   )r,   r   bitspaddingr!   s     r"   r.   z0_build_bitmap_font_dictionary.<locals>.<genexpr>  s5      "( QYA/'C-?"(s   !)rA  	   rH  rO  )idrE  rF  z$Unsupported bitmap glyph format in "z": rG  r!   rD  rE  rF  rP  zUnknown subglyph in "z%Unsupported subglyph in subglyph in "s   0 0 d0z 0 0  z cms   BIs   /IM trues   /Ws   /Hs   /BPC 1s   /D [1 0]s   IDs   EIr   Widths	CharProcs)-r  Arrayr   r   r~   rj   rl   r  r   r   rA   r   rC   
strikeDatarX   	getFormatr  datastrikesindexSubTablesfirstGlyphIndexlastGlyphIndexmetricsrD  r!   horiBearingXhoriBearingYr   r   rJ   r   
from_bytesr   binr  zfillr   r[   to_bytesbytesslicer  r_   r  r  ):r5  r!  r%  r}   r   r   charsfirstlastdifferencesr   
char_procsr   r   font_glyphsglyphs_infor%   glyph_formatr-  rW  	subtablessubtablefirst_index
last_indexrD  advance	bearing_x	bearing_y
data_start
position_yrG  
glyph_infobitmap_bitsrH  r   number_of_componentsjrC   subglyph_idrE  rF  length
bitmap_intsubglyphsub_xsub_ysub_idrow_y	row_slicerowrow_intshiftstride_differencerm   bitmap_streamrM  rN  r!   s:                                                          @@@r"   r  r    s   "'++l";OJ$)KK0B$COL!fT__-.eCj!(E"I4EK (19F"u%Qug;'( $)OK "&OJ"'"2"2{{;/4 #OJ !!"%J

4,,-II$**5F.++A.KSD5L1$%FK!'') D:
U($$S) 1::Dv..q1@@I% &66%44
(8j8%--44F&.&6&6&<&<<Ge ( 0 0 = =I ( 0 0 = =I 1$++mH:VX*i7QJ::jk*D!JJqOMFEuzz!AdKIuzz!AdKIjjmG'
u'.F8e#$eai.
 	

[* t#&Jx V##'Jx Y&EAI!+Gs488:r*+AB/D::a#d)m,D'' "(v"( (K $'{A#6#?#?QV#WJx V#244I
;/!Q&AA#&>>$q1+u#E /0 FQ1q5)!nnT%a-@%HNN4aa#8%NMNN4aa#8%NM  !!!DEF NN6t{{m3|nUW#(&#9Jx ID:L !, 1 1 3 >7*5  H%7#H%sOsOh'f_Ffu=J&{3  *  !$,NN%:4;;-s6(#ST&v.H%-NN KK=F856 "8H#56 *E % 22hx&88!:I #8,Y7C!nnS%8G"QJ&5.5*@1*DEE(.(1C(C%(1,$5$99*Q.%6$6$::qyE)UF*qFQJ.G%G')J%* *B  ((7F)FgU6(!A3as#.5575665
&
 
 	}%,66
8}>7@ NN: %F 3OH#-#7#7OK r$   c                 	   d|j                   dk(  rdnd }|rt        |j                               nd}d|j                  ||j                  f}	|j
                  }
t        |      dkD  r4t        t        |j                  j                                     dk(  r|
dz  }
t        j                  ddd	|j                  d
t        j                  |j                        d|
dt        j                  |	      d|j                  d|j                  d|j                  d|	d   d|j                   d|j"                  ||i      }t%        |      dk  rt'        |j                        }t)        |d   dz   dz        }dg|z  dz  }|D ]  }d||<   	 t        j*                  t-        dj/                  |      d      j1                  |d      f|      }|j3                  |       |j4                  |d<   |j3                  |       t        j                         }t'        |      D ]S  }|dz
  |vr6|j7                  |       t        j                         }|j7                  |       j7                  ||          U t        j                  dd|j                   dk(  rdnd |j                  t        j                  t        j                  d      t        j                  d      dd       d!||j4                  d"      }|j3                  |       |j8                  rt        j                  d#d$t        j                  t        j                  d      t        j                  d      dd       d%      }t        j*                  g d&||      }t;        |j<                        }t        |      }t?        t)        |d'z              D ]  }tA        d'||d'z  z
        }|jB                  j7                  | d(jE                                ||d'z  |dz   d'z   D ]R  }||j8                  j                         v rdn|}|jB                  j7                  d)|d*d+| jE                                T |jB                  j7                  d,        |jB                  jG                  g d-       |j3                  |       |j4                  | d.<   nd/| d.<   t        j                  |j4                  g      | d0<   y )1NFontFiler   r  r
   r   r   r  z/FontDescriptorFontName
FontFamilyFlagsr8  ItalicAngleAscentDescent	CapHeightStemVStemHz1.4r:   rA  rL  1r&   rB  r   CIDSetr  z/CIDFontTypeAdobeIdentity)RegistryOrdering
Supplementz	/Identity)r  r   r  CIDSystemInfoCIDToGIDMapWFontDescriptorz/CMapz/WP-Encod-0)r  CMapNamer  )r   r   r   r  s   3 dict dup begins   /Registry (Adobe) defs   /Ordering (Identity) defs   /Supplement 0 defs   end defs   /CMapName /WP-Encod-0 defs   /CMapType 1 defr  r  r  r6   z begincidcharr  r  z> s
   endcidcharr
  r?  z/Identity-HDescendantFonts)$r   r   r  rf   rd   r   r   setr}   r  r  ra   StringrJ   rT  rr   r{   r|   strr   r   r  r   r[   rb  r  r  rl   r   r   r~   rj   rW   r  r_   r  )r5  r!  r%  r}   r   r  r  	font_filemax_xbboxr   font_descriptorcidspadded_widthrM  cidr  
pdf_widthsr   current_widthssubfont_dictionary
cmap_extraencoding	availableavailable_lengthr2  r-  font_glyph_ids                               r"   r   r   +  sj   		U 21:;I$*C Et||UDKK0DJJE
6{Q3s4;;#5#5#789Q>&&!DIIell4;;/EKK%t(($++4<<T!W9( O ;5 dkk"T"X\Q./u|#a' 	CDI	"++L%@B 	v$*$4$4!NN?#JF^ )q5a "[[]Nn-fQi() ))!tyyE'9!q!ABII))W-Z0+
 
 #)33+  NN%&|| %%%"--!LL1!LL4/ '
 
 << !
 *  $//*	y>t,s234 	2As$4q3w$>?LOO""l^=#A#H#H#JK%aeQqS#I6 U%-1D1D1F%FH&&8C.=/'J'Q'Q'STU OO""=1	2 	   	
 	x &.&8&8
# '4
#).6H6R6R5S)TO%&r$   )!__doc__r   r^   hashlibr   mathr   r  	fontToolsr   fontTools.ttLibr   r   r   fontTools.varLib.instancerr	   loggerr   text.constantsr   text.ffir   r   r   r   r   
text.fontsr   r   r   r6  r  r   r   r$   r"   <module>r     sT     	 	     6 6 >  2 H H CN: N:b_Db8JhUr$   