Feature request #9412

add a "minimum characters to wrap" option to labels

Added by Mathieu Pellerin - nIRV almost 11 years ago. Updated over 10 years ago.

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.

space_label.png (255 KB) Mathieu Pellerin - nIRV, 2014-01-22 11:38 PM

Associated revisions

Revision 9b71d081
Added by Nathan Woodrow over 10 years ago

Merge pull request #1208 from nirvn/expression_wordwrap3

[expression] implement a wordwrap function (fix #9412)

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

Also available in: Atom PDF