-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Multiline ttb text is not supported #4945
Comments
Should ttb lines then advance to the left? |
Advancing lines to the left would be fine for languages that actually use ttb, but not for e.g. English text written in ttb mode. For example, the Bungee font is designed with English ttb in mind, and that would most likely advance to the right. How's this proposal: The |
If You mean No offence, but I strongly advise You to write fonts on new transparent from PIL import Image, ImageDraw, ImageFont
im = Image.new("RGB", (200, 200), "white")
im_text = Image.new("RGBA", im.size, (0,) * 4)
draw = ImageDraw.Draw(im_text)
#---#
text = "abc\n123\nXYZ"
font = ImageFont.truetype(r"Roboto.otf", 24)
co_ords = (100, 10)
#---#
spacing = 0
for Line in text.split("\n"):
draw.text((0, spacing), Line, fill = "black", font)
spacing += font.getsize(Line)[1]
# Crop transparent pixels
im_text = im_text.crop(im_text.getbbox())
im.paste(im_text, co_ords, im_text)
im.show() |
@radarhere asked:
I am wondering how it is implemented in Raqm, what their values are in terms of layout. Two different things seem to be mixed up together, text direction and text progression. ttb tells you the direction of the text run, but doesn't tell you the progression of lines of text. For instance, Han ideographs when written vertically (Chinese, Japanese, Korean (in Hanja), Vietnamese in Chữ Nôm) is written in lines from top of text area to bottom, with lines of text progressing to the left. Mongolian script on the other hand is written top to bottom as well, but lines of text progress to the right instead of the left, so as Mongolian progression is the opposite to Han ideographs, any rendering system needs to be able to support vertical text progression in either direction. |
Raqm does not yet support line-breaking, but instead treats the whole input as a single line of text: HOST-Oman/libraqm#50 |
Thanks @nulano, I suspected that was the case, although I guess it's a moot point at the moment, since I can't get a single vertical line to correctly render, let alone multiple lines. I suspect that the writing system (script) I am working with isn't supported in raqm yet. |
Drawing multiline text currently draws a single vertical line of overlapping characters. I'm not sure how/if this can be fixed within the existing API since it is not clear whether ttb lines should advance to the left or the right.
What did you do?
What actually happened?
Before #4930 (master):
With #4930:
The text was updated successfully, but these errors were encountered: