a
    §ˆcö  ã                   @   sz  d Z ddlZejdkZejdejdejdejdejdej	d	ej
d
iZejejejejejejejejejej	ej	ej
ej
dœZerøejejejejejejejejejejdœ
ZejdejdejdejdejdejdejdejdejdejdejdiZnJejejejejejejejejejejdœ
ZejdejdejdejdiZejejejdœZdd„ e ¡ D ƒZdd„ Z dd„ Z!dS )z¸
Font conversion utilities

This module provides facilities for converting between pyface Font objects
and Wx Font objects, trying to keep as much similarity as possible between
them.
é    N)é   é   ÚdefaultÚfantasyÚserifÚcursiveú
sans-serifÚ	monospaceÚ
typewriter)r   r   Z
decorativer   Zromanr   Úscriptr   Zswissr	   Zmodernr
   Zteletype)
éd   éÈ   i,  i�  iô  iX  i¼  i   i„  iè  Zthinzextra-lightÚlightÚnormalZmediumZsemiboldZboldz
extra-boldZheavyzextra-heavy)r   ZobliqueZitalicc                 C   s   i | ]\}}||“qS © r   )Ú.0ÚkeyÚvaluer   r   úT/home/yuhw/wc/wire-cell-python/wcpy/lib/python3.9/site-packages/pyface/ui/wx/font.pyÚ
<dictcomp>e   ó    r   c           	   	   C   s¸   t | jƒ}| jD ]}|tv rt| } q0qtj}t| j }t| j	 }d| j
v }t |||||¡}| jD ]<}|tv rv q¤t ||||||¡}| ¡  ¡ | ¡ krf q¤qf| d| j
v ¡ |S )aa   Convert a Pyface font to a wx.font Font.

    Wx fonts have no notion of stretch values or small-caps or overline
    variants, so these are ignored when converting.

    Parameters
    ----------
    font : pyface.font.Font
        The Pyface font to convert.

    Returns
    -------
    wx_font : wx.font.Font
        The best matching wx font.
    Ú	underlineÚstrikethrough)ÚintÚsizeÚfamilyÚgeneric_family_to_wx_familyÚwxÚFONTFAMILY_DEFAULTÚweight_to_wx_weightZweight_Ústyle_to_wx_styleÚstyleÚdecorationsZFontÚGetFaceNameÚlowerZSetStrikethrough)	Úfontr   r   Zdefault_familyÚweightr!   r   Zwx_fontÚfacer   r   r   Úfont_to_toolkit_fonth   s(    





ÿr(   c                 C   s†   t |  ¡  }|  ¡ }tr"|  ¡ }n|  ¡ }t|  ¡  }t|  	¡  }t
ƒ }|  ¡ rZ| d¡ |  ¡ rl| d¡ ||g||d|t
ƒ |dœS )a   Convert a Wx Font to a dictionary of font properties.

    Parameters
    ----------
    toolkit_font : wx.font.Font
        The Wx font to convert.

    Returns
    -------
    properties : dict
        Font properties suitable for use in creating a Pyface Font.
    r   r   r   )r   r   r&   Zstretchr!   Úvariantsr"   )Úwx_family_to_generic_familyZ	GetFamilyr#   Úwx_python_4_1ZGetFractionalPointSizeZGetPointSizeÚwx_style_to_styleZGetStyleÚwx_weight_to_weightZ	GetWeightÚsetZGetUnderlinedÚaddZGetStrikethrough)Ztoolkit_fontr   r'   r   r!   r&   r"   r   r   r   Útoolkit_font_to_properties“   s(    


ùr0   )"Ú__doc__r   ÚVERSIONr+   r   ZFONTFAMILY_DECORATIVEZFONTFAMILY_ROMANZFONTFAMILY_SCRIPTZFONTFAMILY_SWISSZFONTFAMILY_MODERNZFONTFAMILY_TELETYPEr*   r   ZFONTWEIGHT_THINZFONTWEIGHT_EXTRALIGHTZFONTWEIGHT_LIGHTZFONTWEIGHT_NORMALZFONTWEIGHT_MEDIUMZFONTWEIGHT_SEMIBOLDZFONTWEIGHT_BOLDZFONTWEIGHT_EXTRABOLDZFONTWEIGHT_HEAVYZFONTWEIGHT_EXTRAHEAVYr   ZFONTWEIGHT_MAXr-   ZFONTSTYLE_NORMALZFONTSTYLE_SLANTZFONTSTYLE_ITALICr    Úitemsr,   r(   r0   r   r   r   r   Ú<module>   sŽ   
ù
óöõöüý+