Xj*NdZddlmZddlmZmZddlmZddlm Z m Z ddl m Z ddl mZddlmZmZmZmZdd lmZmZmZmZdd lmZerdd lmZmZdd lmZGd deZGddeZ GddeZ!GddeZ"GddeZ#GddeZ$GddeZ%y)z8Custom element classes related to run properties (font).) annotations) TYPE_CHECKINGCallable)MSO_THEME_COLOR)WD_COLOR_INDEX WD_UNDERLINE)nsdecls) parse_xml) ST_HexColor ST_HpsMeasure ST_StringST_VerticalAlignRun)BaseOxmlElementOptionalAttributeRequiredAttribute ZeroOrOne)RGBColor)CT_OnOff CT_String)LengthcJeZdZUdZedeZded<ede Z ded<y) CT_ColorzL`w:color` element, specifying the color of a font and perhaps other objects.w:valzRGBColor | strvalz w:themeColorzMSO_THEME_COLOR | None themeColorN) __name__ __module__ __qualname____doc__rr r__annotations__rrrg/mnt/ssd/data/Dropbox/adrian/vault-secondbrain/venv/lib/python3.12/site-packages/docx/oxml/text/font.pyrr s(V+G[ACA):>?)[J&[r"rcJeZdZUdZedeZded<edeZded<y)CT_FontszW`` element. Specifies typeface name for the various language types. zw:ascii str | Noneasciizw:hAnsihAnsiN) rrrrrr r'r r(r!r"r#r%r%'s+ *)Y?E:?))Y?E:?r"r%c.eZdZUdZedeZded<y) CT_HighlightzE`w:highlight` element, specifying font highlighting/background color.rrrN)rrrrrrrr r!r"r#r*r*1sO+G^DCDr"r*c.eZdZUdZedeZded<y) CT_HpsMeasurezJUsed for `` element and others, specifying font size in half-points.rrrN)rrrrrr rr r!r"r#r,r,7sT#G];C;r"r,ceZdZUdZded<ded<ded<ded <d ed <d ed <ded<ded<ded<ded<ded<ded<ded<ded<dZededdZded<eded dZd!ed"<ed#ed$dZ d%ed&<ed'ed(dZ ed)ed*dZ ed+ed,dZ ed-ed.dZ ed/ed0dZed1ed2dZed3ed4dZed5ed6dZed7ed8dZed9ed:dZed;eddZed?ed@dZedAedBdZedCedDdZedEedFdZdGedH<edIedJdZdKedL<edMedNdZdOedP<edQedRdZdSedT<edUedVdZdWedX<edYedZdZed[ed\dZed]ed^dZ ed_ed`dZ![daZ"e#dtdbZ$e$jJdudcZ$e#dvddZ&e&jJdwdeZ&e#dvdfZ'e'jJdxdgZ'e#dvdhZ(e(jJdydiZ(e#dzdjZ)e)jJd{dkZ)e#dzdlZ*e*jJd|dmZ*e#d}dnZ+e+jJd~doZ+e#ddpZ,e,jJddqZ,ddrZ-ddsZ.y)CT_RPrz7`` element, containing the properties for a run.zCallable[[], CT_Color]get_or_add_colorzCallable[[], CT_Highlight]get_or_add_highlightzCallable[[], CT_Fonts]get_or_add_rFontszCallable[[], CT_HpsMeasure] get_or_add_szz!Callable[[], CT_VerticalAlignRun]get_or_add_vertAlignzCallable[..., CT_String] _add_rStylezCallable[[], CT_Underline]_add_uzCallable[[], None] _remove_color_remove_highlight_remove_rFonts_remove_rStyle _remove_sz _remove_u_remove_vertAlign)'w:rStylew:rFontsw:bw:bCsw:iw:iCsw:caps w:smallCapsw:strike w:dstrike w:outlinew:shadoww:emboss w:imprint w:noProof w:snapToGridw:vanish w:webHiddenw:colorz w:spacingzw:wzw:kernz w:positionw:szzw:szCs w:highlightw:uzw:effectzw:bdrzw:shdz w:fitText w:vertAlignw:rtlw:cszw:emzw:langzw:eastAsianLayout w:specVanishw:oMathr=N) successorszCT_String | NonerStyler>zCT_Fonts | NonerFontsr?zCT_OnOff | Nonebr@rArBrCrDrE rF rG rH rI rJrKrLrMrNrOzCT_Color | NonecolorrPzCT_HpsMeasure | NoneszrQzCT_Highlight | None highlightrRzCT_Underline | NoneurS zCT_VerticalAlignRun | None vertAlignrT!rU"rV&rW'c0tdtdzS)zGOverride metaclass method to set `w:color/@val` to RGB black on create.zw)r r )selfs r# _new_colorzCT_RPr._new_colors7'#,FGGr"c8|j}|y|jS)z|Value of `./w:highlight/@val`. Specifies font's highlight color, or `None` if the text is not highlighted. N)rsr)r~rss r# highlight_valzCT_RPr.highlight_vals NN  }}r"cX||jy|j}||_yN)r7r0r)r~valuerss r#rzCT_RPr.highlight_vals+ =  " " $ --/  r"c8|j}|y|jS)a The value of `w:rFonts/@w:ascii` or |None| if not present. Represents the assigned typeface name. The rFonts element also specifies other special-case typeface names; this method handles the case where just the common name is required. N)r\r'r~r\s r# rFonts_asciizCT_RPr.rFonts_asciis >||r"cX||jy|j}||_yr)r8r1r'r~rr\s r#rzCT_RPr.rFonts_asciis+ =    ! '') r"c8|j}|y|jS)z:The value of `w:rFonts/@w:hAnsi` or |None| if not present.N)r\r(rs r# rFonts_hAnsizCT_RPr.rFonts_hAnsis >||r"cP| |jy|j}||_yr)r\r1r(rs r#rzCT_RPr.rFonts_hAnsis( =T[[0 '') r"c8|j}|y|jS)zBString in `./w:rStyle/@val`, or None if `w:rStyle` is not present.N)rZr)r~rZs r#stylez CT_RPr.styles >zzr"c||jy|j|j|y||j_y)zSet `./w:rStyle/@val` to `style`, adding the `w:rStyle` element if necessary. If `style` is |None|, remove `w:rStyle` element if present. N)r)r9rZr4r)r~rs r#rz CT_RPr.styles; =    ! [[     '#DKKOr"cZ|j}|y|jtjk(S)z|True| if `./w:vertAlign/@w:val` is "subscript". |False| if `w:vertAlign/@w:val` contains any other value. |None| if `w:vertAlign` is not present. N)rwrr SUBSCRIPTr~rws r# subscriptzCT_RPr.subscripts,NN  }} 3 = ===r"c||jyt|dur$tj|j _y|j 9|j j tjk(r|jyyyNT)r<boolrrr3rrwr~rs r#rzCT_RPr.subscriptsm =  " " $ %[D .A.K.KD % % ' + ^^ 'DNN,>,>BUB_B_,_  " " $-` 'r"cZ|j}|y|jtjk(S)z|True| if `w:vertAlign/@w:val` is 'superscript'. |False| if `w:vertAlign/@w:val` contains any other value. |None| if `w:vertAlign` is not present. N)rwrr SUPERSCRIPTrs r# superscriptzCT_RPr.superscripts,NN  }} 3 ? ???r"c||jyt|dur$tj|j _y|j 9|j j tjk(r|jyyyr)r<rrrr3rrwrs r#rzCT_RPr.superscriptsm =  " " $ %[D .A.M.MD % % ' + ^^ 'DNN,>,>BUBaBa,a  " " $-b 'r"c8|j}|y|jS)z4The value of `w:sz/@w:val` or |None| if not present.N)rqr)r~rqs r#sz_valz CT_RPr.sz_valsWW :vv r"cX||jy|j}||_yr)r:r2r)r~rrqs r#rz CT_RPr.sz_vals) = OO      !r"c8|j}|y|jS)zValue of `w:u/@val`, or None if not present. Values `WD_UNDERLINE.SINGLE` and `WD_UNDERLINE.NONE` are mapped to `True` and `False` respectively. N)rur)r~rus r#u_valz CT_RPr.u_val!s FF 9uu r"cT|j|||j_yyr)r;r5rrs r#rz CT_RPr.u_val-s%    %DKKM  r"c8t||}|y|jS)zIValue of boolean child with `name`, e.g. "w:b", "w:i", and "w:smallCaps".Ngetattrr)r~nameelements r# _get_bool_valzCT_RPr._get_bool_val3s $% ?{{r"ch|t|d|zyt|d|z}||_y)Nz _remove_%sz get_or_add_%sr)r~rrrs r# _set_bool_valzCT_RPr._set_bool_val:s; = .GD,- . 0 7'$$ 679 r")returnWD_COLOR_INDEX | None)rrrNone)rr&)rr&rr)rr&)rr&rr)r bool | None)rrrr)rr)r Length | None)rr)rWD_UNDERLINE | None)rr)rstrrr)rrrr)/rrrrr _tag_seqrrZr\r^bCsiiCscaps smallCapsstrikedstrikeoutlineshadowembossimprintnoProof snapToGridvanish webHiddenrorqrsrurwrtlcs specVanishoMathrpropertyrsetterrrrrrrrrrr!r"r#r.r.=sA,,44--..;;)) &&%%))&&&&""!!))(HR ) MF M' x|LFOL"5Xab\BAB G 5C%HQRL1A G 5C X(12, 7D-HQRLAI zhqrl ;F  >G  >G zhrsm G  >G>hrsmDJ zhrsm hrsmDJ iHRSM :EH    \\ $ $ > >%% @ @%% ]]   \\&& r"r.c.eZdZUdZedeZded<y) CT_Underlinez<`` element, specifying the underlining style for a run.rrrN)rrrrrrrr r!r"r#rrBsF0,GC Gr"rc.eZdZUdZedeZded<y)CT_VerticalAlignRunz=`` element, specifying subscript or superscript.rrrN)rrrrrrrr r!r"r#rrHsG *=>C>r"rN)&r __future__rtypingrr docx.enum.dmlrdocx.enum.textrr docx.oxml.nsr docx.oxml.parserr docx.oxml.simpletypesr r r rdocx.oxml.xmlchemyrrrr docx.sharedrdocx.oxml.sharedrrrrr%r*r,r.rrr!r"r#rs?"*)7 &  !4"\\@@E?E