a
    ]j%5                     @  s   d Z ddlmZ ddlmZmZ ddlmZ ddlm	Z	 ddl
mZmZ erpddlmZ ddlmZ dd	l
mZ G d
d deZdS )zFont-related proxy objects.    )annotations)TYPE_CHECKINGAny)ColorFormat)WD_UNDERLINE)ElementProxyEmu)WD_COLOR_INDEX)CT_R)Lengthc                      sd  e Zd ZdZdjddd fddZedd	d
dZejdddddZedd	ddZejdddddZedd Z	edd	ddZ
e
jdddddZ
edd	ddZejdddddZedd	ddZejdddddZedd	ddZejdddddZedd	d d!Zejdddd"d!Zedd	d#d$Zejdddd%d$Zed&d	d'd(Zejd&d)d*d(Zedd	d+d,Zejdddd-d,Zedd	d.d/Zejdddd0d/Zedd	d1d2Zejdddd3d2Zed4d	d5d6Zejd4ddd7d6Zedd	d8d9Zejdddd:d9Zedd	d;d<Zejdddd=d<Zedd	d>d?Zejdddd@d?Zedd	dAdBZejddddCdBZedDd	dEdFZejdGddHdIdFZedd	dJdKZejddddLdKZedd	dMdNZejddddOdNZedd	dPdQZejddddRdQZedd	dSdTZejddddUdTZedd	dVdWZejddddXdWZedd	dYdZZejdddd[dZZed\d	d]d^Z e jd\ddd_d^Z edd	d`daZ!e!jddddbdaZ!dcddddedfZ"dcddgdhdiZ#  Z$S )kFontzProxy object for parent of a `<w:rPr>` element and providing access to
    character properties such as font name, font size, bold, and subscript.Nr
   z
Any | None)rparentc                   s   t  || || _|| _d S N)super__init___element_r)selfr   r   	__class__ J/var/www/html/assistant/venv/lib/python3.9/site-packages/docx/text/font.pyr      s    zFont.__init__zbool | None)returnc                 C  s
   |  dS )zTRead/write.

        Causes text in this font to appear in capital letters.
        caps_get_bool_propr   r   r   r   all_caps   s    zFont.all_capsNone)valuer   c                 C  s   |  d| d S )Nr   _set_bool_propr   r    r   r   r   r   "   s    c                 C  s
   |  dS )zIRead/write.

        Causes text in this font to appear in bold.
        br   r   r   r   r   bold&   s    z	Font.boldc                 C  s   |  d| d S )Nr$   r!   r#   r   r   r   r%   .   s    c                 C  s
   t | jS )z[A |ColorFormat| object providing a way to get and set the text color for this
        font.)r   r   r   r   r   r   color2   s    z
Font.colorc                 C  s
   |  dS )zRead/write tri-state value.

        When |True|, causes the characters in the run to be treated as complex script
        regardless of their Unicode values.
        csr   r   r   r   r   complex_script8   s    zFont.complex_scriptc                 C  s   |  d| d S )Nr'   r!   r#   r   r   r   r(   A   s    c                 C  s
   |  dS )zRead/write tri-state value.

        When |True|, causes the complex script characters in the run to be displayed in
        bold typeface.
        bCsr   r   r   r   r   cs_boldE   s    zFont.cs_boldc                 C  s   |  d| d S )Nr)   r!   r#   r   r   r   r*   N   s    c                 C  s
   |  dS )zRead/write tri-state value.

        When |True|, causes the complex script characters in the run to be displayed in
        italic typeface.
        iCsr   r   r   r   r   	cs_italicR   s    zFont.cs_italicc                 C  s   |  d| d S )Nr+   r!   r#   r   r   r   r,   [   s    c                 C  s
   |  dS )zzRead/write tri-state value.

        When |True|, causes the text in the run to appear with double strikethrough.
        dstriker   r   r   r   r   double_strike_   s    zFont.double_strikec                 C  s   |  d| d S )Nr-   r!   r#   r   r   r   r.   g   s    c                 C  s
   |  dS )zRead/write tri-state value.

        When |True|, causes the text in the run to appear as if raised off the page in
        relief.
        embossr   r   r   r   r   r/   k   s    zFont.embossc                 C  s   |  d| d S )Nr/   r!   r#   r   r   r   r/   t   s    c                 C  s
   |  dS )zRead/write tri-state value.

        When |True|, causes the text in the run to be hidden from display, unless
        applications settings force hidden text to be shown.
        vanishr   r   r   r   r   hiddenx   s    zFont.hiddenc                 C  s   |  d| d S )Nr0   r!   r#   r   r   r   r1      s    zWD_COLOR_INDEX | Nonec                 C  s   | j j}|du rdS |jS )z:Color of highlighing applied or |None| if not highlighted.N)r   rPrhighlight_valr   r2   r   r   r   highlight_color   s    zFont.highlight_color)r    c                 C  s   | j  }||_d S r   )r   get_or_add_rPrr3   r   r    r2   r   r   r   r5      s    
c                 C  s
   |  dS )zRead/write tri-state value.

        When |True|, causes the text of the run to appear in italics. |None| indicates
        the effective value is inherited from the style hierarchy.
        ir   r   r   r   r   italic   s    zFont.italicc                 C  s   |  d| d S )Nr8   r!   r#   r   r   r   r9      s    c                 C  s
   |  dS )z|Read/write tri-state value.

        When |True|, causes the text in the run to appear as if pressed into the page.
        imprintr   r   r   r   r   r:      s    zFont.imprintc                 C  s   |  d| d S )Nr:   r!   r#   r   r   r   r:      s    c                 C  s
   |  dS )zRead/write tri-state value.

        When |True|, specifies this run contains WML that should be handled as though it
        was Office Open XML Math.
        oMathr   r   r   r   r   math   s    z	Font.mathc                 C  s   |  d| d S )Nr;   r!   r#   r   r   r   r<      s    z
str | Nonec                 C  s   | j j}|du rdS |jS )zThe typeface name for this |Font|.

        Causes the text it controls to appear in the named font, if a matching font is
        found. |None| indicates the typeface is inherited from the style hierarchy.
        N)r   r2   rFonts_asciir4   r   r   r   name   s    z	Font.namec                 C  s   | j  }||_||_d S r   )r   r6   r=   ZrFonts_hAnsir7   r   r   r   r>      s    
c                 C  s
   |  dS )zRead/write tri-state value.

        When |True|, specifies that the contents of this run should not report any
        errors when the document is scanned for spelling and grammar.
        noProofr   r   r   r   r   no_proof   s    zFont.no_proofc                 C  s   |  d| d S )Nr?   r!   r#   r   r   r   r@      s    c                 C  s
   |  dS )zRead/write tri-state value.

        When |True| causes the characters in the run to appear as if they have an
        outline, by drawing a one pixel wide border around the inside and outside
        borders of each character glyph.
        outliner   r   r   r   r   rA      s    zFont.outlinec                 C  s   |  d| d S )NrA   r!   r#   r   r   r   rA      s    c                 C  s
   |  dS )z{Read/write tri-state value.

        When |True| causes the text in the run to have right-to-left characteristics.
        rtlr   r   r   r   r   rB      s    zFont.rtlc                 C  s   |  d| d S )NrB   r!   r#   r   r   r   rB      s    c                 C  s
   |  dS )zRead/write tri-state value.

        When |True| causes the text in the run to appear as if each character has a
        shadow.
        shadowr   r   r   r   r   rC      s    zFont.shadowc                 C  s   |  d| d S )NrC   r!   r#   r   r   r   rC      s    zLength | Nonec                 C  s   | j j}|du rdS |jS )a  Font height in English Metric Units (EMU).

        |None| indicates the font size should be inherited from the style hierarchy.
        |Length| is a subclass of |int| having properties for convenient conversion into
        points or other length units. The :class:`docx.shared.Pt` class allows
        convenient specification of point values::

            >>> font.size = Pt(24)
            >>> font.size
            304800
            >>> font.size.pt
            24.0

        N)r   r2   sz_valr4   r   r   r   size   s    z	Font.sizezint | Length | None)emur   c                 C  s$   | j  }|d u rd nt||_d S r   )r   r6   r   rD   )r   rF   r2   r   r   r   rE     s    
c                 C  s
   |  dS )zRead/write tri-state value.

        When |True| causes the lowercase characters in the run to appear as capital
        letters two points smaller than the font size specified for the run.
        	smallCapsr   r   r   r   r   
small_caps  s    zFont.small_capsc                 C  s   |  d| d S )NrG   r!   r#   r   r   r   rH   !  s    c                 C  s
   |  dS )zRead/write tri-state value.

        When |True| causes the run to use the document grid characters per line settings
        defined in the docGrid element when laying out the characters in this run.
        
snapToGridr   r   r   r   r   snap_to_grid%  s    zFont.snap_to_gridc                 C  s   |  d| d S )NrI   r!   r#   r   r   r   rJ   .  s    c                 C  s
   |  dS )u\  Read/write tri-state value.

        When |True|, specifies that the given run shall always behave as if it is
        hidden, even when hidden text is being displayed in the current document. The
        property has a very narrow, specialized use related to the table of contents.
        Consult the spec (§17.3.2.36) for more details.
        
specVanishr   r   r   r   r   spec_vanish2  s    	zFont.spec_vanishc                 C  s   |  d| d S )NrK   r!   r#   r   r   r   rL   =  s    c                 C  s
   |  dS )zRead/write tri-state value.

        When |True| causes the text in the run to appear with a single horizontal line
        through the center of the line.
        striker   r   r   r   r   rM   A  s    zFont.strikec                 C  s   |  d| d S )NrM   r!   r#   r   r   r   rM   J  s    c                 C  s   | j j}|du rdS |jS )zBoolean indicating whether the characters in this |Font| appear as subscript.

        |None| indicates the subscript/subscript value is inherited from the style
        hierarchy.
        N)r   r2   	subscriptr4   r   r   r   rN   N  s    zFont.subscriptc                 C  s   | j  }||_d S r   )r   r6   rN   r7   r   r   r   rN   Z  s    
c                 C  s   | j j}|du rdS |jS )zBoolean indicating whether the characters in this |Font| appear as
        superscript.

        |None| indicates the subscript/superscript value is inherited from the style
        hierarchy.
        N)r   r2   superscriptr4   r   r   r   rO   _  s    zFont.superscriptc                 C  s   | j  }||_d S r   )r   r6   rO   r7   r   r   r   rO   l  s    
zbool | WD_UNDERLINE | Nonec                 C  sH   | j j}|du rdS |j}|tjkr(dS |tjkr6dS |tjkrDdS |S )a  The underline style for this |Font|.

        The value is one of |None|, |True|, |False|, or a member of :ref:`WdUnderline`.

        |None| indicates the font inherits its underline value from the style hierarchy.
        |False| indicates no underline. |True| indicates single underline. The values
        from :ref:`WdUnderline` are used to specify other outline styles such as double,
        wavy, and dotted.
        NTF)r   r2   u_valr   Z	INHERITEDSINGLENONE)r   r2   valr   r   r   	underlineq  s    zFont.underlinec                 C  s4   | j  }|du rtjn|du r&tjn|}||_d S )NTF)r   r6   r   rQ   rR   rP   )r   r    r2   rS   r   r   r   rT     s    
c                 C  s
   |  dS )zRead/write tri-state value.

        When |True|, specifies that the contents of this run shall be hidden when the
        document is displayed in web page view.
        	webHiddenr   r   r   r   r   
web_hidden  s    zFont.web_hiddenc                 C  s   |  d| d S )NrU   r!   r#   r   r   r   rV     s    str)r>   r   c                 C  s   | j j}|du rdS ||S )z;Return the value of boolean child of `w:rPr` having `name`.N)r   r2   Z_get_bool_val)r   r>   r2   r   r   r   r     s    zFont._get_bool_prop)r>   r    c                 C  s   | j  }||| dS )z6Assign `value` to the boolean child `name` of `w:rPr`.N)r   r6   Z_set_bool_val)r   r>   r    r2   r   r   r   r"     s    
zFont._set_bool_prop)N)%__name__
__module____qualname____doc__r   propertyr   setterr%   r&   r(   r*   r,   r.   r/   r1   r5   r9   r:   r<   r>   r@   rA   rB   rC   rE   rH   rJ   rL   rM   rN   rO   rT   rV   r   r"   __classcell__r   r   r   r   r      s   
	

r   N)r[   
__future__r   typingr   r   Zdocx.dml.colorr   Zdocx.enum.textr   Zdocx.sharedr   r   r	   Zdocx.oxml.text.runr
   r   r   r   r   r   r   <module>   s   