mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-01-24 00:04:09 +03:00
Updated documentation
This commit is contained in:
parent
bc0bf5efea
commit
16aa710c78
|
@ -12,8 +12,6 @@ Deprecated features
|
||||||
Below are features which are considered deprecated. Where appropriate,
|
Below are features which are considered deprecated. Where appropriate,
|
||||||
a ``DeprecationWarning`` is issued.
|
a ``DeprecationWarning`` is issued.
|
||||||
|
|
||||||
.. _Font size and offset methods:
|
|
||||||
|
|
||||||
PSFile
|
PSFile
|
||||||
~~~~~~
|
~~~~~~
|
||||||
|
|
||||||
|
|
|
@ -474,116 +474,6 @@ Methods
|
||||||
|
|
||||||
.. versionadded:: 8.0.0
|
.. versionadded:: 8.0.0
|
||||||
|
|
||||||
.. py:method:: ImageDraw.textsize(text, font=None, spacing=4, direction=None, features=None, language=None, stroke_width=0)
|
|
||||||
|
|
||||||
.. deprecated:: 9.2.0
|
|
||||||
|
|
||||||
See :ref:`deprecations <Font size and offset methods>` for more information.
|
|
||||||
|
|
||||||
Use :py:meth:`textlength()` to measure the offset of following text with
|
|
||||||
1/64 pixel precision.
|
|
||||||
Use :py:meth:`textbbox()` to get the exact bounding box based on an anchor.
|
|
||||||
|
|
||||||
Return the size of the given string, in pixels.
|
|
||||||
|
|
||||||
.. note:: For historical reasons this function measures text height from
|
|
||||||
the ascender line instead of the top, see :ref:`text-anchors`.
|
|
||||||
If you wish to measure text height from the top, it is recommended
|
|
||||||
to use :meth:`textbbox` with ``anchor='lt'`` instead.
|
|
||||||
|
|
||||||
:param text: Text to be measured. If it contains any newline characters,
|
|
||||||
the text is passed on to :py:meth:`~PIL.ImageDraw.ImageDraw.multiline_textsize`.
|
|
||||||
:param font: An :py:class:`~PIL.ImageFont.ImageFont` instance.
|
|
||||||
:param spacing: If the text is passed on to
|
|
||||||
:py:meth:`~PIL.ImageDraw.ImageDraw.multiline_textsize`,
|
|
||||||
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.
|
|
||||||
|
|
||||||
.. versionadded:: 4.2.0
|
|
||||||
: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.
|
|
||||||
|
|
||||||
.. versionadded:: 4.2.0
|
|
||||||
: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.
|
|
||||||
|
|
||||||
.. versionadded:: 6.0.0
|
|
||||||
|
|
||||||
:param stroke_width: The width of the text stroke.
|
|
||||||
|
|
||||||
.. versionadded:: 6.2.0
|
|
||||||
|
|
||||||
:return: (width, height)
|
|
||||||
|
|
||||||
.. py:method:: ImageDraw.multiline_textsize(text, font=None, spacing=4, direction=None, features=None, language=None, stroke_width=0)
|
|
||||||
|
|
||||||
.. deprecated:: 9.2.0
|
|
||||||
|
|
||||||
See :ref:`deprecations <Font size and offset methods>` for more information.
|
|
||||||
|
|
||||||
Use :py:meth:`.multiline_textbbox` instead.
|
|
||||||
|
|
||||||
Return the size of the given string, in pixels.
|
|
||||||
|
|
||||||
Use :py:meth:`textlength()` to measure the offset of following text with
|
|
||||||
1/64 pixel precision.
|
|
||||||
Use :py:meth:`textbbox()` to get the exact bounding box based on an anchor.
|
|
||||||
|
|
||||||
.. note:: For historical reasons this function measures text height as the
|
|
||||||
distance between the top ascender line and bottom descender line,
|
|
||||||
not the top and bottom of the text, see :ref:`text-anchors`.
|
|
||||||
If you wish to measure text height from the top to the bottom of text,
|
|
||||||
it is recommended to use :meth:`multiline_textbbox` instead.
|
|
||||||
|
|
||||||
:param text: Text to be measured.
|
|
||||||
:param font: An :py:class:`~PIL.ImageFont.ImageFont` instance.
|
|
||||||
: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.
|
|
||||||
|
|
||||||
.. versionadded:: 4.2.0
|
|
||||||
|
|
||||||
: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.
|
|
||||||
|
|
||||||
.. versionadded:: 4.2.0
|
|
||||||
|
|
||||||
: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.
|
|
||||||
|
|
||||||
.. versionadded:: 6.0.0
|
|
||||||
|
|
||||||
:param stroke_width: The width of the text stroke.
|
|
||||||
|
|
||||||
.. versionadded:: 6.2.0
|
|
||||||
|
|
||||||
:return: (width, height)
|
|
||||||
|
|
||||||
.. py:method:: ImageDraw.textlength(text, font=None, direction=None, features=None, language=None, embedded_color=False)
|
.. py:method:: ImageDraw.textlength(text, font=None, direction=None, features=None, language=None, embedded_color=False)
|
||||||
|
|
||||||
Returns length (in pixels with 1/64 precision) of given text when rendered
|
Returns length (in pixels with 1/64 precision) of given text when rendered
|
||||||
|
|
Loading…
Reference in New Issue
Block a user