Feature request #9412
add a "minimum characters to wrap" option to labels
|Pull Request or Patch supplied:||No||Resolution:|
|Easy fix?:||No||Copied to github as #:||18007|
It would be really useful for label's multiple lines formatting to be able to set a minimum number of characters for wrap to occur.
When dealing with OpenStreetMap data, I often use the space character(' ') as the wrap character. It's an easy way to deal with long labels without having to go through over hundreds of polygon names and add a special wrap character. That said, it obviously is less elegant with small words (i.e. The, of, etc.). It could be remedied by setting a minimum number of characters on a given line to execute a wrap.
E.g. 'Institute of Technology of Cambodia' (see attached image) wrapped using the space character becomes:
If we could set a minimum number of character before wrap (should be up to user to set it), say for the sake of this example '3', the label - relying on space to wrap - would become:
Much better :)
Thoughts? Is it do-able? That sounds to me like a nice little setting to offer to users.
#2 Updated by Mathieu Pellerin - nIRV over 5 years ago
An alternative to this (maybe more intuitive) would be to implement a wordwrap() function in the expression builder:
wordwrap(string = '', nb_characters = X, break, = '', cut = false[default])
A simple wordwrap(mystring,20,'\
') would trigger a wrap (insert a \
) starting at the 20th character on the next space character.
Maybe the expression function makes more sense.