
    }f/*                     \    d Z ddlmZ ddlmZ ddlmZmZmZ ddlm	Z	  G d d          Z
d	S )
a  
Mixin class for managing a stack of graphics state variables.

The contents of this module are internal to fpdf2, and not part of the public API.
They may change at any time without prior warning or any deprecation period,
in non-backward-compatible ways.
    )copy   )
DeviceGray)CharVPosTextEmphasisTextMode)FontFacec                       e Zd ZdZ ed          Z ed          Z ed          Z fdZd9dZ	d Z
d Zed             Zej        d	             Zed
             Zej        d             Zed             Zej        d             Zed             Zej        d             Zed             Zej        d             Zed             Zej        d             Zed             Zej        d             Zed             Zej        d             Zed             Zej        d             Zed             Zej        d             Zed             Zej        d             Zed             Zej        d             Zed              Zej        d!             Zed"             Zej        d#             Zed$             Zej        d%             Zed&             Zej        d'             Zed(             Zej        d)             Zed*             Zej        d+             Zed,             Z e j        d-             Z ed.             Z!e!j        d/             Z!ed0             Z"e"j        d1             Z"ed2             Z#e#j        d3             Z#ed4             Z$e$j        d5             Z$ed6             Z%e%j        d7             Z%d8 Z& xZ'S ):GraphicsStateMixina  Mixin class for managing a stack of graphics state variables.

    To the subclassing library and its users, the variables look like
    normal instance attributes. But by the magic of properties, we can
    push and pop levels as needed, and users will always see and modify
    just the current version.

    This class is mixed in by fpdf.FPDF(), and is not meant to be used
    directly by user code.
    r   c           
      J   t          d#i d| j        d| j        d| j        dddddd	d
ddddddi dt          ddd          dddt          j        dt          j        ddddddddddddddd d!d"d g| _         t                      j
        |i | d S )$N
draw_color
fill_color
text_color	underlineF
font_style font_stretchingd   char_spacingr   font_familyfont_size_ptcurrent_fontdash_pattern)dashgapphase
line_width	text_mode	char_vpos	sub_scalegffffff?	sup_scale	nom_scaleg      ?denom_scalesub_liftg333333ÿsup_liftg?nom_liftg?
denom_liftg        text_shaping )dictDEFAULT_DRAW_COLORDEFAULT_FILL_COLORDEFAULT_TEXT_COLORr   FILLr   LINE_GraphicsStateMixin__statestacksuper__init__)selfargskwargs	__class__s      L/var/www/rtfcompare/venv/lib/python3.11/site-packages/fpdf/graphics_state.pyr2   zGraphicsStateMixin.__init__    ss      2222  22  %	
 2 !$ Q B Q  R "qaq9999 1 #-- #-- #  #!" $#$ !D%& '( )* +, 3-. "T/
6 	$)&)))))    Nc                     |r| j                             |           d S | j                             |                                            d S N)r0   append_get_current_graphics_state)r3   news     r7   _push_local_stackz$GraphicsStateMixin._push_local_stack>   sQ     	I$$S)))))$$T%E%E%G%GHHHHHr8   c                 4    | j                                         S r:   )r0   popr3   s    r7   _pop_local_stackz#GraphicsStateMixin._pop_local_stackD   s     $$&&&r8   c                 j    t          | j        d                   }t          |d                   |d<   |S Nr(   )r   r0   )r3   gss     r7   r<   z.GraphicsStateMixin._get_current_graphics_stateG   s5     $#B'((!"^"455>	r8   c                 (    | j         d         d         S NrE   r   r0   rA   s    r7   r   zGraphicsStateMixin.draw_colorO        $\22r8   c                 &    || j         d         d<   d S rH   rI   r3   vs     r7   r   zGraphicsStateMixin.draw_colorS       ./"l+++r8   c                 (    | j         d         d         S NrE   r   rI   rA   s    r7   r   zGraphicsStateMixin.fill_colorW   rJ   r8   c                 &    || j         d         d<   d S rP   rI   rL   s     r7   r   zGraphicsStateMixin.fill_color[   rN   r8   c                 (    | j         d         d         S NrE   r   rI   rA   s    r7   r   zGraphicsStateMixin.text_color_   rJ   r8   c                 &    || j         d         d<   d S rS   rI   rL   s     r7   r   zGraphicsStateMixin.text_colorc   rN   r8   c                 (    | j         d         d         S NrE   r   rI   rA   s    r7   r   zGraphicsStateMixin.underlineg        $[11r8   c                 &    || j         d         d<   d S rV   rI   rL   s     r7   r   zGraphicsStateMixin.underlinek   s    -."k***r8   c                 (    | j         d         d         S NrE   r   rI   rA   s    r7   r   zGraphicsStateMixin.font_styleo   rJ   r8   c                 &    || j         d         d<   d S rZ   rI   rL   s     r7   r   zGraphicsStateMixin.font_styles   rN   r8   c                 (    | j         d         d         S NrE   r   rI   rA   s    r7   r   z"GraphicsStateMixin.font_stretchingw   s     $%677r8   c                 &    || j         d         d<   d S r]   rI   rL   s     r7   r   z"GraphicsStateMixin.font_stretching{   s    34"/000r8   c                 (    | j         d         d         S NrE   r   rI   rA   s    r7   r   zGraphicsStateMixin.char_spacing        $^44r8   c                 &    || j         d         d<   d S r`   rI   rL   s     r7   r   zGraphicsStateMixin.char_spacing       01"n---r8   c                 (    | j         d         d         S NrE   r   rI   rA   s    r7   r   zGraphicsStateMixin.font_family   s     $]33r8   c                 &    || j         d         d<   d S re   rI   rL   s     r7   r   zGraphicsStateMixin.font_family   s    /0"m,,,r8   c                 (    | j         d         d         S NrE   r   rI   rA   s    r7   r   zGraphicsStateMixin.font_size_pt   ra   r8   c                 &    || j         d         d<   d S rh   rI   rL   s     r7   r   zGraphicsStateMixin.font_size_pt   rc   r8   c                 8    | j         d         d         | j        z  S rh   )r0   krA   s    r7   	font_sizezGraphicsStateMixin.font_size   s     $^4tv==r8   c                 6    || j         z  | j        d         d<   d S rh   )rk   r0   rL   s     r7   rl   zGraphicsStateMixin.font_size   s     01DF
"n---r8   c                 (    | j         d         d         S NrE   r   rI   rA   s    r7   r   zGraphicsStateMixin.current_font   ra   r8   c                 &    || j         d         d<   d S ro   rI   rL   s     r7   r   zGraphicsStateMixin.current_font   rc   r8   c                 (    | j         d         d         S NrE   r   rI   rA   s    r7   r   zGraphicsStateMixin.dash_pattern   ra   r8   c                 &    || j         d         d<   d S rr   rI   rL   s     r7   r   zGraphicsStateMixin.dash_pattern   rc   r8   c                 (    | j         d         d         S NrE   r   rI   rA   s    r7   r   zGraphicsStateMixin.line_width   rJ   r8   c                 &    || j         d         d<   d S ru   rI   rL   s     r7   r   zGraphicsStateMixin.line_width   rN   r8   c                 (    | j         d         d         S NrE   r   rI   rA   s    r7   r   zGraphicsStateMixin.text_mode   rW   r8   c                 J    t          j        |          | j        d         d<   d S rx   )r   coercer0   rL   s     r7   r   zGraphicsStateMixin.text_mode   s$    -5_Q-?-?"k***r8   c                 (    | j         d         d         S )z
        Return vertical character position relative to line.
        ([docs](../TextStyling.html#subscript-superscript-and-fractional-numbers))
        rE   r   rI   rA   s    r7   r   zGraphicsStateMixin.char_vpos         $[11r8   c                 J    t          j        |          | j        d         d<   dS )z
        Set vertical character position relative to line.
        ([docs](../TextStyling.html#subscript-superscript-and-fractional-numbers))
        rE   r   N)r   rz   r0   rL   s     r7   r   zGraphicsStateMixin.char_vpos   s&     .6_Q-?-?"k***r8   c                 (    | j         d         d         S )z
        Return scale factor for subscript text.
        ([docs](../TextStyling.html#subscript-superscript-and-fractional-numbers))
        rE   r    rI   rA   s    r7   r    zGraphicsStateMixin.sub_scale   r|   r8   c                 @    t          |          | j        d         d<   dS )z
        Set scale factor for subscript text.
        ([docs](../TextStyling.html#subscript-superscript-and-fractional-numbers))
        rE   r    Nfloatr0   rL   s     r7   r    zGraphicsStateMixin.sub_scale   "     .31XX"k***r8   c                 (    | j         d         d         S )z
        Return scale factor for superscript text.
        ([docs](../TextStyling.html#subscript-superscript-and-fractional-numbers))
        rE   r!   rI   rA   s    r7   r!   zGraphicsStateMixin.sup_scale   r|   r8   c                 @    t          |          | j        d         d<   dS )z
        Set scale factor for superscript text.
        ([docs](../TextStyling.html#subscript-superscript-and-fractional-numbers))
        rE   r!   Nr   rL   s     r7   r!   zGraphicsStateMixin.sup_scale   r   r8   c                 (    | j         d         d         S )z
        Return scale factor for nominator text.
        ([docs](../TextStyling.html#subscript-superscript-and-fractional-numbers))
        rE   r"   rI   rA   s    r7   r"   zGraphicsStateMixin.nom_scale   r|   r8   c                 @    t          |          | j        d         d<   dS )z
        Set scale factor for nominator text.
        ([docs](../TextStyling.html#subscript-superscript-and-fractional-numbers))
        rE   r"   Nr   rL   s     r7   r"   zGraphicsStateMixin.nom_scale   r   r8   c                 (    | j         d         d         S )z
        Return scale factor for denominator text.
        ([docs](../TextStyling.html#subscript-superscript-and-fractional-numbers))
        rE   r#   rI   rA   s    r7   r#   zGraphicsStateMixin.denom_scale   s      $]33r8   c                 @    t          |          | j        d         d<   dS )z
        Set scale factor for denominator text.
        ([docs](../TextStyling.html#subscript-superscript-and-fractional-numbers))
        rE   r#   Nr   rL   s     r7   r#   zGraphicsStateMixin.denom_scale  s"     05Qxx"m,,,r8   c                 (    | j         d         d         S )z
        Return lift factor for subscript text.
        ([docs](../TextStyling.html#subscript-superscript-and-fractional-numbers))
        rE   r$   rI   rA   s    r7   r$   zGraphicsStateMixin.sub_lift        $Z00r8   c                 @    t          |          | j        d         d<   dS )z
        Set lift factor for subscript text.
        ([docs](../TextStyling.html#subscript-superscript-and-fractional-numbers))
        rE   r$   Nr   rL   s     r7   r$   zGraphicsStateMixin.sub_lift  "     -2!HH"j)))r8   c                 (    | j         d         d         S )z
        Return lift factor for superscript text.
        ([docs](../TextStyling.html#subscript-superscript-and-fractional-numbers))
        rE   r%   rI   rA   s    r7   r%   zGraphicsStateMixin.sup_lift  r   r8   c                 @    t          |          | j        d         d<   dS )z
        Set lift factor for superscript text.
        ([docs](../TextStyling.html#subscript-superscript-and-fractional-numbers))
        rE   r%   Nr   rL   s     r7   r%   zGraphicsStateMixin.sup_lift'  r   r8   c                 (    | j         d         d         S )z
        Return lift factor for nominator text.
        ([docs](../TextStyling.html#subscript-superscript-and-fractional-numbers))
        rE   r&   rI   rA   s    r7   r&   zGraphicsStateMixin.nom_lift/  r   r8   c                 @    t          |          | j        d         d<   dS )z
        Set lift factor for nominator text.
        ([docs](../TextStyling.html#subscript-superscript-and-fractional-numbers))
        rE   r&   Nr   rL   s     r7   r&   zGraphicsStateMixin.nom_lift7  r   r8   c                 (    | j         d         d         S )z
        Return lift factor for denominator text.
        ([docs](../TextStyling.html#subscript-superscript-and-fractional-numbers))
        rE   r'   rI   rA   s    r7   r'   zGraphicsStateMixin.denom_lift?  s      $\22r8   c                 @    t          |          | j        d         d<   dS )z
        Set lift factor for denominator text.
        ([docs](../TextStyling.html#subscript-superscript-and-fractional-numbers))
        rE   r'   Nr   rL   s     r7   r'   zGraphicsStateMixin.denom_liftG  s"     /4Ahh"l+++r8   c                 (    | j         d         d         S rD   rI   rA   s    r7   r(   zGraphicsStateMixin.text_shapingO  ra   r8   c                 .    |r|| j         d         d<   d S d S rD   rI   rL   s     r7   r(   zGraphicsStateMixin.text_shapingS  s,     	645Db!.111	6 	6r8   c                     t          | j        t          j        | j                  | j        | j        | j        k    r| j        nd| j        | j	        k    r| j        nd          S )z|
        Return a `fpdf.fonts.FontFace` instance
        representing a subset of properties of this GraphicsState.
        N)familyemphasissize_ptcolorr   )
r	   r   r   rz   r   r   r   r-   r   r,   rA   s    r7   	font_facezGraphicsStateMixin.font_faceX  sk    
 #!(99%#'?d6M#M#MSW $(?d6M#M#MSW

 

 

 
	
r8   r:   )(__name__
__module____qualname____doc__r   r+   r,   r-   r2   r>   rB   r<   propertyr   setterr   r   r   r   r   r   r   r   rl   r   r   r   r   r   r    r!   r"   r#   r$   r%   r&   r'   r(   r   __classcell__)r6   s   @r7   r   r      s#       	 	 $A#A#A* * * * *<I I I I' ' '   3 3 X3 0 0 0 3 3 X3 0 0 0 3 3 X3 0 0 0 2 2 X2 / / / 3 3 X3 0 0 0 8 8 X8 5 5 5 5 5 X5 2 2 2 4 4 X4 1 1 1 5 5 X5 2 2 2 > > X> ; ; ; 5 5 X5 2 2 2 5 5 X5 2 2 2 3 3 X3 0 0 0 2 2 X2 @ @ @ 2 2 X2 @ @ @ 2 2 X2 6 6 6 2 2 X2 6 6 6 2 2 X2 6 6 6 4 4 X4 8 8 8 1 1 X1 _5 5 _5 1 1 X1 _5 5 _5 1 1 X1 _5 5 _5 3 3 X3 7 7 7 5 5 X5 6 6 6
 
 
 
 
 
 
r8   r   N)r   r   drawingr   enumsr   r   r   fontsr	   r   r)   r8   r7   <module>r      s                 3 3 3 3 3 3 3 3 3 3      W
 W
 W
 W
 W
 W
 W
 W
 W
 W
r8   