Updated documentation

This commit is contained in:
Andrew Murray 2026-02-13 18:06:29 +11:00
parent 97673f4e70
commit 0ce21f98e7

View File

@ -8,10 +8,14 @@ The :py:mod:`~PIL.ImageFont` module defines a class with the same name. Instance
this class store bitmap fonts, and are used with the
:py:meth:`PIL.ImageDraw.ImageDraw.text` method.
PIL uses its own font file format to store bitmap fonts, limited to 256 characters. You can use
`pilfont.py <https://github.com/python-pillow/pillow-scripts/blob/main/Scripts/pilfont.py>`_
from :pypi:`pillow-scripts` to convert BDF and
PCF font descriptors (X window font formats) to this format.
PIL uses its own font file format to store bitmap fonts, limited to 256 characters. You
can use :py:meth:`~PIL.FontFile.FontFile.to_imagefont` to convert BDF and PCF font
descriptors (X window font formats) to this format::
from PIL import PcfFontFile
with open("Tests/fonts/10x20-ISO8859-1.pcf", "rb") as fp:
font = PcfFontFile.PcfFontFile(fp)
imagefont = font.to_imagefont()
Starting with version 1.1.4, PIL can be configured to support TrueType and
OpenType fonts (as well as other font formats supported by the FreeType