a
    @RVug                  8   @   sZ  d dl Z d dlZd dlZze W n ey:   dd ZY n
0 dd Zdd Zdd Zg d	Zd
d Z	dddddiddiddiddidddddddidddddddddd idd!idd"idd#id$d%id&d'dd(d)dd*d+dd,d-d.d/ddd0id1d2dd3d4d5d6dd7id8d9dd:d;d<d=dd>d?ddd@iddAiddBiddCiddDiddEiddFiddGiddHiddIidJdKdLdMdddNidOdPdddQidRdSdddTiddUiddViddWiddViddVidXdYddZd[dd\d]d^d_dd`dadbdcddddedfdgdddhiddiiddjiddkidl7Z
dmdn Zdodp ZddrdsZdtdu Zi Zi Zdvdw Zdxdy Zdd{d|Zd}d~ ZdddZdS )    Nc                 C   s   |  dddS Nasciiignore)decodeencoderaw r	   d/home/tom/ab/renpy-build/tmp/install.linux-x86_64/lib/python3.9/site-packages/pygame_sdl2/sysfont.pytoascii   s    r   c                 C   s   |  ddS r   )r   r   r	   r	   r
   r   !   s    c                 C   s   d dd | D S )N c                 S   s   g | ]}|  r| qS r	   )isalnumlower).0cr	   r	   r
   
<listcomp>&       z_simplename.<locals>.<listcomp>)join)namer	   r	   r
   _simplename%   s    r   c                 C   s$   | |vri || < |||  ||f< d S Nr	   )r   bolditalicfontfontdictr	   r	   r
   _addfont*   s    r   ))zahronbd.ttfZAharoniTF)z
andlso.ttfZAndalusFF)z	angsa.ttfAngsana NewFF)z
angsab.ttfr   TF)z
angsai.ttfr   FT)z
angsaz.ttfr   TT)z
angsau.ttf
AngsanaUPCFF)zangsaub.ttfr   TF)zangsaui.ttfr   FT)zangsauz.ttfr   TT)z	artro.ttfArabic TransparentFF)zartrbdo.ttfr   TF)z
agatha.ttfZAgathaFF)z	arial.ttfArialFF)zarialbd.ttfr   TF)z
ariali.ttfr   FT)zarialbi.ttfr   TT)z
ariblk.ttfzArial BlackFF)z	browa.ttfBrowallia NewFF)z
browab.ttfr    TF)z
browai.ttfr    FT)z
browaz.ttfr    TT)z
browau.ttfBrowalliaUPCFF)zbrowaub.ttfr!   TF)zbrowaui.ttfr!   FT)zbrowauz.ttfr!   TT)z	comic.ttfComic Sans MSFF)zcomicbd.ttfr"   TF)z
cordia.ttf
Cordia NewFF)zcordiab.ttfr#   TF)zcordiai.ttfr#   FT)zcordiaz.ttfr#   TT)zcordiau.ttf	CordiaUPCFF)zcordiaub.ttfr$   TF)zcordiaui.ttfr$   FT)zcordiauz.ttfr$   TT)zcour.ttfCourier NewFF)z
courbd.ttfr%   TF)z	couri.ttfr%   FT)z
courbi.ttfr%   TT)z	david.ttfDavidFF)zdavidbd.ttfr&   TF)zdavidtr.ttfzDavid TransparentFF)z	upcdl.ttfDilleniaUPCFF)z	upcdb.ttfr'   TF)z	upcdi.ttfr'   FT)z
upcdbi.ttfr'   TT)z	estre.ttfzEstrangelo EdessaFF)z	upcel.ttfEucrosialUPCFF)z	upceb.ttfr(   TF)z	upcei.ttfr(   FT)z
upcebi.ttfr(   TT)zmriamfx.ttfzFixed Miriam TransparentFF)z	framd.ttfFranklin Gothic MediumFF)zframdit.ttfr)   FT)z	frank.ttfZ
FrankRuehlFF)z	upcfl.ttfFreesialUPCFF)z	upcfb.ttfr*   TF)z	upcfi.ttfr*   FT)z
upcfbi.ttfr*   TT)zgautami.ttfZGautamiFF)zgeorgia.ttfGeorgiaFF)zgeorgiab.ttfr+   TF)zgeorgiai.ttfr+   FT)zgeorgiaz.ttfr+   TT)z
impact.ttfZImpactFF)z	upcil.ttfIrisUPCFF)z	upcib.ttfr,   TF)z	upcii.ttfr,   FT)z
upcibi.ttfr,   TT)z	upcjl.ttf
JasmineUPCFF)z	upcjb.ttfr-   TF)z	upcji.ttfr-   FT)z
upcjbi.ttfr-   TT)z	upckl.ttfKodchiangUPCFF)z	upckb.ttfr.   TF)z	upcki.ttfr.   FT)z
upckbi.ttfr.   TT)z	latha.ttfZLathaFF)zlvnm.ttf
Levenim MTFF)z
lvnmbd.ttfr/   TF)z	upcll.ttfLilyUPCFF)z	upclb.ttfr0   TF)z	upcli.ttfr0   FT)z
upclbi.ttfr0   TT)z	lucon.ttfzLucida ConsoleFF)zl_10646.ttfzLucida Sans UnicodeFF)z
mangal.ttfZMangalFF)zmarlett.ttfZMarlettFF)zmicross.ttfzMicrosoft Sans SerifFF)z	mriam.ttfZMiriamFF)z
mriamc.ttfzMiriam FixedFF)zmriamtr.ttfzMiriam TransparentFF)z
mvboli.ttfzMV BoliFF)z	nrkis.ttfZNarkisimFF)zpala.ttfFalatino LinotypeFF)z	palab.ttfr1   TF)z	palai.ttfr1   FT)z
palabi.ttfr1   TT)z	raavi.ttfZRaaviFF)zrod.ttfZRodFF)z	rodtr.ttfzRod TransparentFF)z
shruti.ttfZShrutiFF)z	simpo.ttfSimplified ArabicFF)zsimpbdo.ttfr2   TF)zsimpfxo.ttfzSimplified Arabic FixedFF)zsylfaen.ttfZSylfaenFF)z
symbol.ttfZSymbolFF)z
tahoma.ttfTahomaFF)ztahomabd.ttfr3   TF)z	times.ttfTimes New RomanFF)ztimesbd.ttfr4   TF)z
timesi.ttfr4   FT)ztimesbi.ttfr4   TT)z	trado.ttfTraditional ArabicFF)ztradbdo.ttfr5   TF)z
Trebuc.ttfTrebuchet MSFF)zTrebucbd.ttfr6   TF)zTrebucit.ttfr6   FT)zTrebucbi.ttfr6   TT)z	tunga.ttfZTungaFF)zverdana.ttfVerdanaFF)zverdanab.ttfr7   TF)zverdanai.ttfr7   FT)zverdanaz.ttfr7   TT)zwebdings.ttfZWebdingsFF)zwingding.ttfZ	WingdingsFF)z
simhei.ttfZSimHeiFF)zsimfang.ttfZFangSong_GB2312FF)zkaiu.ttfzDFKai-SBFF)z
simkai.ttfZKaiTi_GB2312FF)zmsgothic.ttcz	MS GothicFF)zmsmincho.ttcz	MS MinchoFF)z	gulim.ttcZGulimFF)zmingliu.ttcZMingliuFF)z
simsun.ttcZSimsunFF)z
batang.ttcZBatangFFc                  C   s  zdd l } W n ty&   dd l} Y n0 dtjv r>tjd }ndtjv rTtjd }nd}i }d}tj|d}g }tdd tD }tj|d	}zt		tj|d
}W n t
y   Y nN0 |D ]F}	tj|	}
z||
 \}}}W n ty   Y q0 t||||	| qg d}|D ]8}z| | j|}|| W n tyJ   Y n0 q|D ]x}i }t| |d D ]X}z| ||\}}	}W n ty   Y  qTY n0 zt|	}	W n8 ty   z|	d}	W n   Y Y qpY n0 Y n0 |	dd   dvr
qptj|	vr$tj||	}	|dd  dkrB|d d }|  }d }}|D ]}||v rZ|| qZd|v r|d d}d|v r|d d}d|}t|}t||||	| qpqT|S )Nr   ZWINDIRwindirzC:\Windows\)ZdemiboldZnarrowZlightunicodeZbtmtZFontsc                 S   s*   g | ]"\}}}}|  t|||ffqS r	   )r   r   )r   	file_namer   r   r   r	   r	   r
   r      s   
z&initsysfonts_win32.<locals>.<listcomp>fontsz*.tt?)z/SOFTWARE\Microsoft\Windows\CurrentVersion\Fontsz2SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fontsz3SOFTWARE\Microsoft\Windows[NT]\CurrentVersion\Fonts   ZMBCSz.ttfz.ttcz.otfiz
(TrueType)ir   r   r   )_winregImportErrorwinregosenvironpathr   dict_XP_default_font_filesglob	ExceptionbasenameKeyErrorr   OpenKeyHKEY_LOCAL_MACHINEappendZWindowsErrorrangeQueryInfoKey	EnumValueEnvironmentErrorstrUnicodeEncodeErrorr   r   sepsplitremover   )r@   r8   r<   modsZfontdirkeysZwin_font_files_mappingZfont_dir_pathZfont_file_pathsr   r;   r   r   r   Zpossible_keysZkey_namekeyr   itmr	   r	   r
   initsysfonts_win32   s    









r^   z/Library/Fonts/AlBayan.ttfz/Library/Fonts/AlBayanBold.ttf)FFTFr_   z/Library/Fonts/Andale Mono.ttfz5/System/Library/Fonts/Apple Braille Outline 6 Dot.ttfz%/System/Library/Fonts/AppleGothic.ttfz'/System/Library/Fonts/Apple Symbols.ttfz/Library/Fonts/Arial.ttfz/Library/Fonts/Arial Italic.ttfz/Library/Fonts/Arial Bold.ttfz$/Library/Fonts/Arial Bold Italic.ttf)r_   FTr`   )TTz/Library/Fonts/Arial Black.ttfz/Library/Fonts/ArialHB.ttfz/Library/Fonts/ArialHBBold.ttfz/Library/Fonts/Arial Narrow.ttfz&/Library/Fonts/Arial Narrow Italic.ttfz$/Library/Fonts/Arial Narrow Bold.ttfz+/Library/Fonts/Arial Narrow Bold Italic.ttfz%/Library/Fonts/Arial Rounded Bold.ttfz /Library/Fonts/Arial Unicode.ttfz/Library/Fonts/Ayuthaya.ttfz/Library/Fonts/Baghdad.ttfra   z/Library/Fonts/Brush Script.ttfz/Library/Fonts/Chalkboard.ttfz!/Library/Fonts/ChalkboardBold.ttfz /Library/Fonts/Comic Sans MS.ttfz%/Library/Fonts/Comic Sans MS Bold.ttfz/Library/Fonts/Corsiva.ttfz/Library/Fonts/CorsivaBold.ttfz/Library/Fonts/Courier New.ttfz%/Library/Fonts/Courier New Italic.ttfz#/Library/Fonts/Courier New Bold.ttfz*/Library/Fonts/Courier New Bold Italic.ttfz /Library/Fonts/DecoTypeNaskh.ttfz/Library/Fonts/DevanagariMT.ttfz#/Library/Fonts/DevanagariMTBold.ttfz%/Library/Fonts/EuphemiaCASRegular.ttfz$/Library/Fonts/EuphemiaCASItalic.ttfz"/Library/Fonts/EuphemiaCASBold.ttf)r_   ra   r`   z/Library/Fonts/NISC18030.ttfz#/System/Library/Fonts/Geeza Pro.ttfz(/System/Library/Fonts/Geeza Pro Bold.ttfz/Library/Fonts/Georgia.ttfz!/Library/Fonts/Georgia Italic.ttfz/Library/Fonts/Georgia Bold.ttfz&/Library/Fonts/Georgia Bold Italic.ttfz/Library/Fonts/GujaratiMT.ttfz!/Library/Fonts/GujaratiMTBold.ttfz/Library/Fonts/Gurmukhi.ttfz/Library/Fonts/Impact.ttfz/Library/Fonts/InaiMathi.ttfz/Library/Fonts/Kailasa.ttfz/Library/Fonts/Kokonor.ttfz/Library/Fonts/Krungthep.ttfz!/Library/Fonts/KufiStandardGK.ttfz/System/Library/Fonts/ Pro.ttfz/Library/Fonts/ Pro.ttfz'/Library/Fonts/Microsoft Sans Serif.ttfz"/Library/Fonts/MshtakanRegular.ttfz"/Library/Fonts/MshtakanOblique.ttfz/Library/Fonts/MshtakanBold.ttfz&/Library/Fonts/MshtakanBoldOblique.ttfz/Library/Fonts/Nadeem.ttfz/Library/Fonts/NewPeninimMT.ttfz+/Library/Fonts/NewPeninimMTBoldInclined.ttfz&/Library/Fonts/PlantagenetCherokee.ttfz/Library/Fonts/Raanana.ttfz/Library/Fonts/RaananaBold.ttfz/Library/Fonts/Sathu.ttfz/Library/Fonts/Silom.ttfz/Library/Fonts/.ttfz/System/Library/Fonts/.ttfz/Library/Fonts/Tahoma.ttfz/Library/Fonts/Tahoma Bold.ttfz"/System/Library/Fonts/Thonburi.ttfz&/System/Library/Fonts/ThonburiBold.ttfz"/Library/Fonts/Times New Roman.ttfz)/Library/Fonts/Times New Roman Italic.ttfz'/Library/Fonts/Times New Roman Bold.ttfz./Library/Fonts/Times New Roman Bold Italic.ttfz/Library/Fonts/Trebuchet MS.ttfz&/Library/Fonts/Trebuchet MS Italic.ttfz$/Library/Fonts/Trebuchet MS Bold.ttfz+/Library/Fonts/Trebuchet MS Bold Italic.ttfz/Library/Fonts/Verdana.ttfz!/Library/Fonts/Verdana Italic.ttfz/Library/Fonts/Verdana Bold.ttfz&/Library/Fonts/Verdana Bold Italic.ttfz/Library/Fonts/Webdings.ttfz/Library/Fonts/Wingdings.ttfz/Library/Fonts/Wingdings 2.ttfz/Library/Fonts/Wingdings 3.ttf)7ZalbayanZ
andalemonoZapplebrailleZapplegothicZapplesymbolsarialZ
arialblackZarialhebrewZarialnarrowZarialroundedmtboldZarialunicodemsZayuthayaZbaghdadZbrushscriptmtZ
chalkboardZcomicsansmsZcorsivahebrew
couriernewZdecotypenaskhZdevanagarimtZeuphemiaucasZgb18030bitmapZgeezaprogeorgiaZ
gujaratimtZ
gurmukhimtZimpactZ	inaimathiZkailasaZkokonorZ	krungthepZkufistandardgkZliheiproZ	lisongproZmicrosoftsansserifZmshtakanZnadeemZnewpeninimmtZplantagenetcherokeeZraananaZsathuZsilomZ
stfangsongZstheitiZstkaitiZstsongtahomaZthonburitimesnewromanZtrebuchetmsverdanaZwebdings	wingdingsZ
wingdings2Z
wingdings3c                 C   sL   t  D ]>\}}| D ],\}}tj|r|\}}t|||||  qqd S r   )_OSX_default_font_filesitemsrC   rE   existsr   )r<   r   detailskZapathr   r   r	   r	   r
   _search_osx_font_paths  s
    rn   c                  C   s&   i } t |  | S ]}tj|rq| S )z read the fonts on OSX.
    )z/Library/Fontsz~/Library/Fontsz/Local/Library/Fontsz/Network/Library/Fonts)rn   rC   rE   isdir)r<   pathspr	   r	   r
   initsysfonts_darwin  s      rr   fc-listc              	   C   s6  dd l }i }z(|jd|  d|j|jdd \}}W n tyJ   | Y S 0 t|}z|dD ]}z|dd\}}}	|dd   d	v r |	d
dk}
|	ddk}|	ddk}|dD ]}|r qqt	j
t	j
|d }tt||
|p||| W q` ty   Y q`0 q`W n ty0   Y n0 |S )Nr   z%s : file family styleT)shellstdoutstderr	close_fds
:   r>   r?   ZBoldZItalicZOblique,)
subprocessPopenPIPEcommunicaterI   r   rV   r   findrC   rE   splitextrJ   r   r   )rE   r|   r<   ZfloutZflerrentrieslinefilenamefamilystyler   r   Zobliquer   r	   r	   r
   initsysfonts_unix  s<    
r   c                  C   s\   d} | D ]N}d }d }|D ]}|t v rt | }|} q6q|s<q|D ]}|t vr@|t|< q@qd S )N))Z	monospacez
misc-fixedZcourierrc   ZconsolefixedZmonoZfreemonoZbitstreamverasansmonoZverasansmonoZmonotypeZlucidaconsole)	Zsansrb   Z	helveticaZswissZfreesansZbitstreamverasansZverasansrg   re   )
ZseriftimesZ	freeserifZbitstreamveraserifZromanZ
timesromanrf   dutchZ	veraserifrd   )rh   Zwingbats)SysfontsSysalias)aliasessetfoundfnamer   r	   r	   r
   create_aliases  s    r   c                  C   sJ   t jdkrt } nt jdkr$t } nt } t|  t  tsFd td < d S )Nwin32darwin)sysplatformr^   rr   r   r   updater   )r<   r	   r	   r
   initsysfonts  s    


r   c                 C   s6   dd l }|j| |}|r$|d |r2|d |S )Nr   r=   )Zpygame_sdl2.fontr   ZFontset_bold
set_italic)Zfontpathsizer   r   pygame_sdl2r   r	   r	   r
   font_constructor  s    

r   Fc                 C   s  |du rt }tst  d }}d}| r| }|dD ]} t| } t| }	|	sXt| }	|	r|	d}
|	||f}|s|
st|	 d \}}|r|d rd}|r|d rd}n|s|
}n|
|kr|}|}|r4 qq4d }}|r|sd}|r|sd}|||||S )a  pygame.font.SysFont(name, size, bold=False, italic=False, constructor=None) -> Font
       create a pygame Font from system font resources

       This will search the system fonts for the given font
       name. You can also enable bold or italic styles, and
       the appropriate system font will be selected if available.

       This will always return a valid Font object, and will
       fallback on the builtin pygame font if the given font
       is not found.

       Name can also be a comma separated list of names, in
       which case set of names will be searched in order. Pygame
       uses a small set of common font aliases, if the specific
       font you ask for is not available, a reasonable alternative
       may be used.

       if optional contructor is provided, it must be a function with
       signature constructor(fontpath, size, bold, italic) which returns
       a Font instance. If None, a pygame.font.Font object is created.
    NFr{   r_   r   Tr=   )	r   r   r   rV   r   getr   listrj   )r   r   r   r   constructorZgotboldZ	gotitalicfontnameallnamesstylesZ	plainnamer   r   r   r	   r	   r
   SysFont(  sF    


r   c                   C   s   t s
t  tt  S )a"  pygame.font.get_fonts() -> list
       get a list of system font names

       Returns the list of all found system fonts. Note that
       the names of the fonts will be all lowercase with spaces
       removed. This is how pygame internally stores the font
       names for matching.
    )r   r   r   rY   r	   r	   r	   r
   	get_fontsm  s    	r   c                 C   s   t s
t  d}| }|dD ]l} t| } t | }|s@t| }|r|s|||f}|r`d}qD|rjd}qD|sDt| d }qD|r qq|S )az  pygame.font.match_font(name, bold=0, italic=0) -> name
       find the filename for the named system font

       This performs the same font search as the SysFont()
       function, only it returns the path to the TTF file
       that would be loaded. The font name can be a comma
       separated list of font names to try.

       If no match is found, None is returned.
    Nr{   r   )r   r   rV   r   r   r   r   values)r   r   r   r   r   r   r	   r	   r
   
match_font{  s(    


r   )rs   )FFN)r   r   )rH   rC   r   bytes	NameErrorr   r   r   rG   r^   ri   rn   rr   r   r   r   r   r   r   r   r   r   r	   r	   r	   r
   <module>   s   p`	&
*
E