Feature request #9412
add a "minimum characters to wrap" option to labels
Status: | Closed | ||
---|---|---|---|
Priority: | Normal | ||
Assignee: | - | ||
Category: | Labelling | ||
Pull Request or Patch supplied: | No | Resolution: | |
Easy fix?: | No | Copied to github as #: | 18007 |
Description
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:
Institute
of
Technology
of
Cambodia
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:
Institute
of Technology
of Cambodia
Much better :)
Thoughts? Is it do-able? That sounds to me like a nice little setting to offer to users.
Associated revisions
History
#1 Updated by Mathieu Pellerin - nIRV almost 11 years ago
- Category set to Labelling
#2 Updated by Mathieu Pellerin - nIRV almost 11 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.
#3 Updated by Giovanni Manghi almost 11 years ago
- Target version set to Future Release - Nice to have
#4 Updated by Nathan Woodrow over 10 years ago
- Status changed from Open to Closed
Fixed in changeset 9b71d081f1deb26193eca483ad9e7287bdc7af6b.