Replies: 4 comments
-
I was able to workaround it to a degree by using zero-width space: ZWSP = '\u200b'
def add_textbreaks(text, start=6):
result = text[:start]
for character in text[start:]:
result += character + ZWSP
return result But (presumably) Pango adds hyphens and results are not satisfying:
If it's like this with |
Beta Was this translation helpful? Give feedback.
-
This is a good idea. Let's leave this open as an enhancement. |
Beta Was this translation helpful? Give feedback.
-
Updated Pango API link: https://docs.gtk.org/Pango/method.Layout.set_wrap.html |
Beta Was this translation helpful? Give feedback.
-
I made a PR, let's continue discussion there. |
Beta Was this translation helpful? Give feedback.
-
Is your feature request related to a problem? Please describe.
I'm creating 32x32px images with arbitrary text lengths, but the default pango layout is
WRAP_WORD
and it's not placing so much text in a significant number of cases where there is a short word at the beginning followed by a long word.Describe the solution you'd like
The ability to change the wrap mode to
pango.WRAP_CHAR
:https://developer.gnome.org/pygtk/stable/class-pangolayout.html#method-pangolayout--set-wrap
Additional context
libvips/pyvips#204
Beta Was this translation helpful? Give feedback.
All reactions