o
    	'fU5                     @  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r8d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                      sP  e Zd ZdZdidj fddZedkddZejdlddZedkddZejdlddZedd Z	edkddZ
e
jdlddZ
edkddZejdlddZedkddZejdlddZedkddZejdld dZedkd!d"Zejdld#d"Zedkd$d%Zejdld&d%Zedmd(d)Zejdnd*d)Zedkd+d,Zejdld-d,Zedkd.d/Zejdld0d/Zedkd1d2Zejdld3d2Zedod5d6Zejdpd7d6Zedkd8d9Zejdld:d9Zedkd;d<Zejdld=d<Zedkd>d?Zejdld@d?ZedkdAdBZejdldCdBZedqdEdFZejdrdIdFZedkdJdKZejdldLdKZedkdMdNZejdldOdNZedkdPdQZejdldRdQZedkdSdTZejdldUdTZedkdVdWZejdldXdWZedkdYdZZejdld[dZZedsd]d^Z e jdtd_d^Z edkd`daZ!e!jdldbdaZ!dudedfZ"dvdgdhZ#  Z$S )wFontzProxy object for parent of a `<w:rPr>` element and providing access to
    character properties such as font name, font size, bold, and subscript.Nrr
   parent
Any | Nonec                   s   t  || || _|| _d S N)super__init___element_r)selfr   r   	__class__ F/home/ubuntu/flask/venv/lib/python3.10/site-packages/docx/text/font.pyr      s   
zFont.__init__returnbool | Nonec                 C  
   |  dS )zTRead/write.

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

        Causes text in this font to appear in bold.
        br   r    r   r   r   bold&   r"   z	Font.boldc                 C  r%   )Nr*   r&   r(   r   r   r   r+   .   r)   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  r   )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      
zFont.complex_scriptc                 C  r%   )Nr-   r&   r(   r   r   r   r.   A   r)   c                 C  r   )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   r/   zFont.cs_boldc                 C  r%   )Nr0   r&   r(   r   r   r   r1   N   r)   c                 C  r   )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   r/   zFont.cs_italicc                 C  r%   )Nr2   r&   r(   r   r   r   r3   [   r)   c                 C  r   )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_   r"   zFont.double_strikec                 C  r%   )Nr4   r&   r(   r   r   r   r5   g   r)   c                 C  r   )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   r6   k   r/   zFont.embossc                 C  r%   )Nr6   r&   r(   r   r   r   r6   t   r)   c                 C  r   )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   r/   zFont.hiddenc                 C  r%   )Nr7   r&   r(   r   r   r   r8      r)   WD_COLOR_INDEX | Nonec                 C     | 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   r;   r   r   r   highlight_color   s   zFont.highlight_colorc                 C     | j  }||_d S r   )r   get_or_add_rPrr<   r   r#   r;   r   r   r   r>         

c                 C  r   )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   r/   zFont.italicc                 C  r%   )NrC   r&   r(   r   r   r   rD      r)   c                 C  r   )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   rE      r"   zFont.imprintc                 C  r%   )NrE   r&   r(   r   r   r   rE      r)   c                 C  r   )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   r/   z	Font.mathc                 C  r%   )NrF   r&   r(   r   r   r   rG      r)   
str | Nonec                 C  r:   )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   r;   rFonts_asciir=   r   r   r   name      z	Font.namec                 C  s   | j  }||_||_d S r   )r   r@   rI   rFonts_hAnsirA   r   r   r   rJ      s   

c                 C  r   )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   r/   zFont.no_proofc                 C  r%   )NrM   r&   r(   r   r   r   rN      r)   c                 C  r   )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   rO      s   
zFont.outlinec                 C  r%   )NrO   r&   r(   r   r   r   rO      r)   c                 C  r   )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   rP      r"   zFont.rtlc                 C  r%   )NrP   r&   r(   r   r   r   rP      r)   c                 C  r   )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   rQ      r/   zFont.shadowc                 C  r%   )NrQ   r&   r(   r   r   r   rQ      r)   Length | Nonec                 C  r:   )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   r;   sz_valr=   r   r   r   size   s   z	Font.sizeemuint | Length | Nonec                 C  s*   | j  }|d u rd |_d S t||_d S r   )r   r@   r   rS   )r   rU   r;   r   r   r   rT     s   
 c                 C  r   )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  r/   zFont.small_capsc                 C  r%   )NrW   r&   r(   r   r   r   rX   !  r)   c                 C  r   )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%  r/   zFont.snap_to_gridc                 C  r%   )NrY   r&   r(   r   r   r   rZ   .  r)   c                 C  r   )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  r%   )Nr[   r&   r(   r   r   r   r\   =  r)   c                 C  r   )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   r]   A  r/   zFont.strikec                 C  r%   )Nr]   r&   r(   r   r   r   r]   J  r)   c                 C  r:   )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   r;   	subscriptr=   r   r   r   r^   N  rK   zFont.subscriptc                 C  r?   r   )r   r@   r^   rA   r   r   r   r^   Z  rB   c                 C  r:   )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   r;   superscriptr=   r   r   r   r_   _  s   zFont.superscriptc                 C  r?   r   )r   r@   r_   rA   r   r   r   r_   l  rB   bool | WD_UNDERLINE | Nonec                 C  sH   | j j}|du r
dS |j}|tjkrdS |tjkrdS |tjkr"d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   r;   u_valr   	INHERITEDSINGLENONE)r   r;   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   r@   r   rc   rd   ra   )r   r#   r;   re   r   r   r   rf     s   

c                 C  r   )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  r/   zFont.web_hiddenc                 C  r%   )Nrg   r&   r(   r   r   r   rh     r)   rJ   strc                 C  s   | j j}|du r
dS ||S )z;Return the value of boolean child of `w:rPr` having `name`.N)r   r;   _get_bool_val)r   rJ   r;   r   r   r   r     s   
zFont._get_bool_propc                 C  s   | j  }||| dS )z6Assign `value` to the boolean child `name` of `w:rPr`.N)r   r@   _set_bool_val)r   rJ   r#   r;   r   r   r   r'     s   
zFont._set_bool_propr   )r   r
   r   r   )r   r   )r#   r   r   r$   )r   r9   )r#   r9   )r   rH   )r#   rH   r   r$   )r   rR   )rU   rV   r   r$   )r   r`   )r#   r`   r   r$   )rJ   ri   r   r   )rJ   ri   r#   r   )%__name__
__module____qualname____doc__r   propertyr!   setterr+   r,   r.   r1   r3   r5   r6   r8   r>   rD   rE   rG   rJ   rN   rO   rP   rQ   rT   rX   rZ   r\   r]   r^   r_   rf   rh   r   r'   __classcell__r   r   r   r   r      s    
	

r   N)ro   
__future__r   typingr   r   docx.dml.colorr   docx.enum.textr   docx.sharedr   r   r	   docx.oxml.text.runr
   r   r   r   r   r   r   <module>   s    