
    \iG/                    <    S SK Jr  SSKJr  SSKJr   " S S5      rg)    )annotations   )	ImageFont)_Inkc                      \ rS rSr      S               SS jjrSS jrSSS jjrSS jrS r        SS jr	   S       SS	 jjr
S
rg)Text   Nc                    Xl         U=(       d    [        R                  " 5       U l        X0l        X@l        XPl        X`l        Xpl        SU l	        SU l
        SU l        g)a  
:param text: String to be drawn.
:param font: Either an :py:class:`~PIL.ImageFont.ImageFont` instance,
             :py:class:`~PIL.ImageFont.FreeTypeFont` instance,
             :py:class:`~PIL.ImageFont.TransposedFont` instance or ``None``. If
             ``None``, the default font from :py:meth:`.ImageFont.load_default`
             will be used.
:param mode: The image mode this will be used with.
:param spacing: The number of pixels between lines.
:param direction: Direction of the text. It can be ``"rtl"`` (right to left),
                  ``"ltr"`` (left to right) or ``"ttb"`` (top to bottom).
                  Requires libraqm.
:param features: A list of OpenType font features to be used during text
                 layout. This is usually used to turn on optional font features
                 that are not enabled by default, for example ``"dlig"`` or
                 ``"ss01"``, but can be also used to turn off default font
                 features, for example ``"-liga"`` to disable ligatures or
                 ``"-kern"`` to disable kerning.  To get all supported
                 features, see `OpenType docs`_.
                 Requires libraqm.
:param language: Language of the text. Different languages may use
                 different glyph shapes or ligatures. This parameter tells
                 the font which language the text is in, and to apply the
                 correct substitutions as appropriate, if available.
                 It should be a `BCP 47 language code`_.
                 Requires libraqm.
Fr   N)textr   load_defaultfontmodespacing	directionfeatureslanguageembedded_colorstroke_widthstroke_fill)selfr   r   r   r   r   r   r   s           P/var/www/html/kml_chatgpt/mouzaenv/lib/python3.13/site-packages/PIL/ImageText.py__init__Text.__init__   sP    T 	4I224		"  ##$(,    c                L    U R                   S;  a  Sn[        U5      eSU l        g)z/
Use embedded color glyphs (COLR, CBDT, SBIX).
)RGBRGBAz3Embedded color supported only in RGB and RGBA modesTN)r   
ValueErrorr   )r   msgs     r   embed_colorText.embed_color@   s'     99O+GCS/!"r   c                    Xl         X l        g)z
:param width: The width of the text stroke.
:param fill: Color to use for the text stroke when drawing. If not given, will
             default to the ``fill`` parameter from
             :py:meth:`.ImageDraw.ImageDraw.text`.
N)r   r   )r   widthfills      r   strokeText.strokeI   s     "r   c                J    U R                   S;   a  gU R                  (       a  gg)N)1PIFr(   r   L)r   r   )r   s    r   _get_fontmodeText._get_fontmodeS   s!    99,,  r   c                *   [        U R                  [        5      (       a  SOSnXR                  ;   a  Sn[        U5      eU R                  R                  U R                  U R                  5       U R                  U R                  U R                  5      $ )a  
Returns length (in pixels with 1/64 precision) of text.

This is the amount by which following text should be offset.
Text bounding box may extend past the length in some fonts,
e.g. when using italics or accents.

The result is returned as a float; it is a whole number if using basic layout.

Note that the sum of two lengths may not equal the length of a concatenated
string due to kerning. If you need to adjust for kerning, include the following
character and subtract its length.

For example, instead of::

    hello = ImageText.Text("Hello", font).get_length()
    world = ImageText.Text("World", font).get_length()
    helloworld = ImageText.Text("HelloWorld", font).get_length()
    assert hello + world == helloworld

use::

    hello = (
        ImageText.Text("HelloW", font).get_length() -
        ImageText.Text("W", font).get_length()
    )  # adjusted for kerning
    world = ImageText.Text("World", font).get_length()
    helloworld = ImageText.Text("HelloWorld", font).get_length()
    assert hello + world == helloworld

or disable kerning with (requires libraqm)::

    hello = ImageText.Text("Hello", font, features=["-kern"]).get_length()
    world = ImageText.Text("World", font, features=["-kern"]).get_length()
    helloworld = ImageText.Text(
        "HelloWorld", font, features=["-kern"]
    ).get_length()
    assert hello + world == helloworld

:return: Either width for horizontal text, or height for vertical text.

   
z&can't measure length of multiline text)

isinstancer   strr   r   	getlengthr-   r   r   r   )r   split_characterr   s      r   
get_lengthText.get_length[   st    T #-TYY"<"<$%ii':CS/!yy""II NNMMMM
 	
r   c                   Uc  U R                   S:X  a  SOSnO[        U5      S:w  a  Sn[        U5      e[        U R                  [
        5      (       a  U R                  R                  S5      OU R                  R                  S5      n[        U5      S:X  a  XU R                  4/$ US   S	;   a  U R                   S:w  a  S
n[        U5      eU R                  5       nU R                  R                  SUS U R                  U R                  U R                  5      S   U R                  -   U R                  -   nUS   n/ n	U R                   S:X  a(  US   n
U H  nU	R                  X4X+45        X-  n
M     U	$ / nSnU H[  nU R                  R                  XU R                   U R                  U R                  5      nUR                  U5        [!        X5      nM]     US   S:X  a  U[        U5      S-
  U-  S-  -  nOUS   S:X  a  U[        U5      S-
  U-  -  nSnU GH  nUS   n
US-  nXU   -
  nUS;   a  O(US:X  a	  U
US-  -  n
OUS:X  a  U
U-  n
OSn[        U5      eUS:X  Ga'  US:w  Ga   U[        U5      S-
  :w  Ga  [        U[
        5      (       a  UR                  S5      OUR                  S5      n[        U5      S:  a  US   S:X  a  XS-  -  n
OUS   S:X  a  X-  n
U Vs/ s H@  nU R                  R                  UUU R                   U R                  U R                  5      PMB     nnSUS   -   nU[#        U5      -
  nSnU H7  nU	R                  X4UU45        U
UU   U[        U5      S-
  -  -   -  n
US-  nM9     X-  nGMr  US   S:X  a	  U
US-  -  n
OUS   S:X  a  U
U-  n
U	R                  X4X+45        X-  nGM     U	$ s  snf )Nttbltla   z#anchor must be a 2 character stringr0   r1   r   tbz'anchor not supported for multiline textA   r   mg       @d)leftjustifycenterrightz4align must be "left", "center", "right" or "justify"rD        rl)r   lenr   r2   r   r3   splitr-   r   getbboxr   r   r   r   appendr4   maxsum)r   xyanchoralignr   linesfontmodeline_spacingtoppartsrC   linewidths	max_width
line_widthidxwidth_differencewordswordword_widthsword_anchoris                         r   _splitText._split   s=    >!^^u4T$F[A7CS/! $))S)) IIOOD!' 	
 u:?+,,!95!8;CS/!%%'II!!    ll	 	 e>>U"a5Dtk689$ \ U F I!YY00DNNDMM4==
 j)	6	  ayCE
Q,6<<c!E
Q,66C!uq#,c{#:  //h&,s22Dg%,,DPC$S/) Y&(A-s5zA~- ,6dC+@+@

3djjQUFV  5zA~!!9+ O3D#AY#- -D ).	' ). !II// $ ( $ $ $ ). $ 	' '*F1Io+4s;7G+G($)D!LL4+{D)IJ KN5EUVW5X$XXDFA %* +  !9#,s22DAY#%,,Dtk689#s v 9	's   ,AOc           
        SnU R                  5       nU R                  XU5       H  u  pnU R                  R                  UUU R                  U R
                  U R                  U R                  U5      nUS   US   -   US   US   -   US   US   -   US   US   -   4nUc  UnM  [        US   US   5      [        US   US   5      [        US   US   5      [        US   US   5      4nM     Uc  US   US   US   US   4$ U$ )a?  
Returns bounding box (in pixels) of text.

Use :py:meth:`get_length` to get the offset of following text with 1/64 pixel
precision. The bounding box includes extra margins for some fonts, e.g. italics
or accents.

:param xy: The anchor coordinates of the text.
:param anchor: The text anchor alignment. Determines the relative location of
               the anchor to the text. The default alignment is top left,
               specifically ``la`` for horizontal text and ``lt`` for
               vertical text. See :ref:`text-anchors` for details.
:param align: For multiline text, ``"left"``, ``"center"``, ``"right"`` or
              ``"justify"`` determines the relative alignment of lines. Use the
              ``anchor`` parameter to specify the alignment to ``xy``.

:return: ``(left, top, right, bottom)`` bounding box
Nr   r   r<   r?   )
r-   rd   r   rM   r   r   r   r   minrO   )r   rQ   rR   rS   bboxrU   rY   	bbox_lines           r   get_bboxText.get_bbox  s=   0 :>%%' $B >B		))!!I !r!u$!r!u$!r!u$!r!u$	I |  Q1.Q1.Q1.Q1.	' !?4 <a5"Q%A1--r   )
r   r   r   r   r   r   r   r   r   r   )Nr      NNN)r   zstr | bytesr   zNImageFont.ImageFont | ImageFont.FreeTypeFont | ImageFont.TransposedFont | Noner   r3   r   floatr   
str | Noner   zlist[str] | Noner   rn   returnNone)ro   rp   )r   N)r#   rm   r$   z_Ink | Nonero   rp   )ro   r3   )rQ   tuple[float, float]rR   rn   rS   r3   ro   z2list[tuple[tuple[float, float], str, str | bytes]]))r   r   NrC   )rQ   rq   rR   rn   rS   r3   ro   z!tuple[float, float, float, float])__name__
__module____qualname____firstlineno__r   r    r%   r-   r6   rd   rj   __static_attributes__ r   r   r   r      s      $%)#6-6-	6- 6- 6- 6- #6- 6- 
6-p# 4
lu%u/9uBEu	;ur #)!	66 6 	6
 
+6 6r   r   N)
__future__r    r   _typingr   r   rw   r   r   <module>r{      s    "  w wr   