-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to draw vertical text lines with font family? #7313
Comments
There is the "direction" parameter of ImageDraw's
from PIL import Image, ImageDraw, ImageFont
ttf = ImageFont.truetype("Tests/fonts/NotoSansJP-Regular.otf", 20)
im = Image.new(mode="RGB", size=(30, 220))
draw = ImageDraw.Draw(im)
draw.text((0, 0), "English あい", font=ttf, fill=500, direction="ttb")
im.save("out.png") |
Thank you, what is effect of embedded color? ImageDraw.text(xy, text, fill=None, font=None, anchor=None, spacing=4, align='left', direction=None, features=None, language=None, stroke_width=0, stroke_fill=None, embedded_color=False)[source] PARAMETERS: text – String to be drawn. If it contains any newline characters, the text is passed on to multiline_text(). fill – Color to use for the text. font – An ImageFont instance. anchor – The text anchor alignment. Determines the relative location of the anchor to the text. The default alignment is top left. See Text anchors for valid values. This parameter is ignored for non-TrueType fonts. Note This parameter was present in earlier versions of Pillow, but implemented only in version 8.0.0. spacing – If the text is passed on to multiline_text(), the number of pixels between lines. align – If the text is passed on to multiline_text(), "left", "center" or "right". Determines the relative alignment of lines. Use the anchor parameter to specify the alignment to xy. direction – Direction of the text. It can be "rtl" (right to left), "ltr" (left to right) or "ttb" (top to bottom). Requires libraqm. New in version 4.2.0. 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. New in version 4.2.0. 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. New in version 6.0.0. stroke_width – The width of the text stroke. New in version 6.2.0. stroke_fill – Color to use for the text stroke. If not given, will default to the fill parameter. New in version 6.2.0. embedded_color – Whether to use font embedded color glyphs (COLR, CBDT, SBIX). New in version 8.0.0. ImageDraw.multiline_text(xy, text, fill=None, font=None, anchor=None, spacing=4, align='left', direction=None, features=None, language=None, stroke_width=0, stroke_fill=None, embedded_color=False)[source] PARAMETERS: text – String to be drawn. fill – Color to use for the text. font – An ImageFont instance. anchor – The text anchor alignment. Determines the relative location of the anchor to the text. The default alignment is top left. See Text anchors for valid values. This parameter is ignored for non-TrueType fonts. Note This parameter was present in earlier versions of Pillow, but implemented only in version 8.0.0. spacing – The number of pixels between lines. align – "left", "center" or "right". Determines the relative alignment of lines. Use the anchor parameter to specify the alignment to xy. direction – Direction of the text. It can be "rtl" (right to left), "ltr" (left to right) or "ttb" (top to bottom). Requires libraqm. New in version 4.2.0. 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. New in version 4.2.0. 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. New in version 6.0.0. stroke_width – The width of the text stroke. New in version 6.2.0. stroke_fill – Color to use for the text stroke. If not given, will default to New in version 6.2.0. embedded_color – Whether to use font embedded color glyphs (COLR, CBDT, SBIX). |
Embedded color is for fonts that have colors inside them. In #4955, an example of this is fonts that include emojis. |
Thank you. |
The text was updated successfully, but these errors were encountered: