)Ej9.dZddlmZddlmZmZmZddlmZmZm Z ddl m Z m Z m Z mZmZddlmZmZmZddlmZmZmZe dZe dZe dZed Gd d ZeZGd dZd d d d dZdS)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. Usage documentation at: )copy) dataclassfieldfields) TYPE_CHECKINGAnyOptional) ColorInput DeviceCMYK DeviceGray DeviceRGBconvert_to_device_color)CharVPos TextEmphasisTextMode)CoreFontFontFaceTTFFontT)slotscFeZdZUdZeZeeeze ze d<e Z eeeze ze d<e Zeeeze ze d<dZee d<dZee d<dZee d <d Zee d <d Zee d <dZee d<d Zee d<dZeeeze d<dZee d<edZeeefe d<d Z ee d<e!j"Z#e!e d<e$j%Z&e$e d<dZ'ee d<dZ(ee d<dZ)ee d<dZ*ee d<dZ+ee d <d!Z,ee d"<d#Z-ee d$<d%Z.ee d&<dZ/eeee0fe d'<d+d)Z1d(eee0ffd*Z2dS), GraphicsStatezPMutable snapshot of the current graphics state for fragments and local contexts. draw_color fill_color text_colorF underline strikethrough font_styledfont_stretchingr char_spacing font_family font_size_ptN current_fontcurrent_font_is_set_on_pagec&tdddS)Nr)dashgapphase)dictEC:\PYTHON\MyICR_Suite\python\Lib\site-packages\fpdf/graphics_state.pyzGraphicsState./s!! < < <r-)default_factory dash_pattern line_width text_mode char_vposgffffff? sub_scale sup_scaleg? nom_scale denom_scaleg333333ÿsub_liftg?sup_liftg?nom_liftg denom_lift text_shapingreturncVt|}t|j|_|SN)rr=)self new_states r.rzGraphicsState.copy>s&JJ !%i&z+GraphicsState.as_kwargs..Ds;     gdK,<==   r-)rrAs`r. as_kwargszGraphicsState.as_kwargsCs4    %d||    r-)r>r)3__name__ __module__ __qualname____doc___DEFAULT_DRAW_COLORrr rr r __annotations___DEFAULT_FILL_COLORr_DEFAULT_TEXT_COLORrrboolrrstrr!floatr"r#r$r%rrr&rr1r+r2rFILLr3rLINEr4r5r6r7r8r9r:r;r<r=rrrKr,r-r.rrsTZZ@SJZ/*<=SSS@SJZ/*<=SSS@SJZ/*<=SSSItM4J OU   L%KL%15L(8g-.555(----%*U<<&&&L$sEz"J"-Ix'''"-Ix'''IuIuIuKHeHeHeJ-1L(4S>*111  4S>      r-rceZdZdZeZeZeZ de de ddffd Z dBde e de fdZde fd Zde fd Zdefd Zede eezezfd Zejd e eddfdZede eezezfdZejd e eddfdZede eezezfdZejd e eddfdZedefdZejd eddfdZedefdZejd eddfdZedefdZejd eddfdZede fdZ!e!jd e ddfdZ!ede fdZ"e"jd e ddfdZ"edefdZ#e#jd eddfdZ#ede fdZ$e$jd e ddfd Z$ede fd!Z%e%jd e ddfd"Z%ede e&e'zfd#Z(e(jd e&e'zddfd$Z(edefd%Z)e)jd eddfd&Z)ede*ee ffd'Z+e+jd e*ee fddfd(Z+ede fd)Z,e,jd e ddfd*Z,ede-fd+Z.e.jd e-eze/zddfd,Z.ede0fd-Z1e1jd e0ezddfd.Z1ede fd/Z2e2jd e ddfd0Z2ede fd1Z3e3jd e ddfd2Z3ede fd3Z4e4jd e ddfd4Z4ede fd5Z5e5jd e ddfd6Z5ede fd7Z6e6jd e ddfd8Z6ede fd9Z7e7jd e ddfd:Z7ede fd;Z8e8jd e ddfd<Z8ede fd=Z9e9jd e ddfd>Z9ede e*ee ffd?Z:e:jd e e*ee fddfd@Z:de;fdAZ<xZ=S)CGraphicsStateMixinaMixin 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. argskwargsr>Ncbtg|_tj|i|dSr@)r_GraphicsStateMixin__statestacksuper__init__)rAr[r\ __class__s r.r`zGraphicsStateMixin.__init__]s43@??2C$)&)))))r-newcf||}|j||S)z"Push a graphics state on the stack)_get_current_graphics_stater^append)rArbs r._push_local_stackz$GraphicsStateMixin._push_local_stackas4 ;2244C   %%% r-c4|jS)z(Pop the last graphics state on the stack)r^poprJs r._pop_local_stackz#GraphicsStateMixin._pop_local_stackhs $$&&&r-c@|jdS)z#Retrieve the current graphics state)r^rrJs r.rdz.GraphicsStateMixin._get_current_graphics_statels $))+++r-c2t|jdkS)z-Indicate if a nested graphics state is activer )lenr^rJs r.!_is_current_graphics_state_nestedz4GraphicsStateMixin._is_current_graphics_state_nestedps4$%%))r-c&|jdjSNrk)r^rrJs r.rzGraphicsStateMixin.draw_colort $//r-vcL|dnt||jd_dSrp)rr^rrArrs r.rzGraphicsStateMixin.draw_colorx. IDD#:1#=#= "(((r-c&|jdjSrp)r^rrJs r.rzGraphicsStateMixin.fill_colorrqr-cL|dnt||jd_dSrp)rr^rrts r.rzGraphicsStateMixin.fill_colorrur-c&|jdjSrp)r^rrJs r.rzGraphicsStateMixin.text_colorrqr-cL|dnt||jd_dSrp)rr^rrts r.rzGraphicsStateMixin.text_colorrur-c&|jdjSrpr^rrJs r.rzGraphicsStateMixin.underline $..r-c*||jd_dSrpr{rts r.rzGraphicsStateMixin.underlines*+"'''r-c&|jdjSrpr^rrJs r.rz GraphicsStateMixin.strikethroughs $22r-c*||jd_dSrprrts r.rz GraphicsStateMixin.strikethroughs./"+++r-c&|jdjSrpr^rrJs r.rzGraphicsStateMixin.font_stylerqr-c*||jd_dSrprrts r.rzGraphicsStateMixin.font_style+,"(((r-c&|jdjSrpr^r!rJs r.r!z"GraphicsStateMixin.font_stretchings $44r-c*||jd_dSrprrts r.r!z"GraphicsStateMixin.font_stretchings01"---r-c&|jdjSrpr^r"rJs r.r"zGraphicsStateMixin.char_spacing $11r-c*||jd_dSrprrts r.r"zGraphicsStateMixin.char_spacing-."***r-c&|jdjSrpr^r#rJs r.r#zGraphicsStateMixin.font_familys $00r-c*||jd_dSrprrts r.r#zGraphicsStateMixin.font_familys,-")))r-c&|jdjSrpr^r$rJs r.r$zGraphicsStateMixin.font_size_ptrr-c*||jd_dSrprrts r.r$zGraphicsStateMixin.font_size_ptrr-c|trt|jtsJ|jdj|jz Srp)r isinstancekrVr^r$rJs r. font_sizezGraphicsStateMixin.font_sizes:  -dfe,, , ,, $1DF::r-c:||jz|jd_dSrp)rr^r$rts r.rzGraphicsStateMixin.font_sizes-.Z"***r-c&|jdjSrpr^r%rJs r.r%zGraphicsStateMixin.current_fontrr-c*||jd_dSrprrts r.r%zGraphicsStateMixin.current_fontrr-c&|jdjSrpr^r&rJs r.r&z.GraphicsStateMixin.current_font_is_set_on_pages $@@r-c*||jd_dSrprrts r.r&z.GraphicsStateMixin.current_font_is_set_on_pages<="999r-c&|jdjSrpr^r1rJs r.r1zGraphicsStateMixin.dash_patternrr-c*||jd_dSrprrts r.r1zGraphicsStateMixin.dash_patternrr-c&|jdjSrpr^r2rJs r.r2zGraphicsStateMixin.line_widthrqr-c*||jd_dSrprrts r.r2zGraphicsStateMixin.line_widthrr-c&|jdjSrp)r^r3rJs r.r3zGraphicsStateMixin.text_moder|r-cNtj||jd_dSrp)rcoercer^r3rts r.r3zGraphicsStateMixin.text_modes"*2/!*<*<"'''r-ctr't|jdjtsJ|jdjS)z Return vertical character position relative to line. ([docs](../TextStyling.html#subscript-superscript-and-fractional-numbers)) rk)rrr^r4rrJs r.r4zGraphicsStateMixin.char_vposs?  Id/3=xHH H HH $..r-cNtj||jd_dS)z Set vertical character position relative to line. ([docs](../TextStyling.html#subscript-superscript-and-fractional-numbers)) rkN)rrr^r4rts r.r4zGraphicsStateMixin.char_vposs$ +3/!*<*<"'''r-ctr't|jdjtsJ|jdjS)z Return scale factor for subscript text. ([docs](../TextStyling.html#subscript-superscript-and-fractional-numbers)) rk)rrr^r5rVrJs r.r5zGraphicsStateMixin.sub_scale?  Fd/3=uEE E EE $..r-cDt||jd_dS)z Set scale factor for subscript text. ([docs](../TextStyling.html#subscript-superscript-and-fractional-numbers)) rkN)rVr^r5rts r.r5zGraphicsStateMixin.sub_scale! +0(("'''r-ctr't|jdjtsJ|jdjS)z Return scale factor for superscript text. ([docs](../TextStyling.html#subscript-superscript-and-fractional-numbers)) rk)rrr^r6rVrJs r.r6zGraphicsStateMixin.sup_scale)rr-cDt||jd_dS)z Set scale factor for superscript text. ([docs](../TextStyling.html#subscript-superscript-and-fractional-numbers)) rkN)rVr^r6rts r.r6zGraphicsStateMixin.sup_scale3rr-ctr't|jdjtsJ|jdjS)z Return scale factor for nominator text. ([docs](../TextStyling.html#subscript-superscript-and-fractional-numbers)) rk)rrr^r7rVrJs r.r7zGraphicsStateMixin.nom_scale;rr-cDt||jd_dS)z Set scale factor for nominator text. ([docs](../TextStyling.html#subscript-superscript-and-fractional-numbers)) rkN)rVr^r7rts r.r7zGraphicsStateMixin.nom_scaleErr-ctr't|jdjtsJ|jdjS)z Return scale factor for denominator text. ([docs](../TextStyling.html#subscript-superscript-and-fractional-numbers)) rk)rrr^r8rVrJs r.r8zGraphicsStateMixin.denom_scaleMs?  Hd/3?GG G GG $00r-cDt||jd_dS)z Set scale factor for denominator text. ([docs](../TextStyling.html#subscript-superscript-and-fractional-numbers)) rkN)rVr^r8rts r.r8zGraphicsStateMixin.denom_scaleWs -2!HH")))r-ctr't|jdjtsJ|jdjS)z Return lift factor for subscript text. ([docs](../TextStyling.html#subscript-superscript-and-fractional-numbers)) rk)rrr^r9rVrJs r.r9zGraphicsStateMixin.sub_lift_?  Ed/3FF F FF $//r-cDt||jd_dS)z Set lift factor for denominator text. ([docs](../TextStyling.html#subscript-superscript-and-fractional-numbers)) rkN)rVr^r<rts r.r<zGraphicsStateMixin.denom_lifts ,188"(((r-c&|jdjSrpr^r=rJs r.r=zGraphicsStateMixin.text_shapingrr-c*||jd_dSrprrts r.r=zGraphicsStateMixin.text_shapingrr-ct|jtj|j|j|j|jkr|jnd|j|j kr|jndS)z| Return a `fpdf.fonts.FontFace` instance representing a subset of properties of this GraphicsState. N)familyemphasissize_ptcolorr) rr#rrrr$rDEFAULT_TEXT_COLORrDEFAULT_FILL_COLORrJs r. font_facezGraphicsStateMixin.font_facesk #!(99%#'?d6M#M#MSW$(?d6M#M#MSW    r-r@)>rLrMrNrOrPDEFAULT_DRAW_COLORrRrrSrrr`r StateStackTyperfrirdrTrnpropertyrr r rsetterr rrrrrUrrVr!r"r#r$rrrr%r&r+r1r2rr3intrr4r5r6r7r8r9r:r;r<r=rr __classcell__)ras@r.rZrZMs   -,,*c*S*T******Xn%='.'''',^,,,,*4****0HY%;j%HI000X0 J       0HY%;j%HI000X0 J       0HY%;j%HI000X0 J       /4///X/,4,D,,,,3t333X30t000000C000X0-C-D----5555X522422222e222X2/e/////1S111X1.S.T....2e222X2/e/////;5;;;X; 858T88882hx''9:222X2/h0/T////ATAAAXA!'>T>d>>>('>2d3:.222X2/d3:./4////0E000X0-E-d----/8///X/=8c>C/=D====/8///X/=8c>=d====/5///X/353T3333/5///X/353T3333/5///X/353T33331U111X15U5t5555.%...X._2%2D222_2.%...X._2%2D222_2.%...X._2%2D222_20E000X04E4d44442htCH~6222X2/htCH~6/4//// 8        r-rZ)z$GraphicsStateMixin._push_local_stackz#GraphicsStateMixin._pop_local_stackz.GraphicsStateMixin._get_current_graphics_statez4GraphicsStateMixin._is_current_graphics_state_nestedN)rOr dataclassesrrrtypingrrr drawing_primitivesr r r rrenumsrrrfontsrrrrPrRrSrrrZ__pdoc__r,r-r.rs0000000000//////////4333333333.......... jmm jmm jmm ( ( ( ( ( ( ( ( Vq q q q q q q q j -1+/6:<@   r-