Files
serveur-d-authentification/venv/lib/python3.10/site-packages/PIL/__pycache__/ImageText.cpython-310.pyc

197 lines
13 KiB
Plaintext
Raw Normal View History

o
<00>Q<EFBFBD>j<EFBFBD>H<00>@s<>ddlmZddlZddlZddlmZmZmZddlm Z ddl
m Z e j e j Be j BZGdd<08>de<07>ZGd d
<EFBFBD>d
ee<00>ZGd d <0C>d ee<00>ZdS) <0A>)<01> annotationsN)<03>AnyStr<74>Generic<69>
NamedTuple<EFBFBD>)<01> ImageFont)<01>_Inkc@s.eZdZUded<ded<ded<ded<dS) <09>_Line<6E>float<61>x<>y<>str<74>anchor<6F> str | bytes<65>textN)<04>__name__<5F>
__module__<EFBFBD> __qualname__<5F>__annotations__<5F>rr<00>p/home/sorel/systeme_gestion_cerfig/serveur-d-authentification/venv/lib/python3.10/site-packages/PIL/ImageText.pyr s
 r c@s<eZdZUgZded<dZdZ  dddd<10>Zddd<15>ZdS)<19>_Wrapz list[AnyStr]<5D>linesrNr<00> Text[AnyStr]<5D>width<74>int<6E>height<68>
int | None<6E>font<6E> Font | None<6E>return<72>NonecCs|||_||_||_||_|jj}t|t<05>rdnd}|}t<06>t|t<05>r$dnd|<05>D]<5D>}t<06>t|t<05>r3dnd|<08>} | rg|<00>|<07>s@ntt | <09>D] \}
}|
dkrS|<00>|<06>sSn|j
t |<07>7_
|t |<07>d<00>}qD|}||} |j<00> | |j<03>d|krz| }q(|r<>|<00>|<07>s<>n1t |<08>} |<08> <0A>}| t |<08>|_|j<00> ||j<03>d|kr<>|dur<>d } t| <0A><01>n
|}q(|r<>|<00>|<07>||j
d<00>|_dS)
N<EFBFBD><00>z\s*\S+s\s*\S+z
[^\S\n]*\ns
[^\S\n]*\nr<00>zWord does not fit within line)rrrr<00>
isinstancer <00>re<72>findall<6C>add_line<6E> enumerate<74>position<6F>len<65> _get_bbox<6F>lstrip<69>offset<65>
ValueError<EFBFBD>remaining_text)<0E>selfrrrr<00>
input_text<EFBFBD> emptystring<6E>line<6E>word<72>newlines<65>i<>new_line<6E>original_length<74>msgrrr<00>__init__sP<08><04>

z_Wrap.__init__r4r<00>boolcCsx|j|g}|jdur(|jj|d<01>dj}|j<02>||j<06>d}|||jkr(dS||_|jt|<01>|j 7_d|_ dS)N)r<00><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>FrT)
rrr<00>_splitr r,rr*r+r.)r1r4r<00> last_line_y<5F>last_line_heightrrrr(Rs 
z_Wrap.add_line<6E>NN)
rrrrrrrrr r!)r4rr r<) rrrrrr*r.r;r(rrrrrs
 <0C>9rc@s<>eZdZ      d:d;dd<14>Zd<dd<16>Zd=d>dd<1C>Zd?dd<1E>Z  d@dAd%d&<26>ZdBd'd(<28>Z )  * dCdDd2d3<64>Z d@dEd6d7<64>Z
)  *dFdGd8d9<64>Z dS)H<>TextN<74>RGB<47>rrrr<00>moder <00>spacingr
<00> direction<6F>
str | None<6E>features<65>list[str] | None<6E>languager r!cCsH||_|pt<01><02>|_||_||_||_||_||_d|_ d|_
d|_ dS)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.
FrN) rr<00> load_defaultrrFrGrHrJrL<00>embedded_color<6F> stroke_width<74> stroke_fill)r1rrrFrGrHrJrLrrrr;as%
z Text.__init__cCs |jdvr d}t|<01><01>d|_dS)z?
Use embedded color glyphs (COLR, CBDT, SBIX).
)rD<00>RGBAz3Embedded color supported only in RGB and RGBA modesTN)rFr/rN)r1r:rrr<00> embed_color<6F>s

zText.embed_colorrr<00>fill<6C> _Ink | NonecCs||_||_dS)a 
: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)rOrP)r1rrSrrr<00>stroke<6B>s
z Text.strokecCs|jdvrdS|jr dSdS)N)<04>1<>P<>I<>FrVrQ<00>L)rFrN)r1rrr<00> _get_fontmode<64>s
zText._get_fontmoderrr<00>scaling<6E>str | tuple[str, int] | None<6E>Text[AnyStr] | Nonec Cs t|jtj<03>r d}t|<04><01>|jdvrd}t|<04><01>|dur#t|||<02>}n<>t|jtj<07>s0d}t|<04><01>|dur:d}t|<04><01>t|t<08>rBd}n|\}}|j}t||||<07>}|dkr<>|j sYdSt
<EFBFBD> |j <0C>}|j r<>|t |d<07>krod }t|<04><01>|d8}|jj|d
<EFBFBD>}t||||<07>}|j sb||_nG|j r<>d }t|<04><01>t
<EFBFBD>|j <0C>}|j s<>||kr<>d }t|<04><01>|d7}|jj|d
<EFBFBD>}|} t||||<07>}|j r<>|d8}||jj kr<>|jj|d
<EFBFBD>|_| }|j r<>t|j |j|j|j|j|j|jd <0B>}
|j|
_|j|
_|j|
_nd}
t|jt<08>r<>d nd } | <0B>|j<1A>|_|
S)a
Wrap text to fit within a given width.
:param width: The width to fit within.
:param height: An optional height limit. Any text that does not fit within this
will be returned as a new :py:class:`.Text` object.
:param scaling: An optional directive to scale the text, either "grow" as much
as possible within the given dimensions, or "shrink" until it
fits. It can also be a tuple of (direction, limit), with an
integer limit to stop scaling at.
:returns: An :py:class:`.Text` object, or None.
zTransposedFont not supported)N<>ltrzOnly ltr direction supportedNz$'scaling' only supports FreeTypeFontz'scaling' requires 'height'r<00>shrinkzText could not be scaled)<01>size)rrrFrGrHrJrL<00>
<EFBFBD>
)r%rr<00>TransposedFontr/rHr<00> FreeTypeFontr r0<00>math<74>ceilra<00>max<61> font_variant<6E>floorrCrFrGrJrLrNrOrPr<00>joinr) r1rrr\r:<00>wrap<61>limitrra<00> last_wrapr<00>newlinerrrrl<00>s<>

 <06> <06> <06> 
z Text.wrapcCsRt|jt<02>r d|jv}nd|jv}|rd}t|<02><01>|j<04>|j|<00><06>|j|j|j <09>S)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.
rbrcz&can't measure length of multiline text)
r%rr r/r<00> getlengthr[rHrJrL)r1<00> multiliner:rrr<00>
get_lengths * 
<04>zText.get_length<74>rr<00>left<66>xy<78>tuple[float, float]r<00>alignr<00>list[str] | list[bytes] | None<6E> list[_Line]c sl|dur<0E>jdkr dnd}n t|<02>dkrd}t|<05><01>|dur0t<03>jt<05>r*<2A>j<04>d<06>n<05>j<04>d<07>}t|<04>dkrDt|d |d||d <00>gS|dd
vrU<72>jdkrUd }t|<05><01><01><01><08><00><00>j <09>
d <0C>d<00>j <0B>j <0C>j <0A>d <00>j <00>j}|d}g}<08>jdkr<>|d } |D]}
|<08>t| |||
<EFBFBD><04>| |7} q<>|Sg} d } |D]}
<EFBFBD>j <09>|
<EFBFBD><00>j<00>j <0B>j <0C>} | <0B>| <0A>t| | <0A>} q<>|ddkr<>|t|<04>d|d8}n|ddkr<>|t|<04>d|8}d}|D]<5D>}
|d } |d7}| | |}|dvr<>n|dkr<>| |d7} n|dk<02>r| |7} nd}t|<05><01>|dk<02>r<>|d k<03>r<>|t|<04>dk<03>r<>t|
t<05><02>r(|
<EFBFBD>d<17>n|
<EFBFBD>d<18>}t|<10>dk<04>r<>|d dk<02>rB| | d8} n |d dk<02>rM| | 8} <09><00>fdd<1B>|D<00>}d|d}| t|<11>}d }|D]}|<08>t| |||<14><04>| |||t|<10>d7} |d7}<13>qg||7}q<>|d dk<02>r<>| |d8} n |d dk<02>r<>| |8} |<08>t| |||
<EFBFBD><04>||7}q<>|S)N<>ttb<74>lt<6C>lar$z#anchor must be a 2 character stringrbrcrr<00>tbz'anchor not supported for multiline text<78>Ar><00>mg@<40>dr=)rt<00>justify<66>center<65>rightz4align must be "left", "center", "right" or "justify"r<><00> <20> <20>rc s&g|]}<01>j<00>|<01><00>j<02>j<03>j<04><05>qSr)rrprHrJrL)<02>.0r5<00><02>fontmoder1rr<00>
<listcomp><3E>s<06><02><06>zText._split.<locals>.<listcomp><3E>l)rHr+r/r%rr <00>splitr r[r<00>getbboxrJrLrOrG<00>appendrprh<00>sum)r1rurrwrr:<00> line_spacing<6E>top<6F>partsrtr4<00>widths<68> max_width<74>
line_width<EFBFBD>idx<64>width_difference<63>words<64> word_widths<68> word_anchorr7r5rr<>rr?Gs<> 
<0E>
<02> <02><02><02> <02><02> 

L<04><04>
    



<02> <06>
 
z Text._splitr<00>!tuple[float, float, float, float]c Cs(|p|j<00>||<00><02>|j|j|j|j|<03>S)N)rr<>r[rHrJrLrO)r1rrrrrrr,<00>s
<04>zText._get_bboxc Cs<>d}|<00>|||<03>D]L\}}}}|j||d<02>}|d||d||d||d|f}|dur3|}q t|d|d<00>t|d|d<00>t|d|d<00>t|d|d<00>f}q |dus\J<00>|S)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
N)rrrr$r>)r?r,<00>minrh) r1rurrw<00>bboxr r r<00> bbox_linerrr<00>get_bbox<6F>s"



<04><06> z Text.get_bbox)NrDrENNN)rrrrrFr rGr
rHrIrJrKrLrIr r!)r r!)rN)rr
rSrTr r!)r r rB)rrrrr\r]r r^)r r
)rsNrtN)
rurvrrIrwr rrxr ry)rrrrrrIr r<>)rsNrt)rurvrrIrwr r r<>) rrrr;rRrUr[rlrrr?r,r<>rrrrrC`s4 <0C>
3
  <0C>
_; <0C>} <0C><10>rC)<12>
__future__rrfr&<00>typingrrrr"r<00>_typingrrerd<00>Fontr rrCrrrr<00><module>s   L